Conversation
damonge
left a comment
There was a problem hiding this comment.
Hey @josquin-e
Just reviewed the Cl_estimation part and let a few general comments about stuff related to namaster (mostly). I haven't really commented on the pipeline itself. I think it mostly looks good, so most of what I've written is advice.
| noise_cov=hp.read_map(self.get_input('noise_cov'),verbose=False, field=None) | ||
| # reorganization of noise covariance | ||
| instrument = {'frequencies':np.array(self.config['frequencies'])} | ||
| ind = 0 |
There was a problem hiding this comment.
I think you should be able to do this as:
noise_cov = noise_cov.reshape([len(instrument['frequencies']),
3, frequency_maps.shape[-1]])
That way you also wouldn't have to store both noise_cov and noise_cov_ in memory.
| b = binning_definition(self.config['nside'], lmin=self.config['lmin'], lmax=self.config['lmax'],\ | ||
| nlb=self.config['nlb'], custom_bins=self.config['custom_bins']) | ||
|
|
||
| print('building mask ... ') |
There was a problem hiding this comment.
Where did we land on this one? You only need the apodization here because you're using Galactic coordinates, right? As long as you've checked the final mask has sensible derivatives it should be fine. Apodization can take annoyingly long sometimes, so you could get an apodized mask separately and just read it in here.
| obs_pix = np.where(mask!=0)[0] | ||
|
|
||
|
|
||
| if self.config['mask_apo'] != '': |
There was a problem hiding this comment.
Oh, I see you already have that option. nvm
|
|
||
| #Read power spectrum and provide function to generate simulated skies | ||
| cltt,clee,clbb,clte = hp.read_cl(self.config['Cls_fiducial'])[:,:4000] | ||
| mp_t_sim,mp_q_sim,mp_u_sim=hp.synfast([cltt,clee,clbb,clte], nside=nside_map, new=True, verbose=False) |
There was a problem hiding this comment.
Humm, why are you simulating anything here?
There was a problem hiding this comment.
If it's just to create a fake NmtField to compute the mode-coupling matrix, you could just make these np.zeros and save on synfast.
|
|
||
| #This wraps up the two steps needed to compute the power spectrum | ||
| #once the workspace has been initialized | ||
| def compute_master(f_a,f_b,wsp) : |
There was a problem hiding this comment.
you can also just write w.decouple_cell(nmt.compute_coupled_cell(f_a, f_b)) every time if you don't want to have to define this here.
| hp.fitsfunc.write_cl(self.get_output('Cl_noise'), np.array(Cl_noise), overwrite=True) | ||
| hp.fitsfunc.write_cl(self.get_output('Cl_cov_clean'), np.array(Cl_cov_clean), overwrite=True) | ||
| hp.fitsfunc.write_cl(self.get_output('Cl_cov_freq'), np.array(Cl_cov_freq), overwrite=True) | ||
| hp.fitsfunc.write_cl(self.get_output('Cl_noise_bias'), np.array(Cl_noise_bias), overwrite=True) |
There was a problem hiding this comment.
So, at some point I think you should start using sacc. The main reason for this is that later on you're gonna want to convolve the theory with the same bandpower window functions that are in the data, and sacc allows you to save that concurrently with the power spectra and the covariance easily. Especially with purification at low ell, the bandpower convolution can be quite important to avoid biases.
Just created this on behalf of @josquin-e to make code review a bit easier