API Reference
Application programming interface
This is the module for extragalactic point sources (hence the name ‘meps’). It contains public functions save_eps(), load_eps() and a class eps.
- epspy.meps.save_eps(obj, filename)
Saves the class object
eps.Save the class object
epsfor later use. It will save the object in the path where you have all the other outputs from this package.Parameters
- objclass
This should be the class object you want to save.
- filenamestr
Give a filename to your object. It will be saved in the
obj.pathdirectory.
- epspy.meps.load_eps(filename)
To load the class object
eps.Parameters
- filenamestr
This should be the name of the file you gave in
save_eps()for saving class objecteps. Important: provide the full path forfilenamewith the extension.pkl.
Returns
class object
- class epspy.meps.eps(beta_o=2.681, sigma_beta=0.5, logSmin=-2, logSmax=-1, dndS_form=0, log2Nside=6, nu_o=150000000.0, amp=0.0078, gam=0.821, path='', lbl='')
This is the class for extragalactic point sources.
Parameters
- nu_ofloat, optional
Reference frequency, \(\nu_0\), in Hz
- beta_ofloat, optional
Mean spectral index for extragalactic point sources; \(\beta_0\)
- sigma_betafloat, optional
Standard deviation, \(\sigma_{\beta}\), of the Gaussian distribution of \(\beta\)
- ampfloat, optional
Amplitude, \(A\), of the power-law 2-point angular correlation function (2PACF)
- gamfloat, optional
Negative exponent, \(\gamma\), of the power-law 2PACF
- logSminfloat, optional
\(\log_{10}(S_{\mathrm{min}})\), where \(S_{\mathrm{min}}\) is in Jy
- logSmaxfloat, optional
\(\log_{10}(S_{\mathrm{max}})\), where \(S_{\mathrm{max}}\) is in Jy
- dndS_formint, optional
Choose the functional form for \(\mathrm{d}n/\mathrm{d}S\). Available options -> 0 (default),1 or 2. For more details see the API for
dndS().- log2Nsideint, optional
Number of divisions of the base HEALPix pixel in units of \(\log_2\). It sets the sky pixelisation. The number of pixels is \(N_{\mathrm{pix}} = 12\times 2^{2k}\), where \(k=\)
log2Nside- pathstr, optional
Path where you would like to put all your outputs
- lblstr, optional
Append an extra string to all the output file names
Derived attributes
- Nsideint
The
nsiderequired in healpy package- Npixint
Number of pixels; \(N_{\mathrm{pix}}\)
- Npsfloat
Total number of extragalactic point sources on the sky in the \(S\) range \(S_{\mathrm{min}}\) and \(S_{\mathrm{max}}\); \(N_{\mathrm{ps}}\)
Methods
- print_input()
Prints the input parameters you gave.
- dndS(S)
\(\mathrm{d}n/\mathrm{d}S=\mathrm{d}n/\mathrm{d}S(S)\)
Distribution of flux density, S.
The default choice (0) is by Gervasi et al (2008). It is approximately a power law. See paper for the exact form.
Form 1 is by Mandal et al. (2021). It is a \(7^{\mathrm{th}}\) order log-log polynomial fit to the Euclidean number count.
Form 2 is by Intema et al. (2017). It is a \(5^{\mathrm{th}}\) order log-log polynomial fit to the Euclidean number count.
Parameters
- Sfloat
Flux density in units of Jy (jansky). Can be 1 value or a
numpyarray.
Returns
- float
Number of point sources per unit solid angle per unit flux density \((\mathrm{sr}^{-1}\mathrm{Jy}^{-1})\). 1 value or an array depending on input.
- acf(chi)
\(C(\chi)=A\chi^{-\gamma}\)
2-point angular correlation function (2PACF). The amplitude \(A\) and negative power-law index \(\gamma\) are set when you initialise the class object. If you want to simulate an isotropic sky, set
amp=0. The default values for amplitude and index are from Rana & Bagla (2019).Parameters
- chifloat
Angle at which you want to get the 2PACF, should be in radians. One number or an array.
Returns
- float
A pure number or an array accordingly as
chiis a number or an array.
- num_den()
\(n_{\mathrm{ps}}=n_{\mathrm{ps}}(\hat{n})\)
The number density function. It is dependent on the choice of 2PACF and \(\mathrm{d}n/\mathrm{d}S\).
Returns
- float
An array of length \(N_{\mathrm{pix}}\) whose elements are the number of point sources on the corresponding pixel. The array will also be saved as
n_ps.npyin the path you gave during initialisation.
- ref_freq()
Generates the brightness temperature and spectral indices at reference frequency.
3 files will be generated
Tb_o_individual.npy,Tb_o_map.npyandbeta.npyTo understand the structure of these output files see Reference frequency.
- gen_freq(nu=array([5.00e+07, 5.10e+07, 5.20e+07, 5.30e+07, 5.40e+07, 5.50e+07, 5.60e+07, 5.70e+07, 5.80e+07, 5.90e+07, 6.00e+07, 6.10e+07, 6.20e+07, 6.30e+07, 6.40e+07, 6.50e+07, 6.60e+07, 6.70e+07, 6.80e+07, 6.90e+07, 7.00e+07, 7.10e+07, 7.20e+07, 7.30e+07, 7.40e+07, 7.50e+07, 7.60e+07, 7.70e+07, 7.80e+07, 7.90e+07, 8.00e+07, 8.10e+07, 8.20e+07, 8.30e+07, 8.40e+07, 8.50e+07, 8.60e+07, 8.70e+07, 8.80e+07, 8.90e+07, 9.00e+07, 9.10e+07, 9.20e+07, 9.30e+07, 9.40e+07, 9.50e+07, 9.60e+07, 9.70e+07, 9.80e+07, 9.90e+07, 1.00e+08, 1.01e+08, 1.02e+08, 1.03e+08, 1.04e+08, 1.05e+08, 1.06e+08, 1.07e+08, 1.08e+08, 1.09e+08, 1.10e+08, 1.11e+08, 1.12e+08, 1.13e+08, 1.14e+08, 1.15e+08, 1.16e+08, 1.17e+08, 1.18e+08, 1.19e+08, 1.20e+08, 1.21e+08, 1.22e+08, 1.23e+08, 1.24e+08, 1.25e+08, 1.26e+08, 1.27e+08, 1.28e+08, 1.29e+08, 1.30e+08, 1.31e+08, 1.32e+08, 1.33e+08, 1.34e+08, 1.35e+08, 1.36e+08, 1.37e+08, 1.38e+08, 1.39e+08, 1.40e+08, 1.41e+08, 1.42e+08, 1.43e+08, 1.44e+08, 1.45e+08, 1.46e+08, 1.47e+08, 1.48e+08, 1.49e+08, 1.50e+08, 1.51e+08, 1.52e+08, 1.53e+08, 1.54e+08, 1.55e+08, 1.56e+08, 1.57e+08, 1.58e+08, 1.59e+08, 1.60e+08, 1.61e+08, 1.62e+08, 1.63e+08, 1.64e+08, 1.65e+08, 1.66e+08, 1.67e+08, 1.68e+08, 1.69e+08, 1.70e+08, 1.71e+08, 1.72e+08, 1.73e+08, 1.74e+08, 1.75e+08, 1.76e+08, 1.77e+08, 1.78e+08, 1.79e+08, 1.80e+08, 1.81e+08, 1.82e+08, 1.83e+08, 1.84e+08, 1.85e+08, 1.86e+08, 1.87e+08, 1.88e+08, 1.89e+08, 1.90e+08, 1.91e+08, 1.92e+08, 1.93e+08, 1.94e+08, 1.95e+08, 1.96e+08, 1.97e+08, 1.98e+08, 1.99e+08, 2.00e+08]))
Scale the brightness temperature at reference frequency to a general frequency.
If you are running this function you must have run
ref_freq().This function computes the map(s) at general frequency(ies) based on the precomputed values from
ref_freq().Parameters
- nufloat
Frequency (in Hz) at which you want to evaluate the foregrounds due to extragalactic point sources. Can be one number or an array. (Default = 1e6*np.arange(50,201))
3 files will be generated namely,
Tb_nu_glob.npy,Tb_nu_glob.npy, andnu_glob.npy.To understand the structure of these output files see General frequency.
- couple2D(bd=None)
Couple the foregrounds generated by
gen_freq()to the antenna beam directivity.Tb_nu_map.npygenerated bygen_freq()does not account for chromatic distortions in the antenna. To use this function one must provide an array, which should be in the shape of \(N_{\mathrm{pix}} \times N_{\nu}\). An output file will be generated calledT_ant.npy.Also, the best-fitting parameters (along with \(1\sigma\) uncertainty) \(T_{\mathrm{f}}, \beta_{\mathrm{f}}\) and \(\Delta\beta_{\mathrm{f}}\) based on a simple least-squares fitting of power-law-with-a-running-spectral-index function to the antenna temperature data will be printed.
Parameters
- bdstr
Full path to the beam directivity array. By default we call this array as ‘D’ and assume it to be in the path where you have all other outputs.
- visual(t_skymap=False, nu_skymap=None, aps=False, n_skymap=False, dndS_plot=False, spectrum=True, antenna=False, xlog=False, ylog=True, fig_ext='pdf')
Plotting function.
This function can produce several figures such as:-
flux density distribution function
number density map
angular power spectrum
map of foregrounds due to extragalactic point sources (FEPS)
sky-averaged FEPS as function of frequency
antenna temperature as function of frequency
Parameters
- t_skymapbool, optional
Want to plot the FEPS map (a Mollweide projection plot)? (Default =
False).- nu_skymapfloat, optional
Frequency in Hz at which you want to construct the FEPS map. Relevant only when you give
t_skymap = True. Currently, only 1 value supported. (Default =nu_o)- apsbool, optional
Want to plot the angular power spectrum? (Default =
False)- n_skymapbool, optional
Want to plot the number density map (a Mollweide projection plot)? (Default =
False).- dndSbool, optional
Want to plot the flux density distribution? (Default =
False). The form of \(\mathrm{d}n/\mathrm{d}S\) is set during initialisation.- spectrumbool, optional
Want to plot the sky-averaged FEPS? (Default =
True).- antennabool, optional
Add the antenna temperature? (Default =
False). You should have runcouple2D()to use this.- xlogbool, optional
Set the x-axis scale of spectrum plot in log? (Default =
False)- ylogbool, optional
Set the y-axis scale of spectrum plot in log? (Default =
True)- fig_extstr, optional
What should be the format of the figure files? Common choices include png, pdf or jpg. (Default =
pdf)