NaMaster
|
Go to the source code of this file.
Macros | |
#define | HE_NITER_DEFAULT 3 |
Default number of iterations used for full-sky spherical harmonic transforms. More... | |
Functions | |
gsl_rng * | init_rng (unsigned int seed) |
Initialize a random number generator. More... | |
double | rng_01 (gsl_rng *rng) |
Top-hat random numbers. More... | |
int | rng_poisson (double lambda, gsl_rng *rng) |
Poisson random numbers. More... | |
void | rng_delta_gauss (double *module, double *phase, gsl_rng *rng, double sigma2) |
Gaussian random numbers (mod-phase). More... | |
void | rng_gauss (gsl_rng *rng, double *r1, double *r2) |
Gaussian random numbers. More... | |
void | end_rng (gsl_rng *rng) |
Destructor for random number generators. More... | |
int | my_linecount (FILE *f) |
Count number of lines in an ASCII file. More... | |
void * | my_malloc (size_t size) |
Error-checked malloc. More... | |
void * | my_calloc (size_t nmemb, size_t size) |
Error-checked calloc. More... | |
FILE * | my_fopen (const char *path, const char *mode) |
Error-checked fopen. More... | |
size_t | my_fwrite (const void *ptr, size_t size, size_t nmemb, FILE *stream) |
Error-checked fwrite. More... | |
size_t | my_fread (void *ptr, size_t size, size_t count, FILE *stream) |
Error-checked fread. More... | |
int | drc3jj (int il2, int il3, int im2, int im3, int *l1min_out, int *l1max_out, double *thrcof, int size) |
Wigner 3-j symbols. More... | |
void | moore_penrose_pinv (gsl_matrix *M, double threshold) |
Moore-Penrose pseudo-inverse. More... | |
void * | dftw_malloc (size_t n) |
Wrapper around fftw_malloc More... | |
void | dftw_free (void *p) |
Wrapper around fftw_free More... | |
void | fs_mapcpy (nmt_flatsky_info *fs, flouble *destmap, flouble *srcmap) |
Copies a map. More... | |
void | fs_map_product (nmt_flatsky_info *fs, flouble *mp1, flouble *mp2, flouble *mp_out) |
Multiplies two flat-sky maps. More... | |
flouble | fs_map_dot (nmt_flatsky_info *fs, flouble *mp1, flouble *mp2) |
Dot product of flat-sky maps. More... | |
void | fs_map2alm (nmt_flatsky_info *fs, int ntrans, int spin, flouble **map, fcomplex **alm) |
Flat-sky SHT. More... | |
void | fs_alm2map (nmt_flatsky_info *fs, int ntrans, int spin, flouble **map, fcomplex **alm) |
Flat-sky inverse SHT. More... | |
nmt_k_function * | fs_generate_beam_window (double fwhm_amin) |
Gaussian beam. More... | |
void | fs_zero_alm (nmt_flatsky_info *fs, fcomplex *alm) |
Zero SHT coefficients. More... | |
void | fs_alter_alm (nmt_flatsky_info *fs, double fwhm_amin, fcomplex *alm_in, fcomplex *alm_out, nmt_k_function *window, int add_to_out) |
Multiply SHT coefficients by beam. More... | |
void | fs_alm2cl (nmt_flatsky_info *fs, nmt_binning_scheme_flat *bin, fcomplex **alms_1, fcomplex **alms_2, int spin_1, int spin_2, flouble **cls, flouble lmn_x, flouble lmx_x, flouble lmn_y, flouble lmx_y) |
Computes Flat-sky power spectrum from Fourier coefficients. More... | |
void | fs_anafast (nmt_flatsky_info *fs, nmt_binning_scheme_flat *bin, flouble **maps_1, flouble **maps_2, int spin_1, int spin_2, flouble **cls) |
Computes Flat-sky power spectrum from maps. More... | |
fcomplex ** | fs_synalm (int nx, int ny, flouble lx, flouble ly, int nmaps, nmt_k_function **cells, nmt_k_function **beam, int seed) |
Gaussian realizations of flat-sky Fourier coefficients. More... | |
flouble * | fs_read_flat_map (char *fname, int *nx, int *ny, flouble *lx, flouble *ly, int nfield) |
Reads flat-sky map. More... | |
long | he_nside2npix (long nside) |
HEALPix number of pixels. More... | |
void | he_pix2vec_ring (long nside, long ipix, double *vec) |
HEALPix pix2vec. More... | |
long | he_ang2pix (long nside, double cth, double phi) |
Modified HEALPix ang2pix. More... | |
long | he_nalms (int lmax) |
Number of alm coefficients. More... | |
long | he_indexlm (int l, int m, int lmax) |
Harmonic coefficient ordering. More... | |
void | he_alm2map (nmt_curvedsky_info *cs, int lmax, int ntrans, int spin, flouble **maps, fcomplex **alms) |
Full-sky inverse SHT. More... | |
void | he_map2alm (nmt_curvedsky_info *cs, int lmax, int ntrans, int spin, flouble **maps, fcomplex **alms, int niter) |
Full-sky SHT. More... | |
void | he_alm2cl (fcomplex **alms_1, fcomplex **alms_2, int spin_1, int spin_2, flouble **cls, int lmax) |
Computes Full-sky power spectrum from harmonic coefficients. More... | |
int | he_get_largest_possible_lmax (nmt_curvedsky_info *cs) |
Gets the multipole approximately corresponding to the Nyquist frequency. More... | |
int | he_get_lmax (nmt_curvedsky_info *cs) |
Get maximum multipole allowed by sky geometry configuration. More... | |
void | he_anafast (flouble **maps_1, flouble **maps_2, int spin_1, int spin_2, flouble **cls, nmt_curvedsky_info *cs, int lmax, int iter) |
Computes Full-sky power spectrum from maps. More... | |
void | he_write_healpix_map (flouble **tmap, int nfields, long nside, char *fname) |
Writes full-sky maps to FITS file. More... | |
void | he_write_CAR_map (flouble **tmap, int nfields, nmt_curvedsky_info *sky_info, char *fname) |
Writes CAR maps to FITS file. More... | |
nmt_curvedsky_info * | he_get_file_params (char *fname, int is_healpix, int *nfields, int *isnest) |
Read map parameters from FITS file. More... | |
flouble * | he_read_map (char *fname, nmt_curvedsky_info *sky_info, int nfield) |
Reads full-sky map from FITS file. More... | |
int | he_ring_num (long nside, double z) |
HEALPix ring number. More... | |
void | he_query_strip (long nside, double theta1, double theta2, int *pixlist, long *npix_strip) |
Returns pixel indices in a given latitude strip. More... | |
void | he_ring2nest_inplace (flouble *map_in, long nside) |
Transform from RING to NEST. More... | |
void | he_nest2ring_inplace (flouble *map_in, long nside) |
Transform from NEST to RING. More... | |
void | he_in_ring (int nside, int iz, flouble phi0, flouble dphi, int *listir, int *nir) |
Returns pixel indices in a given ring. More... | |
void | he_query_disc (int nside, double cth0, double phi, flouble radius, int *listtot, int *nlist, int inclusive) |
Returns pixel indices in a given disc. More... | |
void | he_udgrade (flouble *map_in, long nside_in, flouble *map_out, long nside_out, int nest) |
Up/down grade map resolution. More... | |
double * | he_generate_beam_window (int lmax, double fwhm_amin) |
Gaussian beam. More... | |
void | he_zero_alm (int lmax, fcomplex *alm) |
Zero SHT coefficients. More... | |
void | he_alter_alm (int lmax, double fwhm_amin, fcomplex *alm_in, fcomplex *alm_out, double *window, int add_to_out) |
Multiply SHT coefficients by beam. More... | |
flouble | he_get_pix_area (nmt_curvedsky_info *cs, long i) |
Computes pixel area. More... | |
void | he_map_product (nmt_curvedsky_info *cs, flouble *mp1, flouble *mp2, flouble *mp_out) |
Multiplies two full-sky maps. More... | |
flouble | he_map_dot (nmt_curvedsky_info *cs, flouble *mp1, flouble *mp2) |
Dot product of full-sky maps. More... | |
fcomplex ** | he_synalm (nmt_curvedsky_info *cs, int nmaps, int lmax, flouble **cells, flouble **beam, int seed) |
Gaussian realizations of full-sky harmonic coefficients. More... | |
int | cov_get_coupling_pair_index (int na, int nc, int nb, int nd, int ia1, int ia2, int ic1, int ic2, int ib1, int ib2, int id1, int id2) |
#define HE_NITER_DEFAULT 3 |
Default number of iterations used for full-sky spherical harmonic transforms.
int cov_get_coupling_pair_index | ( | int | na, |
int | nc, | ||
int | nb, | ||
int | nd, | ||
int | ia1, | ||
int | ia2, | ||
int | ic1, | ||
int | ic2, | ||
int | ib1, | ||
int | ib2, | ||
int | id1, | ||
int | id2 | ||
) |
void dftw_free | ( | void * | p | ) |
Wrapper around fftw_free
Wrapping function to support simultaneously single and double precision FFTW memory freeing.
p | Pointer to free. |
void* dftw_malloc | ( | size_t | n | ) |
Wrapper around fftw_malloc
Wrapping function to support simultaneously single and double precision FFTW memory allocation.
n | Number of bytes to allocate |
int drc3jj | ( | int | il2, |
int | il3, | ||
int | im2, | ||
int | im3, | ||
int * | l1min_out, | ||
int * | l1max_out, | ||
double * | thrcof, | ||
int | size | ||
) |
Wigner 3-j symbols.
Returns all non-zero wigner-3j symbols
for
il2 | = ![]() |
im2 | = ![]() |
il3 | = ![]() |
im3 | = ![]() |
l1min_out | Minimum value of ![]() |
l1max_out | Maximum value of ![]() |
thrcof | Output array that will contain the values of the wigner-3j symbols for l1min_out ![]() l1max_out . |
size | Number of elements allocated for thrcof. |
Note that the selection rule completely fix
.
void end_rng | ( | gsl_rng * | rng | ) |
Destructor for random number generators.
void fs_alm2cl | ( | nmt_flatsky_info * | fs, |
nmt_binning_scheme_flat * | bin, | ||
fcomplex ** | alms_1, | ||
fcomplex ** | alms_2, | ||
int | spin_1, | ||
int | spin_2, | ||
flouble ** | cls, | ||
flouble | lmn_x, | ||
flouble | lmx_x, | ||
flouble | lmn_y, | ||
flouble | lmx_y | ||
) |
Computes Flat-sky power spectrum from Fourier coefficients.
Bins the product of two sets of Fourier coefficients into bandpowers.
fs | nmt_flatsky_info structure describing the flat-sky patch. |
bin | nmt_binning_scheme_flat structure defining the bandpowers to use. |
alms_1 | First set of Fourier coefficients to correlate. |
alms_2 | Second set of Fourier coefficients to correlate. |
spin_1 | alms_1 spin. |
spin_2 | alms_2 spin. |
cls | Will hold the output power spectra. Should have shape [ncls ][nbands ], where ncls is the appropriate number of power spectra given the spins of the input fields (e.g. ncls = 2*2 = 4 if both fields have spin=2) and nbpw is the number of bandpowers defined by bin . |
lmn_x | Lower end of the range of multipoles in the x direction that should be masked. |
lmx_x | Upper end of the range of multipoles in the x direction that should be masked. if lmx_x < lmn_x , no Fourier-space masked is performed. |
lmn_y | Same as lmn_x for the y direction. |
lmx_y | Same as lmx_x for the y direction. |
void fs_alm2map | ( | nmt_flatsky_info * | fs, |
int | ntrans, | ||
int | spin, | ||
flouble ** | map, | ||
fcomplex ** | alm | ||
) |
Flat-sky inverse SHT.
Computes the inverse SHT of a set of spin-s flat-sky fields. See scientific documentation and companion paper for further details.
fs | nmt_flatsky_info structure describing the flat-sky patch. |
ntrans | Number of transfoms to carry out. |
spin | Spin of the fields to transform (0 or 2). |
map | Will hold the output maps. Must have shape [ntrans * nmap ][nx * ny ], where nmap is 1 or 2 for spin-0 and spin-2 respectively, and (nx ,ny ) are the dimensions of the patch in the (x,y) directions as defined by fs . |
alm | SHT coefficients to inverse-transform. Must have shape [ntrans * nmap ][ny * (nx /2+1)], where nmap , nx and ny have been defined above. |
void fs_alter_alm | ( | nmt_flatsky_info * | fs, |
double | fwhm_amin, | ||
fcomplex * | alm_in, | ||
fcomplex * | alm_out, | ||
nmt_k_function * | window, | ||
int | add_to_out | ||
) |
Multiply SHT coefficients by beam.
Multiplies a given set of flat-sky Fourier coefficients by a circularly-symmetric function.
fs | nmt_flatsky_info structure describing the flat-sky patch. |
fwhm_amin | Full-width at half-maximum of the Gaussian beam in arcminutes. Only used if window is a NULL pointer. |
alm_in | Input Fourier coefficients. |
alm_out | Output Fourier coefficients. |
window | nmt_k_function defining the function to multiply the coefficients by. Pass a NULL pointer if you want a Gaussian beam with a FWHM defined by fwhm_amin . |
add_to_out | If >0, the result of multiplying alm_in with the window function will be added to the current contents of alm_out . Otherwise, alm_out is overwritten with the product. |
void fs_anafast | ( | nmt_flatsky_info * | fs, |
nmt_binning_scheme_flat * | bin, | ||
flouble ** | maps_1, | ||
flouble ** | maps_2, | ||
int | spin_1, | ||
int | spin_2, | ||
flouble ** | cls | ||
) |
Computes Flat-sky power spectrum from maps.
Similar to fs_alm2cl() but starting from maps.
fs | nmt_flatsky_info structure describing the flat-sky patch. |
bin | nmt_binning_scheme_flat structure defining the bandpowers to use. |
maps_1 | First set of maps to correlate. |
maps_2 | Second set of maps to correlate. |
spin_1 | maps_1 spin. |
spin_2 | maps_2 spin. |
cls | Will hold the output power spectra. Should have shape [ncls ][nbands ], where ncls is the appropriate number of power spectra given the spins of the input fields (e.g. ncls = 2*2 = 4 if both fields have spin=2). and nbpw is the number of bandpowers defined by bin . |
nmt_k_function* fs_generate_beam_window | ( | double | fwhm_amin | ) |
Gaussian beam.
Generates an nmt_k_function structure defining a circularly symmetric Gaussian beam for flat-sky fields.
fwhm_amin | Full-width at half-maximum of the beam in arcminutes. |
void fs_map2alm | ( | nmt_flatsky_info * | fs, |
int | ntrans, | ||
int | spin, | ||
flouble ** | map, | ||
fcomplex ** | alm | ||
) |
Flat-sky SHT.
Computes the direct SHT of a set of spin-s flat-sky fields. See scientific documentation and companion paper for further details.
fs | nmt_flatsky_info structure describing the flat-sky patch. |
ntrans | Number of transfoms to carry out. |
spin | Spin of the fields to transform (0 or 2). |
map | Maps to transform. Must have shape [ntrans * nmap ][nx * ny ], where nmap is 1 or 2 for spin-0 and spin-2 respectively, and (nx ,ny ) are the dimensions of the patch in the (x,y) directions as defined by fs . |
alm | Will hold the output SHT coefficients. Must have shape [ntrans * nmap ][ny * (nx /2+1)], where nmap , nx and ny have been defined above. |
flouble fs_map_dot | ( | nmt_flatsky_info * | fs, |
flouble * | mp1, | ||
flouble * | mp2 | ||
) |
Dot product of flat-sky maps.
Computes the integral over the patch of the product of two maps:
where is the flat-sky patch defined by
fs
. The integral is computed as a Riemann sum over all pixels in the map.
fs | nmt_flatsky_info structure describing the flat-sky patch. |
mp1 | First map to multiply. |
mp2 | Second map to multiply. |
void fs_map_product | ( | nmt_flatsky_info * | fs, |
flouble * | mp1, | ||
flouble * | mp2, | ||
flouble * | mp_out | ||
) |
Multiplies two flat-sky maps.
fs | nmt_flatsky_info structure describing the flat-sky patch. |
mp1 | First map to multiply |
mp2 | Second map to multiply. |
mp_out | Output map containing the product of mp1 and mp2 . It is safe to pass either of the input maps as mp_out , in which case that map will be overwritten with the product. |
void fs_mapcpy | ( | nmt_flatsky_info * | fs, |
flouble * | destmap, | ||
flouble * | srcmap | ||
) |
Copies a map.
fs | nmt_flatsky_info structure describing the flat-sky patch. |
destmap | Map to copy into. |
destmap | Map to copy from. |
flouble* fs_read_flat_map | ( | char * | fname, |
int * | nx, | ||
int * | ny, | ||
flouble * | lx, | ||
flouble * | ly, | ||
int | nfield | ||
) |
Reads flat-sky map.
Reads a flat-sky map from a FITS file. The flat map should be in an image HDU with WCS header keywords defining the sky patch (read from file).
fname | Path to input file. |
nx | Number of grid points in the x dimension (read from file). |
ny | Number of grid points in the y dimension (read from file). |
lx | Length of the x dimension (in steradians) (read from file). |
ly | Length of the y dimension (in steradians) (read from file). |
nfield | Which field to read (i.e. HDU number to read the map from, starting from 0). |
ny
* nx
). fcomplex** fs_synalm | ( | int | nx, |
int | ny, | ||
flouble | lx, | ||
flouble | ly, | ||
int | nmaps, | ||
nmt_k_function ** | cells, | ||
nmt_k_function ** | beam, | ||
int | seed | ||
) |
Gaussian realizations of flat-sky Fourier coefficients.
Generates a Gaussian realization of a set of Fourier coefficients given an input power spectrum.
nx | Number of grid points in the x dimension. |
ny | Number of grid points in the y dimension. |
lx | Length of the x dimension (in steradians). |
ly | Length of the y dimension (in steradians). |
nmaps | Number of fields to generate. |
cells | Set of nmaps * (nmaps + 1) / 2 nmt_k_function structures defining each of the power spectra needed to generate the Fourier coefficients. It must contain only the the upper-triangular part in row-major order (e.g. if nmaps is 3, there will be 6 power spectra ordered as [1-1,1-2,1-3,2-2,2-3,3-3]. |
beam | Set of nmaps nmt_k_function structures defining the beam of each field. |
seed | Seed for this particular realization. |
nmaps
][ny
* (nx
/2 +1)]. void fs_zero_alm | ( | nmt_flatsky_info * | fs, |
fcomplex * | alm | ||
) |
Zero SHT coefficients.
Sets all elements of a set of flat-sky Fourier coefficients to zero.
fs | nmt_flatsky_info structure describing the flat-sky patch. |
alm | Set of Fourier coefficients to zero. See fs_map2alm() for the expected shape of flat-sky Fourier coefficients. |
void he_alm2cl | ( | fcomplex ** | alms_1, |
fcomplex ** | alms_2, | ||
int | spin_1, | ||
int | spin_2, | ||
flouble ** | cls, | ||
int | lmax | ||
) |
Computes Full-sky power spectrum from harmonic coefficients.
Computes the angular power spectrum of two sets of harmonic coefficients
alms_1 | First set of harmonic coefficients to correlate. |
alms_2 | Second set of harmonic coefficients to correlate. |
spin_1 | alms_1 spin. |
spin_2 | alms_2 spin. |
cls | Will hold the output power spectra. Should have shape [ncls ][lmax + 1], where ncls is the appropriate number of power spectra given the spins of the input fields (e.g. ncls = 2*2 = 4 if both fields have spin=2). |
lmax | maximum multipole order. |
void he_alm2map | ( | nmt_curvedsky_info * | cs, |
int | lmax, | ||
int | ntrans, | ||
int | spin, | ||
flouble ** | maps, | ||
fcomplex ** | alms | ||
) |
Full-sky inverse SHT.
Computes the inverse SHT of a set of spin-s full-sky fields. See scientific documentation and companion paper for further details.
cs | curved sky geometry information. |
lmax | maximum multipole order. |
ntrans | Number of transfoms to carry out. |
spin | Spin of the fields to transform (0 or 2). |
maps | Will hold the output maps. Must have shape [ntrans * nmap ][npix ], where nmap is 1 or 2 for spin-0 and spin-2 respectively, and npix is the number of pixels associated with nside . |
alms | SHT coefficients to inverse-transform. Must have shape [ntrans * nmap ][nalm ], where nmap is defined above and nalm can be computed with he_nalm(). |
void he_alter_alm | ( | int | lmax, |
double | fwhm_amin, | ||
fcomplex * | alm_in, | ||
fcomplex * | alm_out, | ||
double * | window, | ||
int | add_to_out | ||
) |
Multiply SHT coefficients by beam.
Multiplies a given set of harmonic coefficients by a circularly-symmetric function.
lmax | Maximum multipole order. |
fwhm_amin | Full-width at half-maximum of the Gaussian beam in arcminutes. Only used if window is a NULL pointer. |
alm_in | Input harmonic coefficients. |
alm_out | Output harmonic coefficients. |
window | Array of size lmax + 1 containing the function to multiply by. Pass a NULL pointer if you want a Gaussian beam with a FWHM defined by fwhm_amin . |
add_to_out | If >0, the result of multiplying alm_in with the window function will be added to the current contents of alm_out . Otherwise, alm_out is overwritten with the product. |
void he_anafast | ( | flouble ** | maps_1, |
flouble ** | maps_2, | ||
int | spin_1, | ||
int | spin_2, | ||
flouble ** | cls, | ||
nmt_curvedsky_info * | cs, | ||
int | lmax, | ||
int | iter | ||
) |
Computes Full-sky power spectrum from maps.
Computes the angular power spectrum of two sets of maps.
maps_1 | First set of maps to correlate. |
maps_2 | Second set of maps to correlate. |
spin_1 | maps_1 spin. |
spin_2 | maps_2 spin. |
cls | Will hold the output power spectra. Should have shape [ncls ][lmax + 1], where ncls is the appropriate number of power spectra given the spins of the input fields (e.g. ncls = 2*2 = 4 if both fields have spin=2). |
cs | curved sky geometry information. |
lmax | maximum multipole order. |
iter | Number of iterations to use when computing the spherical harmonic transforms. |
long he_ang2pix | ( | long | nside, |
double | cth, | ||
double | phi | ||
) |
Modified HEALPix ang2pix.
Returns pixel containing a given point in the sphere.
nside | HEALPix resolution parameter |
phi | Azimuth spherical coordinate ![]() |
cth | Cosine of inclination spherical coordinate ![]() |
double* he_generate_beam_window | ( | int | lmax, |
double | fwhm_amin | ||
) |
Gaussian beam.
Generates an array defining the harmonic coefficients of a Gaussian beam.
lmax | Maximum multipole order. |
fwhm_amin | FWHM of the beam in arcminutes. |
nmt_curvedsky_info* he_get_file_params | ( | char * | fname, |
int | is_healpix, | ||
int * | nfields, | ||
int * | isnest | ||
) |
Read map parameters from FITS file.
fname | Path to input FITS file. |
is_healpix | Whether pixelization should be HEALPix. |
nfields | number of fields in file. |
isnest | >0 if maps are in NESTED ordering. |
int he_get_largest_possible_lmax | ( | nmt_curvedsky_info * | cs | ) |
Gets the multipole approximately corresponding to the Nyquist frequency.
Computes the maximum multipole probed by a map.
cs | curved sky geometry info. |
int he_get_lmax | ( | nmt_curvedsky_info * | cs | ) |
Get maximum multipole allowed by sky geometry configuration.
Returns the maximum multipole for a nmt_curvedsky_info.
cs | curved sky geometry info. |
flouble he_get_pix_area | ( | nmt_curvedsky_info * | cs, |
long | i | ||
) |
Computes pixel area.
cs | curved sky geometry info. |
i | ring number. |
Returns pixel indices in a given ring.
nside | HEALPix resolution parameter |
iz | Ring index. |
phi0 | Center of azimuth range. |
dphi | Width of azimuth range. |
listir | Output list of pixels |
nir | On input, it should hold the number of elements allocated in listir . On output, it contains the number of pixels in the ring. |
long he_indexlm | ( | int | l, |
int | m, | ||
int | lmax | ||
) |
Harmonic coefficient ordering.
Returns the position of a given harmonic coefficient.
l | ![]() |
m | ![]() |
lmax | maximum multipole order. |
void he_map2alm | ( | nmt_curvedsky_info * | cs, |
int | lmax, | ||
int | ntrans, | ||
int | spin, | ||
flouble ** | maps, | ||
fcomplex ** | alms, | ||
int | niter | ||
) |
Full-sky SHT.
Computes the direct SHT of a set of spin-s full-sky fields. See scientific documentation and companion paper for further details.
cs | curved sky geometry information. |
lmax | maximum multipole order. |
ntrans | Number of transfoms to carry out. |
spin | Spin of the fields to transform (0 or 2). |
maps | Maps to transform. Must have shape [ntrans * nmap ][npix ], where nmap is 1 or 2 for spin-0 and spin-2 respectively, and npix is the number of pixels associated with nside . |
alms | Will hold the output SHT coefficients. Must have shape [ntrans * nmap ][nalm ], where nmap is defined above and nalm can be computed with he_nalm(). |
niter | Number of iterations to use when computing the spherical harmonic transforms. |
flouble he_map_dot | ( | nmt_curvedsky_info * | cs, |
flouble * | mp1, | ||
flouble * | mp2 | ||
) |
Dot product of full-sky maps.
Computes the integral over the full sphere of the product of two maps:
The integral is computed as a Riemann sum over all pixels in the map.
cs | curved sky geometry information. |
mp1 | First map to multiply. |
mp2 | Second map to multiply. |
void he_map_product | ( | nmt_curvedsky_info * | cs, |
flouble * | mp1, | ||
flouble * | mp2, | ||
flouble * | mp_out | ||
) |
Multiplies two full-sky maps.
cs | curved sky geometry information. |
mp1 | First map to multiply |
mp2 | Second map to multiply. |
mp_out | Output map containing the product of mp1 and mp2 . It is safe to pass either of the input maps as mp_out , in which case that map will be overwritten with the product. |
long he_nalms | ( | int | lmax | ) |
Number of alm coefficients.
Returns number of harmonic coefficients up to a given multipole order.
lmax | Maximum multipole order. |
void he_nest2ring_inplace | ( | flouble * | map_in, |
long | nside | ||
) |
Transform from NEST to RING.
Transforms a HEALPix map from NEST to RING ordering in place.
map_in | Map to transform. |
nside | HEALPix resolution parameter |
long he_nside2npix | ( | long | nside | ) |
HEALPix number of pixels.
nside | HEALPix resolution parameter |
nside
* nside
. void he_pix2vec_ring | ( | long | nside, |
long | ipix, | ||
double * | vec | ||
) |
HEALPix pix2vec.
Returns normal vector pointing in the direction of a given pixel.
nside | HEALPix resolution parameter. |
ipix | Pixel index in RING ordering. |
vec | Output vector. |
void he_query_disc | ( | int | nside, |
double | cth0, | ||
double | phi, | ||
flouble | radius, | ||
int * | listtot, | ||
int * | nlist, | ||
int | inclusive | ||
) |
Returns pixel indices in a given disc.
nside | HEALPix resolution parameter |
cth0 | ![]() |
phi | Azimuth for the disc centre. |
radius | Disc radius in radians. |
listtot | Output list of pixels |
nlist | On input, it should hold the number of elements allocated in listtot . On output, it contains the number of pixels in the disc. |
inclusive | If >0, include all pixels that are partially insie the disc. Otherwise include only pixels whose centres are inside the disc. |
void he_query_strip | ( | long | nside, |
double | theta1, | ||
double | theta2, | ||
int * | pixlist, | ||
long * | npix_strip | ||
) |
Returns pixel indices in a given latitude strip.
nside | HEALPix resolution parameter |
theta1 | Lower edge of latitude range. |
theta2 | Upper edge of latitude range. |
pixlist | Output list of pixels |
npix_strip | On input, it should hold the number of elements allocated in pixlist . On output, it contains the number of pixels in the strip. |
flouble* he_read_map | ( | char * | fname, |
nmt_curvedsky_info * | sky_info, | ||
int | nfield | ||
) |
Reads full-sky map from FITS file.
fname | Path to input FITS file. |
sky_info | curved sky geometry information. |
nfield | Which field to read (i.e. HDU number to read the map from, starting from 0). |
void he_ring2nest_inplace | ( | flouble * | map_in, |
long | nside | ||
) |
Transform from RING to NEST.
Transforms a HEALPix map from RING to NEST ordering in place.
map_in | Map to transform. |
nside | HEALPix resolution parameter |
int he_ring_num | ( | long | nside, |
double | z | ||
) |
HEALPix ring number.
nside | HEALPix resolution parameter. |
z | z (cos(theta)) coordinate. |
fcomplex** he_synalm | ( | nmt_curvedsky_info * | cs, |
int | nmaps, | ||
int | lmax, | ||
flouble ** | cells, | ||
flouble ** | beam, | ||
int | seed | ||
) |
Gaussian realizations of full-sky harmonic coefficients.
Generates a Gaussian realization of a set of harmonic coefficients given an input power spectrum.
cs | curved sky geometry information. |
nmaps | Number of fields to generate. |
lmax | Maximum multipole order |
cells | Set of nmaps * (nmaps + 1) / 2 arrays of length lmax + 1 defining each of the power spectra needed to generate the Fourier coefficients. It must contain only the the upper-triangular part in row-major order (e.g. if nmaps is 3, there will be 6 power spectra ordered as [1-1,1-2,1-3,2-2,2-3,3-3]. |
beam | Set of nmaps arrays of length lmax + 1 defining the beam of each field. |
seed | Seed for this particular realization. |
nmaps
][nalm
], where nalm
can be computed with he_nalms(). Up/down grade map resolution.
map_in | Input map. |
nside_in | Input HEALPix resolution parameter. |
map_out | Output map. |
nside_out | Output HEALPix resolution parameter. |
nest | If >0, intput and output maps are in NESTED ordering. |
void he_write_CAR_map | ( | flouble ** | tmap, |
int | nfields, | ||
nmt_curvedsky_info * | sky_info, | ||
char * | fname | ||
) |
Writes CAR maps to FITS file.
tmap | Array of maps to write. |
nfields | Number of maps to write. |
sky_info | curved sky geometry information |
fname | Path to output FITS file. |
void he_write_healpix_map | ( | flouble ** | tmap, |
int | nfields, | ||
long | nside, | ||
char * | fname | ||
) |
Writes full-sky maps to FITS file.
tmap | Array of maps to write. |
nfields | Number of maps to write. |
nside | HEALPix resolution parameter. |
fname | Path to output FITS file. |
void he_zero_alm | ( | int | lmax, |
fcomplex * | alm | ||
) |
Zero SHT coefficients.
Sets all elements of a set of harmonic coefficients to zero.
lmax | Maximum multipole order |
alm | Coefficients to zero. Must have a length given by he_nalms(). |
gsl_rng* init_rng | ( | unsigned int | seed | ) |
Initialize a random number generator.
seed | Seed. |
void moore_penrose_pinv | ( | gsl_matrix * | M, |
double | threshold | ||
) |
Moore-Penrose pseudo-inverse.
Returns the Moore-Penrose pseudo-inverse.
M | Input matrix to invert. Will be overwritten with inverse. |
threshold | When inverting, all eigenvalues smaller than threshold times the largest eigenvalue will be discarded (i.e. the corresponding eigenvalue of the pseudo-inverse will be set to zero). |
void* my_calloc | ( | size_t | nmemb, |
size_t | size | ||
) |
Error-checked calloc.
nmemb | Number of elements in pointer to initialize. |
size | Size in bytes of each element in pointer to initialize. |
FILE* my_fopen | ( | const char * | path, |
const char * | mode | ||
) |
Error-checked fopen.
path | Path to file. |
mode | Opening mode ("w", "r" etc.). |
size_t my_fread | ( | void * | ptr, |
size_t | size, | ||
size_t | count, | ||
FILE * | stream | ||
) |
Error-checked fread.
ptr | Pointer to data to input data. |
size | Size of each element of input data in bytes. |
count | Number of elements in input data. |
stream | Open file to read from. |
count
. size_t my_fwrite | ( | const void * | ptr, |
size_t | size, | ||
size_t | nmemb, | ||
FILE * | stream | ||
) |
Error-checked fwrite.
ptr | Pointer to data to output data. |
size | Size of each element of output data in bytes. |
nmemb | Number of elements in output data. |
stream | Open file to write into. |
nmbemb
. int my_linecount | ( | FILE * | f | ) |
Count number of lines in an ASCII file.
f | An open file. |
void* my_malloc | ( | size_t | size | ) |
Error-checked malloc.
size | Size in bytes of pointer to initialize. |
double rng_01 | ( | gsl_rng * | rng | ) |
Top-hat random numbers.
Draw a random number from 0 to 1 with a top-hat distribution.
rng | A random number generator. |
void rng_delta_gauss | ( | double * | module, |
double * | phase, | ||
gsl_rng * | rng, | ||
double | sigma2 | ||
) |
Gaussian random numbers (mod-phase).
Draw modulus and phase of a complex Gaussian random numbers with variance sigma
.
module | Output random modulus. |
phase | Output random phase. |
rng | A random number generator. |
sigma2 | Input variance. |
module
and phase
you could build a complex number with real and imaginary parts re
and im
. The input sigma2
parameter is the mean modulus squared, i.e. sigma2
= < re^2
+ im^2
>. Therefore the variance of either re
or im
on their own is sigma2
/ 2. void rng_gauss | ( | gsl_rng * | rng, |
double * | r1, | ||
double * | r2 | ||
) |
Gaussian random numbers.
Draw a pair of Gaussian random numbers with zero mean and unit variance.
rng | A random number generator. |
r1 | First output random number. |
r2 | Second output random number. |
int rng_poisson | ( | double | lambda, |
gsl_rng * | rng | ||
) |
Poisson random numbers.
Draw a random integer from a Poisson distribution with mean and variance given by lambda
.
lambda | Mean and variance of the distribution. |
rng | A random number generator. |