xlens.simulator.sim

Pipeline task that simulates multi-band LSST coadd images.

The MultibandSimTask task orchestrates drawing galaxy catalogs, convolving them with PSF models, and optionally adding realistic noise and pixel masks. The code mirrors the Rubin Science Pipelines interface while providing a self-contained set of utilities that are convenient for unit tests and tutorials bundled with xlens.

Attributes

SIM_INCLUSION_PADDING

DEFAULT_BAT_STAMP_SIZE

band_order

Classes

MultibandSimConnections

Define the Butler datasets consumed and produced by MultibandSim.

MultibandSimConfig

Configuration options controlling the multi-band simulation task.

MultibandSimTask

IASimConnections

Butler connections for IASimTask.

IASimConfig

Configuration for IASimTask including IA parameters.

IASimTask

Task that draws coadds using intrinsic-alignment distortions.

Module Contents

SIM_INCLUSION_PADDING = 200[source]
DEFAULT_BAT_STAMP_SIZE = 64[source]
band_order = 'ugrizy'[source]
class MultibandSimConnections(*, config=None)[source]

Bases: lsst.pipe.base.PipelineTaskConnections

Define the Butler datasets consumed and produced by MultibandSim.

skymap[source]
truthCatalog[source]
mask[source]
noiseCorrArray[source]
psfArray[source]
simExposure[source]
class MultibandSimConfig[source]

Bases: lsst.pipe.base.PipelineTaskConfig

Configuration options controlling the multi-band simulation task.

catsim_dir[source]
galaxy_type[source]
survey_name[source]
mag_zero[source]
include_pixel_masks[source]
draw_image_noise[source]
use_field_distortion[source]
galId[source]
rotId[source]
noiseId[source]
use_real_psf[source]
use_mog[source]
force_isotropic[source]
psf_e1[source]
psf_e2[source]
include_point_source[source]
truncate_stamp_size[source]
idGenerator[source]
validate()[source]
setDefaults()[source]
class MultibandSimTask(**kwargs: Any)[source]

Bases: lsst.pipe.base.PipelineTask

_DefaultName = 'MultibandSimTask'[source]
ConfigClass[source]

Task that draws simulated coadd images for a single patch and band.

rotate_list[source]
simulate_images(*, galaxy_catalog, psf_obj, wcs, bbox_outer, band: str, mag_zero: float, draw_method: str = 'auto', **kwargs)[source]

Render a galaxy catalog into an image array.

Parameters:
  • galaxy_catalog – Galaxy catalog object (e.g. from from_array) to draw.

  • psf_objgalsim.GSObject describing the PSF to use when rendering.

  • wcs – LSST SkyWcs object that provides the sky-to-pixel mapping.

  • bbox_outerlsst.geom.Box2I giving the outer bounding box of the patch.

  • band – Name of the photometric band ("r", "i", …).

  • mag_zero – Zeropoint magnitude used for converting fluxes.

  • draw_method – Rendering method passed to the galsim drawing routines.

Returns:

Two-dimensional array with simulated pixel values for the requested patch.

Return type:

numpy.ndarray

draw_catalog(*, galaxy_catalog, wcs, bbox_outer, psf_obj, mag_zero: float, band: str, draw_method: str = 'auto', nn_trunc: None | int = None, **kwargs)[source]

Iterate over galaxies in the catalog and render them into an image.

Parameters:
  • galaxy_catalog – Galaxy catalog with data array and get_obj method.

  • wcs – LSST SkyWcs for the tangent-plane projection.

  • bbox_outerlsst.geom.Box2I outer bounding box of the patch.

  • psf_obj – GalSim PSF object used for convolution.

  • mag_zero (float) – Zeropoint magnitude.

  • band (str) – Photometric band.

  • draw_method (str, optional) – GalSim rendering method.

  • nn_trunc (int or None, optional) – Stamp truncation size in pixels. None means no truncation.

Returns:

Two-dimensional pixel array.

Return type:

numpy.ndarray

runQuantum(butlerQC, inputRefs, outputRefs) None[source]
run(*, tract_info, patch_id: int, band: str, seed: int, truthCatalog, psfArray: numpy.typing.NDArray | None = None, noiseCorrArray: numpy.typing.NDArray | None = None, mask: lsst.afw.image.MaskX | None = None, **kwargs)[source]

Simulate an LSST coadd exposure for a specific tract patch.

Parameters:
  • tract_infoTractInfo describing the region of sky being simulated.

  • patch_id – Identifier of the patch inside tract_info to draw.

  • band – Photometric band label.

  • seed – Deterministic seed generated by the pipeline’s ID generator.

  • truthCatalog – Truth catalog produced by CatalogTask containing the galaxies to render.

  • psfArray – Optional inputs that provide measured PSFs, noise correlation images, or systematics masks from real observations.

  • noiseCorrArray – Optional inputs that provide measured PSFs, noise correlation images, or systematics masks from real observations.

  • mask – Optional inputs that provide measured PSFs, noise correlation images, or systematics masks from real observations.

Returns:

Struct with a single simExposure attribute holding the simulated ExposureF object.

Return type:

lsst.pipe.base.Struct

class IASimConnections(*, config=None)[source]

Bases: MultibandSimConnections

Butler connections for IASimTask.

The intrinsic-alignment simulator uses the same datasets as MultibandSimTask so this subclass only exists for clarity.

class IASimConfig[source]

Bases: MultibandSimConfig

Configuration for IASimTask including IA parameters.

pipelineConnections[source]
ia_amplitude[source]
ia_beta[source]
ia_phi[source]
ia_clip_radius[source]
validate()[source]
class IASimTask(**kwargs: Any)[source]

Bases: MultibandSimTask

Task that draws coadds using intrinsic-alignment distortions.

_DefaultName = 'IASimTask'[source]
ConfigClass[source]

Task that draws simulated coadd images for a single patch and band.

draw_catalog(*, galaxy_catalog, wcs, bbox_outer, psf_obj, mag_zero: float, band: str, draw_method: str = 'auto', **kwargs)[source]

Render galaxies with intrinsic-alignment distortions via BATSim.