cobi.simulation.Mask
- class Mask(libdir, nside, select, apo_scale=0.0, apo_method='C2', gal_cut=0, verbose=True)[source]
Sky mask generator and manager for CMB analysis.
This class creates and handles various types of sky masks including survey footprints (LAT/SAT), galactic plane cuts, point source masks, and CO line emission masks. Supports apodization for optimal power spectrum estimation.
- Parameters:
libdir (
str) – Directory for caching mask files.nside (
int) – HEALPix resolution parameter.select (
str) – Mask type selector. Can combine multiple masks with ‘+’: - ‘lat’: LAT survey footprint - ‘sat’: SAT survey footprint - ‘co’: CO line emission mask - ‘ps’: Point source mask - ‘gal’: Galactic plane mask Example: ‘lat+gal+ps’ combines LAT, galactic, and point source masks.apo_scale (
float, default0.0) – Apodization scale in degrees. If 0, no apodization applied.apo_method (
{'C1', 'C2', 'Gaussian'}, default'C2') – Apodization method compatible with NaMaster.gal_cut (
float,int, orstr, default0) – Galactic cut specification: - float < 1: f_sky fraction (e.g., 0.4 for 40% sky) - int > 1: percentage (e.g., 40 for 40% sky) - str: direct percentage ‘40’, ‘60’, ‘70’, ‘80’, ‘90’ Only used when ‘gal’ or ‘GAL’ in select.
- mask
The combined mask array (values 0-1).
- Type:
ndarray
- get_mask()
Returns the mask array.
Examples
Create LAT mask with galactic cut:
mask = Mask( libdir='./masks', nside=512, select='lat+gal', gal_cut=20, # 20% sky apo_scale=1.0, apo_method='C2' ) mask_array = mask.mask print(f"Sky fraction: {mask.fsky:.3f}")
Simple point source mask:
ps_mask = Mask( libdir='./masks', nside=512, select='ps', apo_scale=0.5 )
Combined mask for full analysis:
full_mask = Mask( libdir='./masks', nside=512, select='lat+gal+ps+co', gal_cut=40, apo_scale=1.0 )
Notes
Masks are cached to disk for efficient reuse
Apodization reduces mode-coupling in power spectra
Multiple masks are combined via multiplication
Compatible with NaMaster (pymaster) workflows
- __init__(libdir, nside, select, apo_scale=0.0, apo_method='C2', gal_cut=0, verbose=True)[source]
Initializes the Mask class for handling and generating sky masks.
Parameters: nside (int): HEALPix resolution parameter. libdir (Optional[str], optional): Directory where the mask may be saved or loaded from. Defaults to None.
Methods
__init__(libdir, nside, select[, apo_scale, ...])Initializes the Mask class for handling and generating sky masks.
- __init__(libdir, nside, select, apo_scale=0.0, apo_method='C2', gal_cut=0, verbose=True)[source]
Initializes the Mask class for handling and generating sky masks.
Parameters: nside (int): HEALPix resolution parameter. libdir (Optional[str], optional): Directory where the mask may be saved or loaded from. Defaults to None.
- __load_mask_healper__()[source]
Loads a mask from a file.
Returns: np.ndarray: The mask array.
- Return type: