cobi.simulation.Foreground

class Foreground(libdir, nside, dust_model, sync_model, bandpass=False, verbose=True)[source]

Galactic foreground generator for CMB analysis.

This class generates multi-frequency Galactic foreground emission maps using PySM3 models for dust and synchrotron radiation. Supports bandpass integration for realistic detector response.

Parameters:
  • libdir (str) – Directory for caching foreground maps.

  • nside (int) – HEALPix resolution parameter.

  • dust_model (int) – PySM3 dust model number (e.g., 1 for d1, 6 for d6).

  • sync_model (int) – PySM3 synchrotron model number (e.g., 1 for s1, 3 for s3).

  • bandpass (bool, default False) – Whether to apply bandpass integration using detector profiles.

  • verbose (bool, default True) – Enable logging output.

nside

HEALPix resolution.

Type:

int

dust_model

Dust emission model identifier.

Type:

int

sync_model

Synchrotron emission model identifier.

Type:

int

bandpass

Whether bandpass integration is enabled.

Type:

bool

bp_profile

Bandpass profile handler (if enabled).

Type:

BandpassInt or None

dustQU(band)[source]

Generate dust Q/U polarization maps at given frequency.

Parameters:

band (str)

Return type:

numpy.ndarray

syncQU(band)[source]

Generate synchrotron Q/U polarization maps at given frequency.

Parameters:

band (str)

Return type:

numpy.ndarray

get_map(freqs, idx)

Get combined foreground map for multiple frequencies.

Examples

Generate foreground maps without bandpass:

fg = Foreground(
    libdir='./fg_sims',
    nside=512,
    dust_model=1,
    sync_model=1,
    bandpass=False
)

# Get dust emission at 145 GHz
dust_map = fg.dustQU('145')

With bandpass integration:

fg = Foreground(
    libdir='./fg_sims',
    nside=512,
    dust_model=1,
    sync_model=1,
    bandpass=True
)

# Generate multi-frequency maps
freqs = ['027', '039', '093', '145', '225', '280']
fg_maps = fg.get_map(freqs, idx=0)

Notes

  • Uses PySM3 for physically-motivated foreground models

  • Caches maps to disk for efficient reuse

  • Supports MPI parallelization

  • Output in μK_CMB units

__init__(libdir, nside, dust_model, sync_model, bandpass=False, verbose=True)[source]

Initializes the Foreground class for generating and handling dust and synchrotron foreground maps.

Parameters: libdir (str): Directory where the foreground maps will be stored. nside (int): HEALPix resolution parameter. dust_model (int): Model number for the dust emission. sync_model (int): Model number for the synchrotron emission. bandpass (bool, optional): If True, bandpass integration is applied. Defaults to False.

Parameters:

Methods

__init__(libdir, nside, dust_model, sync_model)

Initializes the Foreground class for generating and handling dust and synchrotron foreground maps.

dustQU(band)

Generates or retrieves the Q and U Stokes parameters for dust emission at a given frequency band.

syncQU(band)

Generates or retrieves the Q and U Stokes parameters for synchrotron emission at a given frequency band.

__init__(libdir, nside, dust_model, sync_model, bandpass=False, verbose=True)[source]

Initializes the Foreground class for generating and handling dust and synchrotron foreground maps.

Parameters: libdir (str): Directory where the foreground maps will be stored. nside (int): HEALPix resolution parameter. dust_model (int): Model number for the dust emission. sync_model (int): Model number for the synchrotron emission. bandpass (bool, optional): If True, bandpass integration is applied. Defaults to False.

Parameters:
dustQU(band)[source]

Generates or retrieves the Q and U Stokes parameters for dust emission at a given frequency band.

Parameters: band (str): The frequency band.

Returns: np.ndarray: A NumPy array containing the Q and U maps.

Parameters:

band (str)

Return type:

numpy.ndarray

syncQU(band)[source]

Generates or retrieves the Q and U Stokes parameters for synchrotron emission at a given frequency band.

Parameters: band (str): The frequency band.

Returns: np.ndarray: A NumPy array containing the Q and U maps.

Parameters:

band (str)

Return type:

numpy.ndarray