Instruments

mejiro currently supports simulating the Roman Space Telescope (“Roman”), the James Webb Space Telescope (JWST), and the Habitable Worlds Observatory (HWO). mejiro’s Roman imaging wraps GalSim and STPSF with instrument parameters from roman-technical-information, its JWST imaging wraps GalSim with instrument parameters from lenstronomy, and its HWO imaging wraps GalSim with instrument parameters from hwo-tools and syotools.

Note

mejiro’s HWO support is currently under development.

instrument

class mejiro.instruments.instrument.Instrument(name, bands, num_detectors, engines)[source]

Bases: ABC

Abstract base class for all instrument implementations.

Defines the common interface shared by all supported telescopes and instruments (Roman, HST, JWST, LSST, HWO). Concrete subclasses must implement the abstract methods for band-specific optical and detector properties.

convert_cps_to_mag(cps, band)[source]

Convert counts per second to an AB magnitude for a given band.

Parameters:
  • cps (float) – Source flux in counts per second (ct/s).

  • band (str) – Filter band identifier (e.g. 'F129' for Roman).

Returns:

Source brightness in AB magnitudes.

Return type:

float

convert_mag_to_cps(magnitude, band)[source]

Convert an AB magnitude to counts per second for a given band.

Parameters:
  • magnitude (float) – Source brightness in AB magnitudes.

  • band (str) – Filter band identifier (e.g. 'F129' for Roman).

Returns:

Source flux in counts per second (ct/s).

Return type:

float

abstract static default_params()[source]

Returns a dictionary of default parameters for the instrument. For example, for the Roman WFI, the ‘detector’ parameter enables the calculation of detector-specific fluxes from the detector-specific zero-point magnitude.

Returns:

The default parameters.

Return type:

dict

abstract get_dark_current(band)[source]

Get the dark current for a given band.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

Dark current per pixel per second.

Return type:

Astropy.units.Quantity

abstract get_gain(band)[source]

Get the detector gain for a given band.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

Detector gain.

Return type:

float

abstract get_pixel_scale(band)[source]

Get the pixel scale for a given band in arcsec/pix.

Subclasses with a single pixel scale across all bands may ignore the band argument.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

Pixel scale in arcsec/pix.

Return type:

Astropy.units.Quantity

abstract get_psf_fwhm(band)[source]

Get the Full Width at Half Maximum (FWHM) of the Point Spread Function (PSF) for a given band in arcsec.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

PSF FWHM in arcsec.

Return type:

Astropy.units.Quantity

abstract get_psf_kwargs(band, **kwargs)[source]

Get the keyword arguments for generating the Point Spread Function (PSF) for a given band.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

Keyword arguments for generating the PSF.

Return type:

dict

abstract get_read_noise(band)[source]

Get the read noise for a given band.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

Read noise per pixel.

Return type:

Astropy.units.Quantity

abstract get_sky_level(band)[source]

Get the sky background level for a given band.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

Sky background level in ct/pix.

Return type:

Astropy.units.Quantity

get_stray_light_fraction()[source]

Get the stray light fraction for the instrument.

Returns:

Fraction of stray light. Subclasses are expected to set self.stray_light_fraction in their __init__.

Return type:

float

abstract get_thermal_background(band)[source]

Get the thermal background for a given band in ct/pix.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

Thermal background in ct/pix.

Return type:

Astropy.units.Quantity

abstract get_zeropoint_magnitude(band)[source]

Get the zeropoint magnitude for a given band.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

The zeropoint magnitude for the specified band.

Return type:

float

abstract static load_speclite_filters()[source]

Load the filter response curves for the instrument to speclite.

Returns:

The loaded filter response curves.

Return type:

speclite.filters.FilterSequence

abstract static validate_instrument_params(params)[source]

Validate the parameters for an instrument. If any required parameters are missing, they will be populated with the default values (see default_params). If any parameters are invalid, a ValueError will be raised.

Parameters:

params (dict) – A dictionary containing the parameters to be validated.

Returns:

The validated parameters.

Return type:

dict

roman

class mejiro.instruments.roman.Roman[source]

Bases: Instrument

Roman Space Telescope (Roman) Wide Field Instrument (WFI) class

Variables:
  • roman_technical_information_path (str) – Path to the roman-technical-information directory.

  • pixel_scale (Quantity) – Pixel scale of the instrument in arcsec/pix.

  • gain (float) – Gain of the instrument.

  • stray_light_fraction (float) – Fraction of stray light.

  • zeropoints (QTable or None) – Zeropoints table, initialized on demand.

  • thermal_background (QTable or None) – Thermal background table, initialized on demand.

  • minimum_zodiacal_light (QTable or None) – Minimum zodiacal light table, initialized on demand.

  • psf_fwhm (QTable or None) – PSF FWHM table, initialized on demand.

static default_params()[source]

Returns a dictionary of default parameters for the instrument. For example, for the Roman WFI, the ‘detector’ parameter enables the calculation of detector-specific fluxes from the detector-specific zero-point magnitude.

Returns:

The default parameters.

Return type:

dict

get_dark_current(band)[source]

Get the dark current for a given band.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

Dark current per pixel per second.

Return type:

Astropy.units.Quantity

get_gain(band)[source]

Get the detector gain for a given band.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

Detector gain.

Return type:

float

get_minimum_zodiacal_light(band)[source]

Get the minimum zodiacal light at high galactic latitudes for a given band in ct/pix.

Parameters:

band (str) – The name of the band, e.g., ‘F129’.

Returns:

Minimum zodiacal light in ct/pix.

Return type:

Astropy.units.Quantity

get_pixel_scale(band=None)[source]

Get the pixel scale for a given band in arcsec/pix.

Subclasses with a single pixel scale across all bands may ignore the band argument.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

Pixel scale in arcsec/pix.

Return type:

Astropy.units.Quantity

get_psf_fwhm(band)[source]

Get the Full Width at Half Maximum (FWHM) of the Point Spread Function (PSF) for a given band in arcsec.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

PSF FWHM in arcsec.

Return type:

Astropy.units.Quantity

get_psf_kwargs(band, detector=1, detector_position=(2044, 2044), oversample=5, num_pix=101, check_cache=True, psf_cache_dir=None, require_cached=False)[source]

Get the keyword arguments for generating the Point Spread Function (PSF) for a given band.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

Keyword arguments for generating the PSF.

Return type:

dict

get_read_noise(band)[source]

Get the read noise for a given band.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

Read noise per pixel.

Return type:

Astropy.units.Quantity

get_sky_level(band)[source]

Get the sky background level for a given band.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

Sky background level in ct/pix.

Return type:

Astropy.units.Quantity

get_thermal_background(band)[source]

Get the thermal background for a given band in ct/pix.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

Thermal background in ct/pix.

Return type:

Astropy.units.Quantity

get_zeropoint_magnitude(band, detector=1)[source]

Get the zeropoint magnitude for a given band.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

The zeropoint magnitude for the specified band.

Return type:

float

static load_speclite_filters(detector='sca01')[source]

Load the filter response curves for the instrument to speclite.

Returns:

The loaded filter response curves.

Return type:

speclite.filters.FilterSequence

static validate_instrument_params(params)[source]

Validate the parameters for an instrument. If any required parameters are missing, they will be populated with the default values (see default_params). If any parameters are invalid, a ValueError will be raised.

Parameters:

params (dict) – A dictionary containing the parameters to be validated.

Returns:

The validated parameters.

Return type:

dict

jwst

class mejiro.instruments.jwst.JWST[source]

Bases: Instrument

static default_params()[source]

Returns a dictionary of default parameters for the instrument. For example, for the Roman WFI, the ‘detector’ parameter enables the calculation of detector-specific fluxes from the detector-specific zero-point magnitude.

Returns:

The default parameters.

Return type:

dict

get_dark_current(band)[source]

Get the dark current for a given band.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

Dark current per pixel per second.

Return type:

Astropy.units.Quantity

get_gain(band)[source]

Get the detector gain for a given band.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

Detector gain.

Return type:

float

get_pixel_scale(band)[source]

Get the pixel scale for a given band in arcsec/pix.

Subclasses with a single pixel scale across all bands may ignore the band argument.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

Pixel scale in arcsec/pix.

Return type:

Astropy.units.Quantity

get_psf_fwhm(band)[source]

Get the Full Width at Half Maximum (FWHM) of the Point Spread Function (PSF) for a given band in arcsec.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

PSF FWHM in arcsec.

Return type:

Astropy.units.Quantity

get_psf_kwargs(band, **kwargs)[source]

Get the keyword arguments for generating the Point Spread Function (PSF) for a given band.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

Keyword arguments for generating the PSF.

Return type:

dict

get_read_noise(band)[source]

Get the read noise for a given band.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

Read noise per pixel.

Return type:

Astropy.units.Quantity

get_sky_level(band)[source]

Get the sky background level for a given band.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

Sky background level in ct/pix.

Return type:

Astropy.units.Quantity

get_thermal_background(band)[source]

Get the thermal background for a given band in ct/pix.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

Thermal background in ct/pix.

Return type:

Astropy.units.Quantity

get_zeropoint_magnitude(band)[source]

Get the zeropoint magnitude for a given band.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

The zeropoint magnitude for the specified band.

Return type:

float

static load_speclite_filters()[source]

Load the filter response curves for the instrument to speclite.

Returns:

The loaded filter response curves.

Return type:

speclite.filters.FilterSequence

static validate_instrument_params(params)[source]

Validate the parameters for an instrument. If any required parameters are missing, they will be populated with the default values (see default_params). If any parameters are invalid, a ValueError will be raised.

Parameters:

params (dict) – A dictionary containing the parameters to be validated.

Returns:

The validated parameters.

Return type:

dict

hwo

class mejiro.instruments.hwo.HWO(eac='EAC1')[source]

Bases: Instrument

Habitable Worlds Observatory (HWO) High-Resolution Imager (HRI) class

Parameters:

eac (str) – Exploratory Analytic Case (EAC), possible mission architectures. Options are ‘EAC1’, ‘EAC2’, and ‘EAC3’. Default is ‘EAC1’. For more details, see https://pcos.gsfc.nasa.gov/physpag/meetings/HEAD2024/presentations/6_Burns_HWO.pdf.

Variables:

TODO

static default_params()[source]

Returns a dictionary of default parameters for the instrument. For example, for the Roman WFI, the ‘detector’ parameter enables the calculation of detector-specific fluxes from the detector-specific zero-point magnitude.

Returns:

The default parameters.

Return type:

dict

get_attribute_from_syotools(syotools_object, attribute, unit, check_unit=True)[source]
get_dark_current(band)[source]

Get the dark current for a given band.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

Dark current per pixel per second.

Return type:

Astropy.units.Quantity

get_gain(band)[source]

Get the detector gain for a given band.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

Detector gain.

Return type:

float

get_noise(band)[source]

Estimate noise per pixel per second in given band. For now, sum of dark current and read noise.

get_pixel_scale(band)[source]

Get the pixel scale for a given band in arcsec/pix.

Subclasses with a single pixel scale across all bands may ignore the band argument.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

Pixel scale in arcsec/pix.

Return type:

Astropy.units.Quantity

get_psf_fwhm(band)[source]

Get the Full Width at Half Maximum (FWHM) of the Point Spread Function (PSF) for a given band in arcsec.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

PSF FWHM in arcsec.

Return type:

Astropy.units.Quantity

get_psf_kwargs(band, **kwargs)[source]

Get the keyword arguments for generating the Point Spread Function (PSF) for a given band.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

Keyword arguments for generating the PSF.

Return type:

dict

get_read_noise(band)[source]

Get the read noise for a given band.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

Read noise per pixel.

Return type:

Astropy.units.Quantity

get_sky_level(band)[source]

Get the sky background level for a given band.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

Sky background level in ct/pix.

Return type:

Astropy.units.Quantity

get_thermal_background(band)[source]

Get the thermal background for a given band in ct/pix.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

Thermal background in ct/pix.

Return type:

Astropy.units.Quantity

get_zeropoint_magnitude(band)[source]

Get the zeropoint magnitude for a given band.

Parameters:

band (str) – The name of the band, e.g., ‘F129’ for Roman or ‘J’ for HWO.

Returns:

The zeropoint magnitude for the specified band.

Return type:

float

static load_speclite_filters()[source]

Load the filter response curves for the instrument to speclite.

Returns:

The loaded filter response curves.

Return type:

speclite.filters.FilterSequence

static validate_instrument_params(params)[source]

Validate the parameters for an instrument. If any required parameters are missing, they will be populated with the default values (see default_params). If any parameters are invalid, a ValueError will be raised.

Parameters:

params (dict) – A dictionary containing the parameters to be validated.

Returns:

The validated parameters.

Return type:

dict