Skip to content

Conversation

@jsyleung
Copy link
Collaborator

For a set of analysis masks (in the same directory), plot their effects on power spectra on the same plot for easy comparison.

Includes options for:

  • B-mode purification
  • Map unit conversion
  • Beam FWHM

Scans a directory for analysis masks, applies them to CMB sims, and
passes the masked maps into NaMaster to obtain the power spectra.
Outputs plots in directory specified in pipeline/get_analysis_mask.py
@jsyleung jsyleung requested a review from kwolz June 20, 2025 15:00
Cls have units temp^2
Copy link
Collaborator

@kwolz kwolz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! This will be super useful to be run alongside the mask generation script. Just a few comments.

BBmeta.make_dir(plot_dir)

# Check mask directory for masks
mask_basename = "analysis_mask"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make the default option to analyze only the mask at meta.mask["analysis_mask"], and only if that is null, look for the masks in the mask directory? The reason is that soopercool will by default compute power spectra from the former, and in general {mask_dir}/analysis_mask.fits may differ from meta.mask["analysis_mask"].

plt.plot(ells[tag], (means_bb[tag]-cbbb)/std_bb[tag], label=labels[tag])
plt.xlabel(r"Multipole $\ell$")
plt.ylabel(r"$(\^{C}_b - C_b^{\mathrm{th}})/\sigma(\^{C}_b)$")
plt.savefig(os.path.join(plot_dir, "mask_validation_sigmas.png"), bbox_inches='tight')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add the same quantity for EE to the same plot? It would be useful to see if EE is biased too.

parser = argparse.ArgumentParser()
parser.add_argument("--globals", required=True, help="Path to paramfile")
parser.add_argument("--fwhm", default=30, help="Beam size (arcmin). Default: 30")
parser.add_argument("--puretype", default='cmbTEB', help="Input sim pure type (T/E/B). Default: 'cmbTEB'")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit peaky comment: can we not call this puretype, but maybe something like simtype? The reason is that pure_type is being used for the transfer function estimation sims, which are not CMB sims (containing B, EB, or TEB, etc.) but power-law Gaussian sims that carry only one type of polarization.

plt.plot(ells[tag], std_bb[tag]/std_bb_bonly[tag], label=labels[tag])
plt.xlabel(r"Multipole $\ell$")
plt.ylabel(r"$\sigma(C_b^{\mathrm{CMB}})/\sigma(C_b^{\mathrm{B\ only}})$")
plt.savefig(os.path.join(plot_dir, "mask_validation_compare_bonly.png"), bbox_inches='tight')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here a log-scale for y could help seeing the deviation from 1 more clearly, especially if the variance ratio becomes very large for small ell.

jsyleung and others added 5 commits August 4, 2025 16:00
Only if that mask is not found, look for masks in the mask directory.
Print plot directory on screen.
since 'puretype' refers to power-law Gaussian sims whereas mask
validation uses CMB sims as input.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants