NaMaster
namaster.h
Go to the documentation of this file.
1 #ifndef _NAMASTER_H_
2 #define _NAMASTER_H_
3 
4 #ifndef NO_DOXY
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <stdarg.h>
8 #include <string.h>
9 #include <unistd.h>
10 #include <math.h>
11 #include <time.h>
12 #include <complex.h>
13 #include <gsl/gsl_vector.h>
14 #include <gsl/gsl_matrix.h>
15 #include <gsl/gsl_linalg.h>
16 #include <gsl/gsl_blas.h>
17 #include <gsl/gsl_eigen.h>
18 #include <gsl/gsl_rng.h>
19 #include <gsl/gsl_randist.h>
20 #include <gsl/gsl_spline.h>
21 #include <gsl/gsl_integration.h>
22 #include <fftw3.h>
23 #endif //NO_DOXY
24 
25 #define NMT_MAX(a,b) (((a)>(b)) ? (a) : (b)) // maximum
26 #define NMT_MIN(a,b) (((a)<(b)) ? (a) : (b)) // minimum
27 
28 #ifdef _SPREC
29 typedef float flouble;
30 typedef float complex fcomplex;
31 #else //_SPREC
32 typedef double flouble;
33 typedef double complex fcomplex;
34 #endif //_SPREC
35 
71 typedef struct {
72  int n_bands;
76 
87 
97 
102 
115 void nmt_bin_cls_flat(nmt_binning_scheme_flat *bin,int nl,flouble *larr,flouble **cls_in,
116  flouble **cls_out,int ncls);
117 
132  int nl,flouble *larr,flouble **cls_out,int ncls);
133 
143 
157 
166 typedef struct {
167  int n_bands;
168  int *nell_list;
169  int **ell_list;
172  int ell_max;
174 
185 nmt_binning_scheme *nmt_bins_constant(int nlb,int lmax,int is_l2);
186 
202 nmt_binning_scheme *nmt_bins_create(int nell,int *bpws,int *ells,flouble *weights,
203  flouble *f_ell,int lmax);
204 
216 nmt_binning_scheme *nmt_bins_read(char *fname,int lmax);
217 
222 
233 void nmt_bin_cls(nmt_binning_scheme *bin,flouble **cls_in,flouble **cls_out,int ncls);
234 
246 void nmt_unbin_cls(nmt_binning_scheme *bin,flouble **cls_in,flouble **cls_out,int ncls);
247 
256 void nmt_ell_eff(nmt_binning_scheme *bin,flouble *larr);
257 
265 typedef struct {
266  int is_const;
271  gsl_spline *spl;
273 
287  flouble y0,flouble yf,int is_const);
288 
293 
302 flouble nmt_k_function_eval(nmt_k_function *f,flouble k,gsl_interp_accel *intacc);
303 
311 typedef struct {
312  int nx;
313  int ny;
314  long npix;
318  int n_ell;
322  // int *n_cells;
324 
336 
341 
348 typedef struct {
350  long npix;
351  int pure_e;
352  int pure_b;
355  int spin;
356  int nmaps;
359  int ntemp;
362  gsl_matrix *matrix_M;
364  int lite;
365  int mask_only;
367 
372 
409  flouble *mask,int spin,flouble **maps,int ntemp,flouble ***temp,
410  int nl_beam,flouble *l_beam,flouble *beam,
411  int pure_e,int pure_b,double tol_pinv,int masked_input,
412  int is_lite,int mask_only);
438 flouble **nmt_synfast_flat(int nx,int ny,flouble lx,flouble ly,int nfields,int *spin_arr,
439  int nl_beam,flouble *l_beam,flouble **beam_fields,
440  int nl_cell,flouble *l_cell,flouble **cell_fields,
441  int seed);
442 
454 void nmt_purify_flat(nmt_field_flat *fl,flouble *mask,fcomplex **walm0,
455  flouble **maps_in,flouble **maps_out,fcomplex **alms);
456 
470 typedef struct {
472  long n_eq;
473  int lmax_sht;
474  int nx_short;
475  int nx;
476  int ny;
477  long npix;
480  flouble phi0; // longitude of first pixel
481  flouble theta0; // colatitude of last ring
483 
491 
510 nmt_curvedsky_info *nmt_curvedsky_info_alloc(int is_healpix,long nside,
511  int lmax_sht,
512  int nx0,int ny0,flouble Dtheta,flouble Dphi,
513  flouble phi0,flouble theta0);
514 
515 
522 
536 
543 typedef struct {
545  long npix;
546  int lmax;
547  int pure_e;
548  int pure_b;
551  int spin;
552  int nmaps;
555  int ntemp;
558  gsl_matrix *matrix_M;
560  int lite;
561  int mask_only;
562 } nmt_field;
563 
567 void nmt_field_free(nmt_field *fl);
568 
606  int ntemp,flouble ***temp,flouble *beam,
607  int pure_e,int pure_b,int n_iter_mask_purify,double tol_pinv,
608  int niter,int masked_input,int is_lite,int mask_only);
609 
641 nmt_field *nmt_field_read(int is_healpix,char *fname_mask,char *fname_maps,char *fname_temp,
642  char *fname_beam,int spin,int pure_e,int pure_b,
643  int n_iter_mask_purify,double tol_pinv,int niter);
644 
664 flouble **nmt_synfast_sph(nmt_curvedsky_info *cs,int nfields,int *spin_arr,int lmax,
665  flouble **cells,flouble **beam_fields,int seed);
666 
679 void nmt_purify(nmt_field *fl,flouble *mask,fcomplex **walm0,
680  flouble **maps_in,flouble **maps_out,fcomplex **alms,int niter);
681 
719 void nmt_apodize_mask(long nside,flouble *mask_in,flouble *mask_out,flouble aposize,char *apotype);
720 
721 
735 void nmt_apodize_mask_flat(int nx,int ny,flouble lx,flouble ly,
736  flouble *mask_in,flouble *mask_out,flouble aposize,char *apotype);
737 
743 typedef struct {
744  int ncls;
745  flouble ellcut_x[2];
746  flouble ellcut_y[2];
747  int pe1;
748  int pe2;
749  int pb1;
750  int pb2;
752  int is_teb;
753  int *n_cells;
759  gsl_permutation *coupling_matrix_perm;
761 
766 
783  flouble lmn_x,flouble lmx_x,
784  flouble lmn_y,flouble lmx_y,int is_teb);
785 
810  flouble lmn_x,flouble lmx_x,flouble lmn_y,flouble lmx_y,
811  int nl_prop,flouble *l_prop,flouble **cl_proposal,
812  flouble **cl_bias);
813 
832 void nmt_couple_cl_l_flat_fast(nmt_workspace_flat *w,int nl,flouble *larr,flouble **cl_in,
833  flouble **cl_out);
847 void nmt_couple_cl_l_flat_quick(nmt_workspace_flat *w,int nl,flouble *larr,flouble **cl_in,
848  flouble **cl_out);
849 
864 void nmt_decouple_cl_l_flat(nmt_workspace_flat *w,flouble **cl_in,flouble **cl_noise_in,
865  flouble **cl_bias,flouble **cl_out);
866 
886  nmt_binning_scheme_flat *bin,flouble **cl_out,
887  flouble lmn_x,flouble lmx_x,flouble lmn_y,flouble lmx_y);
888 
922  flouble lmn_x,flouble lmx_x,
923  flouble lmn_y,flouble lmx_y,
924  nmt_workspace_flat *w0,flouble **cl_noise,
925  int nl_prop,flouble *l_prop,flouble **cl_prop,
926  flouble **cl_out);
927 
933 typedef struct {
934  int lmax;
936  int lmax_mask;
937  int is_teb;
938  int ncls;
945  gsl_permutation *coupling_matrix_perm;
946 } nmt_workspace;
947 
948 typedef struct {
949  int lmax;
951  int npcl;
952  int s1;
953  int s2;
954  int has_00;
956  int has_0s;
958  int has_ss;
961  int pure_e1;
962  int pure_e2;
963  int pure_b1;
964  int pure_b2;
965  int pure_any;
966  int npure_0s;
967  int npure_ss;
969 
971  int npcl, flouble **pcl_masks,
972  int s1, int s2,
973  int pure_e1, int pure_b1,
974  int pure_e2, int pure_b2,
975  int do_teb, int l_toeplitz,
976  int l_exact, int dl_band);
978 
992  int is_teb,int niter,int lmax_mask,
993  int l_toeplitz,int l_exact,int dl_band);
994 
1007 void nmt_update_coupling_matrix(nmt_workspace *w,int n_rows,double *new_matrix);
1008 
1017  nmt_binning_scheme *bin);
1018 
1030  int nl1,double *b1,
1031  int nl2,double *b2);
1032 
1037 
1053  flouble **cl_proposal,flouble **cl_bias,int niter);
1054 
1069  int niter);
1070 
1085 void nmt_couple_cl_l(nmt_workspace *w,flouble **cl_in,flouble **cl_out);
1086 
1101 void nmt_decouple_cl_l(nmt_workspace *w,flouble **cl_in,flouble **cl_noise_in,
1102  flouble **cl_bias,flouble **cl_out);
1103 
1113 void nmt_compute_bandpower_windows(nmt_workspace *w,double *bpw_win_out);
1114 
1127 void nmt_compute_coupled_cell(nmt_field *fl1,nmt_field *fl2,flouble **cl_out);
1128 
1156  flouble **cl_noise,flouble **cl_proposal,flouble **cl_out,
1157  int niter,int lmax_mask,int l_toeplitz,
1158  int l_exact,int dl_band);
1159 
1167 typedef struct {
1178 
1183 
1198  nmt_field_flat *flb1,nmt_field_flat *flb2,
1200 
1224  int spin_a,int spin_b,int spin_c,int spin_d,
1226  int nl,flouble *larr,
1227  flouble **clac,flouble **clad,
1228  flouble **clbc,flouble **clbd,flouble *covar_out);
1229 
1236 typedef struct {
1237  int lmax;
1247 
1252 
1266  nmt_field *flb1,nmt_field *flb2,
1267  int lmax,int niter,
1268  int l_toeplitz,int l_exact,int dl_band);
1269 
1292  int spin_a,int spin_b,int spin_c,int spin_d,
1293  nmt_workspace *wa,nmt_workspace *wb,
1294  flouble **clac,flouble **clad,
1295  flouble **clbc,flouble **clbd,
1296  flouble *covar_out);
1297 
1320  int spin_a,int spin_b,int spin_c,int spin_d,
1321  nmt_workspace *wa,nmt_workspace *wb,
1322  flouble **clac,flouble **clad,
1323  flouble **clbc,flouble **clbd,
1324  flouble *covar_out);
1325 
1336 void nmt_workspace_write_fits(nmt_workspace *w,char *fname);
1337 
1348 
1359 
1371 
1383 
1394 
1406 
1417 
1418 #endif //_NAMASTER_H_
int pure_b2
Definition: namaster.h:964
int pure_e
>0 if E-modes have been purified
Definition: namaster.h:547
fcomplex *** a_temp
Spherical harmonic transfomrs of template maps (mask-multiplied AND purified if requested).
Definition: namaster.h:557
nmt_covar_workspace * nmt_covar_workspace_read_fits(char *fname)
Builds nmt_covar_workspace structure from file.
void nmt_purify(nmt_field *fl, flouble *mask, fcomplex **walm0, flouble **maps_in, flouble **maps_out, fcomplex **alms, int niter)
E- or B-mode purifies a given pair of full-sky (Q,U) maps.
Definition: namaster.h:948
void nmt_workspace_update_binning(nmt_workspace *w, nmt_binning_scheme *bin)
Updates the binning scheme associated to this workspace.
int pe2
Is the E-mode component of the second field purified?
Definition: namaster.h:748
nmt_binning_scheme_flat * nmt_bins_flat_constant(int nlb, flouble lmax)
nmt_binning_scheme_flat constructor for constant bandpowers
nmt_binning_scheme_flat * nmt_bins_flat_create(int nell, flouble *l0, flouble *lf)
nmt_binning_scheme_flat generic constructor.
nmt_workspace_flat * nmt_workspace_flat_read_fits(char *fname)
Builds nmt_workspace_flat structure from file.
Flat-sky Fourier-space function.
Definition: namaster.h:265
void nmt_field_free(nmt_field *fl)
nmt_field destructor.
int lmax_mask
Definition: namaster.h:950
void nmt_workspace_flat_free(nmt_workspace_flat *w)
nmt_workspace_flat destructor
fcomplex *** a_temp
Fourier-transfomrs of template maps (mask-multiplied AND purified if requested).
Definition: namaster.h:361
int ny
Number of grid points in the theta dimension.
Definition: namaster.h:476
void nmt_couple_cl_l_flat_quick(nmt_workspace_flat *w, int nl, flouble *larr, flouble **cl_in, flouble **cl_out)
Mode-couples an input power spectrum.
void nmt_compute_gaussian_covariance_flat(nmt_covar_workspace_flat *cw, int spin_a, int spin_b, int spin_c, int spin_d, nmt_workspace_flat *wa, nmt_workspace_flat *wb, int nl, flouble *larr, flouble **clac, flouble **clad, flouble **clbc, flouble **clbd, flouble *covar_out)
Compute flat-sky Gaussian covariance matrix.
void nmt_covar_workspace_flat_write_fits(nmt_covar_workspace_flat *cw, char *fname)
Saves nmt_covar_workspace_flat structure to file.
void nmt_decouple_cl_l_flat(nmt_workspace_flat *w, flouble **cl_in, flouble **cl_noise_in, flouble **cl_bias, flouble **cl_out)
Inverts mode-coupling matrix.
int pure_e
>0 if E-modes have been purified.
Definition: namaster.h:351
int lmax_sht
Maximum multipole to compute spherical harmonic transform.
Definition: namaster.h:473
flouble * ell_0_list
Lower edge of each bandpower.
Definition: namaster.h:73
int n_ell
Number of |k|-values for Fourier-space sampling.
Definition: namaster.h:318
Flat-sky bandpowers.
Definition: namaster.h:71
flouble ** xi00_1122
First (a1b1-a2b2), 00, mode coupling matrix (see scientific documentation)
Definition: namaster.h:1169
void nmt_apodize_mask(long nside, flouble *mask_in, flouble *mask_out, flouble aposize, char *apotype)
Apodize full-sky mask.
nmt_k_function * nmt_k_function_alloc(int nk, flouble *karr, flouble *farr, flouble y0, flouble yf, int is_const)
nmt_k_function creator.
flouble ** xi22p_1122
First (a1b1-a2b2), 22+, mode coupling matrix (see scientific documentation)
Definition: namaster.h:1242
gsl_spline * spl
GSL spline interpolator.
Definition: namaster.h:271
nmt_binning_scheme * bin
Bandpowers defining the binning.
Definition: namaster.h:943
Flat-sky Gaussian covariance matrix.
Definition: namaster.h:1167
flouble ** xi00_1221
Second (a1b2-a2b1), 00, mode coupling matrix (see scientific documentation)
Definition: namaster.h:1239
void nmt_compute_deprojection_bias(nmt_field *fl1, nmt_field *fl2, flouble **cl_proposal, flouble **cl_bias, int niter)
Computes deprojection bias.
int is_const
If >0, this function is just a constant.
Definition: namaster.h:266
Full-sky mode-coupling matrix.
Definition: namaster.h:933
flouble * ell_f_list
Upper edge of each bandpower.
Definition: namaster.h:74
void nmt_unbin_cls_flat(nmt_binning_scheme_flat *bin, flouble **cls_in, int nl, flouble *larr, flouble **cls_out, int ncls)
Returns binned power spectra interpolated into an given set of multipoles.
flouble dell
Width of the Fourier-space rings. This is found as min(2 π / lx,2 π / ly).
Definition: namaster.h:319
flouble nmt_k_function_eval(nmt_k_function *f, flouble k, gsl_interp_accel *intacc)
nmt_k_function evaluator.
int ntemp
Number of contaminant templates.
Definition: namaster.h:359
int lmax
Maximum multipole used.
Definition: namaster.h:546
long npix
Total number of pixels (given by nx * ny.
Definition: namaster.h:477
flouble ** xi22p_1221
Second (a1b2-a2b1), 22+, mode coupling matrix (see scientific documentation)
Definition: namaster.h:1243
void nmt_ell_eff_flat(nmt_binning_scheme_flat *bin, flouble *larr)
Returns effective multipoles.
nmt_flatsky_info * nmt_flatsky_info_alloc(int nx, int ny, flouble lx, flouble ly)
nmt_flatsky_info constructor
flouble ** f_ell
Multiplicative ell factor.
Definition: namaster.h:171
flouble ** coupling_matrix_binned
Binned MCM.
Definition: namaster.h:755
flouble *** temp
Contaminant template maps (mask-multiplied but NOT purified).
Definition: namaster.h:360
void nmt_update_coupling_matrix(nmt_workspace *w, int n_rows, double *new_matrix)
Updates the mode coupling matrix with a new one.Saves nmt_workspace structure to file.
flouble ** coupling_matrix_unbinned
Unbinned MCM.
Definition: namaster.h:754
flouble lx
Length of the x dimension (in steradians)
Definition: namaster.h:315
nmt_binning_scheme_flat * bin
Bandpowers defining the binning.
Definition: namaster.h:1168
nmt_workspace_flat * nmt_compute_coupling_matrix_flat(nmt_field_flat *fl1, nmt_field_flat *fl2, nmt_binning_scheme_flat *bin, flouble lmn_x, flouble lmx_x, flouble lmn_y, flouble lmx_y, int is_teb)
Computes mode-coupling matrix.
int is_healpix
is this HEALPix pixelization?
Definition: namaster.h:471
flouble x0
Lower edge of spline interpolation.
Definition: namaster.h:267
flouble ** xi22m_1122
First (a1b1-a2b2), 22-, mode coupling matrix (see scientific documentation)
Definition: namaster.h:1244
int nmaps
Number of maps in the field (2 for spin-2, 1 for spin-0).
Definition: namaster.h:356
flouble ** coupling_matrix_unbinned
Unbinned mode-coupling matrix.
Definition: namaster.h:942
int ell_max
Maximum multipole included.
Definition: namaster.h:172
int nx
Number of grid points in the x dimension.
Definition: namaster.h:312
void nmt_master_calculator_free(nmt_master_calculator *c)
flouble * mask
Field&#39;s mask (an array of npix values).
Definition: namaster.h:549
int mask_only
this field only contains a mask, and beam. No alms, maps or anything else.
Definition: namaster.h:561
void nmt_workspace_flat_write_fits(nmt_workspace_flat *w, char *fname)
Saves nmt_workspace_flat structure to file.
int ** ell_list
List of multipoles in each bandpowers.
Definition: namaster.h:169
flouble ** maps
Observed field values. When initialized, these maps are already multiplied by the mask...
Definition: namaster.h:357
void nmt_covar_workspace_write_fits(nmt_covar_workspace *cw, char *fname)
Saves nmt_covar_workspace structure to file.
void nmt_bin_cls_flat(nmt_binning_scheme_flat *bin, int nl, flouble *larr, flouble **cls_in, flouble **cls_out, int ncls)
Returns average of input power spectrum into bandpowers.
void nmt_bins_flat_free(nmt_binning_scheme_flat *bin)
nmt_binning_scheme_flat destructor
double complex fcomplex
Definition: namaster.h:33
nmt_field_flat * nmt_field_flat_alloc(int nx, int ny, flouble lx, flouble ly, flouble *mask, int spin, flouble **maps, int ntemp, flouble ***temp, int nl_beam, flouble *l_beam, flouble *beam, int pure_e, int pure_b, double tol_pinv, int masked_input, int is_lite, int mask_only)
nmt_field_flat constructor
gsl_permutation * coupling_matrix_perm
Complements coupling_matrix_binned_gsl for inversion.
Definition: namaster.h:759
void nmt_field_flat_free(nmt_field_flat *fl)
nmt_field_flat destructor
int * n_cells
Number of unmasked Fourier-space grid points contributing to a given bandpower.
Definition: namaster.h:753
Flat-sky mode-coupling matrix.
Definition: namaster.h:743
int spin
field&#39;s spin (>=0).
Definition: namaster.h:355
int nmt_diff_curvedsky_info(nmt_curvedsky_info *c1, nmt_curvedsky_info *c2)
Compare two nmt_curvedsky_info structs.
int has_00
Definition: namaster.h:954
int pe1
Is the E-mode component of the first field purified?
Definition: namaster.h:747
void nmt_covar_workspace_free(nmt_covar_workspace *cw)
nmt_covar_workspace destructor.
flouble ** xi22p_1122
First (a1b1-a2b2), 22p, mode coupling matrix (see scientific documentation)
Definition: namaster.h:1173
flouble ** xi00_1122
First (a1b1-a2b2), 00, mode coupling matrix (see scientific documentation)
Definition: namaster.h:1238
flouble * ell_min
Array of n_ell values containing the lower edges of each of the |k| rings.
Definition: namaster.h:321
nmt_curvedsky_info * nmt_curvedsky_info_alloc(int is_healpix, long nside, int lmax_sht, int nx0, int ny0, flouble Dtheta, flouble Dphi, flouble phi0, flouble theta0)
nmt_curvedsky_info creator
void nmt_purify_flat(nmt_field_flat *fl, flouble *mask, fcomplex **walm0, flouble **maps_in, flouble **maps_out, fcomplex **alms)
E- or B-mode purifies a given pair of flat-sky (Q,U) maps.
Full-sky Gaussian covariance matrix.
Definition: namaster.h:1236
int s2
Definition: namaster.h:953
Full-sky bandpowers.
Definition: namaster.h:166
void nmt_workspace_free(nmt_workspace *w)
nmt_workspace destructor
nmt_field * nmt_field_read(int is_healpix, char *fname_mask, char *fname_maps, char *fname_temp, char *fname_beam, int spin, int pure_e, int pure_b, int n_iter_mask_purify, double tol_pinv, int niter)
nmt_field constructor from file.
fcomplex ** alms
Fourier-transfoms of the maps.
Definition: namaster.h:358
nmt_workspace * nmt_workspace_read_fits(char *fname)
Builds nmt_workspace structure from file.
void nmt_ell_eff(nmt_binning_scheme *bin, flouble *larr)
Returns effective multipoles.
long n_eq
equivalent of nside, number of pixels in the equatorial ring
Definition: namaster.h:472
void nmt_compute_bandpower_windows(nmt_workspace *w, double *bpw_win_out)
Returns the bandpower window functions for this workspace.
int pb2
Is the B-mode component of the second field purified?
Definition: namaster.h:750
int ncls
Number of power spectra (1, 2 or 4 depending of the spins of the fields being correlated.
Definition: namaster.h:744
void nmt_couple_cl_l(nmt_workspace *w, flouble **cl_in, flouble **cl_out)
Mode-couples an input power spectrum.
nmt_workspace * nmt_compute_coupling_matrix(nmt_field *fl1, nmt_field *fl2, nmt_binning_scheme *bin, int is_teb, int niter, int lmax_mask, int l_toeplitz, int l_exact, int dl_band)
Computes mode-coupling matrix.
int ny
Number of grid points in the y dimension.
Definition: namaster.h:313
void nmt_compute_uncorr_noise_deprojection_bias(nmt_field *fl1, flouble *map_var, flouble **cl_bias, int niter)
Noise bias from uncorrelated noise map.
nmt_covar_workspace_flat * nmt_covar_workspace_flat_read_fits(char *fname)
Builds nmt_covar_workspace_flat structure from file.
flouble ** xi22m_1221
Second (a1b2-a2b1), 22m, mode coupling matrix (see scientific documentation)
Definition: namaster.h:1176
void nmt_compute_deprojection_bias_flat(nmt_field_flat *fl1, nmt_field_flat *fl2, nmt_binning_scheme_flat *bin, flouble lmn_x, flouble lmx_x, flouble lmn_y, flouble lmx_y, int nl_prop, flouble *l_prop, flouble **cl_proposal, flouble **cl_bias)
Computes deprojection bias.
long npix
Number of pixels in all maps (also contained in fs).
Definition: namaster.h:350
flouble **** xi_0s
Definition: namaster.h:957
void nmt_workspace_update_beams(nmt_workspace *w, int nl1, double *b1, int nl2, double *b2)
Updates the beams associated to this workspace.
flouble ** maps
Observed field values. When initialized, these maps are already multiplied by the mask...
Definition: namaster.h:553
flouble *** xi_00
Definition: namaster.h:955
int ncls
Number of power spectra (1, 2 or 4 depending of the spins of the fields being correlated.
Definition: namaster.h:938
flouble ** xi00_1221
Second (a1b2-a2b1), 00, mode coupling matrix (see scientific documentation)
Definition: namaster.h:1170
flouble ** xi02_1122
First (a1b1-a2b2), 02, mode coupling matrix (see scientific documentation)
Definition: namaster.h:1171
void nmt_apodize_mask_flat(int nx, int ny, flouble lx, flouble ly, flouble *mask_in, flouble *mask_out, flouble aposize, char *apotype)
Apodize flat-sky mask.
flouble **** xi_pp
Definition: namaster.h:959
flouble ** nmt_synfast_sph(nmt_curvedsky_info *cs, int nfields, int *spin_arr, int lmax, flouble **cells, flouble **beam_fields, int seed)
Gaussian realizations of full-sky fields.
int nx_short
Number of grid points in the x dimension before completing the circle.
Definition: namaster.h:474
int mask_only
this field only contains a mask, and beam. No alms, maps or anything else.
Definition: namaster.h:365
void nmt_couple_cl_l_flat_fast(nmt_workspace_flat *w, int nl, flouble *larr, flouble **cl_in, flouble **cl_out)
Mode-couples an input power spectrum.
double flouble
Definition: namaster.h:32
flouble theta0
Definition: namaster.h:481
int lmax_mask
Mask resolution.
Definition: namaster.h:936
nmt_binning_scheme * nmt_bins_create(int nell, int *bpws, int *ells, flouble *weights, flouble *f_ell, int lmax)
nmt_binning_scheme generic constructor.
void nmt_bin_cls(nmt_binning_scheme *bin, flouble **cls_in, flouble **cls_out, int ncls)
Returns average of input power spectrum into bandpowers.
flouble ** xi22m_1221
Second (a1b2-a2b1), 22-, mode coupling matrix (see scientific documentation)
Definition: namaster.h:1245
void nmt_flatsky_info_free(nmt_flatsky_info *fs)
nmt_flatsky_info destructor.
flouble ** w_list
List of weights associated to each multipole in ell_list.
Definition: namaster.h:170
fcomplex ** a_mask
Fourier transform of the mask. Only computed if E or B are purified.
Definition: namaster.h:354
flouble yf
Function will take this value for x > xf.
Definition: namaster.h:270
int nmaps
Number of maps in the field (2 for spin-2, 1 for spin-0).
Definition: namaster.h:552
int lite
lightweight field (no maps, temp, a_temp or a_mask)
Definition: namaster.h:364
int pure_any
Definition: namaster.h:965
Flat-sky information.
Definition: namaster.h:311
flouble * pcl_masks
Pseudo-CL of the masks.
Definition: namaster.h:941
void nmt_k_function_free(nmt_k_function *f)
nmt_k_function destructor
flouble ** xi22m_1122
First (a1b1-a2b2), 22m, mode coupling matrix (see scientific documentation)
Definition: namaster.h:1175
flouble * beam
Field&#39;s beam (defined on all multipoles up to lmax).
Definition: namaster.h:559
fcomplex ** a_mask
Spherical transform of the mask. Only computed if E or B are purified.
Definition: namaster.h:550
void nmt_compute_coupled_cell_flat(nmt_field_flat *fl1, nmt_field_flat *fl2, nmt_binning_scheme_flat *bin, flouble **cl_out, flouble lmn_x, flouble lmx_x, flouble lmn_y, flouble lmx_y)
Coupled pseudo-CL.
flouble Delta_phi
pixel size in phi direction
Definition: namaster.h:479
flouble i_dell
1 / dell
Definition: namaster.h:320
nmt_binning_scheme * nmt_bins_constant(int nlb, int lmax, int is_l2)
nmt_binning_scheme constructor for constant bandpowers.
nmt_covar_workspace_flat * nmt_covar_workspace_flat_init(nmt_field_flat *fla1, nmt_field_flat *fla2, nmt_binning_scheme_flat *ba, nmt_field_flat *flb1, nmt_field_flat *flb2, nmt_binning_scheme_flat *bb)
nmt_covar_workspace_flat constructor
nmt_master_calculator * nmt_compute_master_coefficients(int lmax, int lmax_mask, int npcl, flouble **pcl_masks, int s1, int s2, int pure_e1, int pure_b1, int pure_e2, int pure_b2, int do_teb, int l_toeplitz, int l_exact, int dl_band)
int has_0s
Definition: namaster.h:956
gsl_permutation * coupling_matrix_perm
Complements coupling_matrix_binned_gsl for inversion.
Definition: namaster.h:945
int npcl
Definition: namaster.h:951
int spin
field&#39;s spin (>=0).
Definition: namaster.h:551
flouble ** xi22p_1221
Second (a1b2-a2b1), 22p, mode coupling matrix (see scientific documentation)
Definition: namaster.h:1174
flouble xf
Upper edge of spline interpolation.
Definition: namaster.h:268
int lite
lightweight field (no maps, temp, a_temp or a_mask)
Definition: namaster.h:560
gsl_matrix * matrix_M
Inverse contaminant covariance matrix (see scientific documentation or companion paper).
Definition: namaster.h:558
nmt_flatsky_info * fs
Structure defining patch geometry.
Definition: namaster.h:349
nmt_curvedsky_info * cs
pixelization parameters
Definition: namaster.h:544
flouble ly
Length of the y dimension (in steradians)
Definition: namaster.h:316
void nmt_decouple_cl_l(nmt_workspace *w, flouble **cl_in, flouble **cl_noise_in, flouble **cl_bias, flouble **cl_out)
Inverts mode-coupling matrix.
flouble * mask
Field&#39;s mask (an array of npix values).
Definition: namaster.h:353
int is_teb
Does it hold all MCM elements to compute all of spin0-spin0, 0-2 and 2-2 correlations?
Definition: namaster.h:937
int pure_e1
Definition: namaster.h:961
gsl_matrix * coupling_matrix_binned
GSL version of MCM (prepared for inversion)
Definition: namaster.h:944
gsl_matrix * matrix_M
Inverse contaminant covariance matrix (see scientific documentation or companion paper).
Definition: namaster.h:362
int has_ss
Definition: namaster.h:958
int npure_ss
Definition: namaster.h:967
flouble ** nmt_synfast_flat(int nx, int ny, flouble lx, flouble ly, int nfields, int *spin_arr, int nl_beam, flouble *l_beam, flouble **beam_fields, int nl_cell, flouble *l_cell, flouble **cell_fields, int seed)
Gaussian realizations of flat-sky fields.
int is_teb
Does it hold all MCM elements to compute all of spin0-spin0, 0-2 and 2-2 correlations?
Definition: namaster.h:752
void nmt_covar_workspace_flat_free(nmt_covar_workspace_flat *cw)
nmt_covar_workspace_flat destructor.
void nmt_compute_gaussian_covariance_coupled(nmt_covar_workspace *cw, int spin_a, int spin_b, int spin_c, int spin_d, nmt_workspace *wa, nmt_workspace *wb, flouble **clac, flouble **clad, flouble **clbc, flouble **clbd, flouble *covar_out)
Compute full-sky Gaussian covariance matrix.
nmt_binning_scheme * nmt_bins_read(char *fname, int lmax)
nmt_binning_scheme constructor from file
void nmt_compute_coupled_cell(nmt_field *fl1, nmt_field *fl2, flouble **cl_out)
Coupled pseudo-CL.
int n_bands
Number of bandpowers.
Definition: namaster.h:167
nmt_binning_scheme_flat * bin
Bandpowers defining the binning.
Definition: namaster.h:756
int * nell_list
Number of multipoles belonging to each bandpower.
Definition: namaster.h:168
int lmax
Maximum multipole for the first set of power spectra.
Definition: namaster.h:1237
flouble y0
Function will take this value for x < x0.
Definition: namaster.h:269
int s1
Definition: namaster.h:952
void nmt_bins_free(nmt_binning_scheme *bin)
nmt_binning_scheme destructor
void nmt_workspace_write_fits(nmt_workspace *w, char *fname)
Saves nmt_workspace structure to file.
nmt_covar_workspace * nmt_covar_workspace_init(nmt_field *fla1, nmt_field *fla2, nmt_field *flb1, nmt_field *flb2, int lmax, int niter, int l_toeplitz, int l_exact, int dl_band)
nmt_covar_workspace constructor
nmt_workspace_flat * nmt_compute_power_spectra_flat(nmt_field_flat *fl1, nmt_field_flat *fl2, nmt_binning_scheme_flat *bin, flouble lmn_x, flouble lmx_x, flouble lmn_y, flouble lmx_y, nmt_workspace_flat *w0, flouble **cl_noise, int nl_prop, flouble *l_prop, flouble **cl_prop, flouble **cl_out)
Computes pseudo-CL specrum.
flouble ** xi02_1221
Second (a1b2-a2b1), 02, mode coupling matrix (see scientific documentation)
Definition: namaster.h:1172
int pure_b
>0 if B-modes have been purified.
Definition: namaster.h:352
flouble phi0
Definition: namaster.h:480
int nx
Number of grid points in the phi dimension.
Definition: namaster.h:475
nmt_curvedsky_info * nmt_curvedsky_info_copy(nmt_curvedsky_info *cs_in)
Makes a copy of a nmt_curvedsky_info structure.
int pure_b
>0 if B-modes have been purified
Definition: namaster.h:548
int pure_b1
Definition: namaster.h:963
flouble **** xi_mm
Definition: namaster.h:960
int lmax
Definition: namaster.h:949
nmt_curvedsky_info * cs
curved sky geometry information.
Definition: namaster.h:939
void nmt_unbin_cls(nmt_binning_scheme *bin, flouble **cls_in, flouble **cls_out, int ncls)
Returns binned power spectra interpolated into output multipoles.
flouble * nmt_extend_CAR_map(nmt_curvedsky_info *cs, flouble *map_in)
Extend CAR map to cover the full circle.
long npix
Total number of pixels (given by nx * ny.
Definition: namaster.h:314
flouble pixsize
Pixel area (given by lx * ly / ( nx * ny))
Definition: namaster.h:317
nmt_flatsky_info * fs
Contains information about rectangular flat-sky patch.
Definition: namaster.h:751
nmt_workspace * nmt_compute_power_spectra(nmt_field *fl1, nmt_field *fl2, nmt_binning_scheme *bin, nmt_workspace *w0, flouble **cl_noise, flouble **cl_proposal, flouble **cl_out, int niter, int lmax_mask, int l_toeplitz, int l_exact, int dl_band)
Computes pseudo-CL specrum.
int pure_e2
Definition: namaster.h:962
int n_bands
Number of bandpowers stored.
Definition: namaster.h:72
flouble ** xi02_1122
First (a1b1-a2b2), 02, mode coupling matrix (see scientific documentation)
Definition: namaster.h:1240
int lmax_fields
Resolution of fields being correlated.
Definition: namaster.h:935
flouble lmax
Maximum k-mode used.
Definition: namaster.h:757
nmt_k_function * beam
Function defining a circularly-symmetric beam function. Power spectra will be beam-deconvolved.
Definition: namaster.h:363
void nmt_compute_gaussian_covariance(nmt_covar_workspace *cw, int spin_a, int spin_b, int spin_c, int spin_d, nmt_workspace *wa, nmt_workspace *wb, flouble **clac, flouble **clad, flouble **clbc, flouble **clbd, flouble *covar_out)
Compute full-sky Gaussian covariance matrix.
int ntemp
Number of contaminant templates.
Definition: namaster.h:555
flouble ** xi02_1221
Second (a1b2-a2b1), 02, mode coupling matrix (see scientific documentation)
Definition: namaster.h:1241
int pb1
Is the B-mode component of the first field purified?
Definition: namaster.h:749
long npix
Number of pixels in all maps.
Definition: namaster.h:545
Curved-sky information.
Definition: namaster.h:470
gsl_matrix * coupling_matrix_binned_gsl
GSL version of MCM (prepared for inversion)
Definition: namaster.h:758
Full-sky field.
Definition: namaster.h:543
int npure_0s
Definition: namaster.h:966
Flat-sky field.
Definition: namaster.h:348
flouble *** temp
Contaminant template maps (mask-multiplied but NOT purified).
Definition: namaster.h:556
flouble Delta_theta
pixel size in theta direction
Definition: namaster.h:478
flouble * beam_prod
Product of field beams.
Definition: namaster.h:940
int lmax
Maximum multipole used.
Definition: namaster.h:934
nmt_field * nmt_field_alloc_sph(nmt_curvedsky_info *cs, flouble *mask, int spin, flouble **maps, int ntemp, flouble ***temp, flouble *beam, int pure_e, int pure_b, int n_iter_mask_purify, double tol_pinv, int niter, int masked_input, int is_lite, int mask_only)
nmt_field constructor
int nmt_bins_flat_search_fast(nmt_binning_scheme_flat *bin, flouble l, int il)
Fast bin-searching routine for flat-sky bandpowers.
fcomplex ** alms
Spherical harmonic transfoms of the maps.
Definition: namaster.h:554