Computes signal-to-noise ratio (SNR) in one or more wavelength bins for an input spectrum and exposure time.
The application reuses the instrument models in classi-sim and the curves in classi-shared-data, so the ETC and detector simulator use the same telescope area, atmospheric extinction, detector geometry, grating/optics throughput representation, and photon-flux conversion.
Install the package and its dependencies, then launch the GUI with:
pip install .
classi-etcThe package is imported as etc.
Choose a two-column text spectrum containing:
- wavelength in Angstrom
- flux density in erg s^-1 cm^-2 Angstrom^-1
Input wavelengths, requested wave centers, and bin sizes are all interpreted in the observer frame. This calculator does not apply a redshift correction.
The packaged SNIa_max_z0p05 spectrum from shared-data is offered as the initial reference location.
The optional Flux scale magnitude field rescales the entire input spectrum so that its synthetic g-, r-, or i-band AB magnitude matches the requested value. Leave the field blank to preserve the input spectrum's original flux normalization.
- Grating: Newport 1229, Newport 1294, or the ThorLabs grating curve.
- Airmass: numerical airmass applied to the Palomar atmospheric-extinction curve from
spectrograph-sim. - Camera model: selects the detector QE, pixel size, detector dimensions, and read noise.
The throughput toggles expose the same component model used by the simulator: atmosphere, fiber, miscellaneous losses, collimator, grating, detector window, and detector QE.
Detector sampling parameters are not user inputs. Dispersion and fiber pitch are calculated from SpectrographModel, and read noise is taken from the selected camera configuration. Each extraction box is one full fiber pitch wide, extending halfway toward each adjacent trace.
- Exposure Time (s)
- Wave Centers (observer-frame nm), comma-separated
- Bin Size (nm)
- Sky Background (
dark,grey, orbright; defaultdark) - Fiber Length (m; default 10)
- Fiber Coupling Efficiency (fraction; default 1.0)
- Limiting-magnitude SNR (default 5)
- Limiting-magnitude band (
g,r, ori)
Fiber coupling represents point-source light lost before entering the fiber. It applies to source counts but not sky counts. The telescope diameter, pixel scale, lens throughput, detector read noise, dispersion, and spatial extraction width are not independent GUI inputs. Instrument geometry and throughput are taken from the shared simulator model instead.
The detector is assumed to operate at -20°C. Each camera's fixed -20°C dark-current value is used, and there is no temperature input.
The selectable dark, grey, and bright backgrounds use the corresponding line-resolved DESI benchmark sky spectra distributed with desimodel. They span 3500-10000 Å in increments of 0.1 Å, so narrow airglow features are integrated on the sky spectrum's own grid rather than on the potentially sparse source spectrum wavelength grid. The default is the "dark" spectrum, which equates to a sky brightness of approximately 20.6 msas in the
Sky background is integrated over the fiber's circular on-sky aperture. Source and sky counts are then multiplied by the same Gaussian-profile extraction fraction for the single fiber pitch extraction box. Fiber coupling is applied only to the source—sky flux enters the fiber no matter what. Dark-current and read-noise variance use the same extraction-box pixel count.
For each wavelength bin the ETC calculates
source = integrated source electron rate * coupling * extraction fraction * time
sky = integrated sky electron rate per arcsec^2 * fiber area * extraction fraction * time
SNR = source / sqrt(source + sky + dark + read-noise variance)
The GUI can also solve for the source magnitude that reaches a requested SNR in each wavelength bin. Select the limiting-magnitude g, r, or i band, enter the SNR threshold, and click Compute limiting magnitudes. The result is an AB magnitude for every requested wavelength bin.
The selected input spectrum supplies the spectral shape. For example, the limiting g-band magnitude measured from a Type Ia supernova template need not equal the limit obtained from a flat-spectrum source, because those objects distribute the same g-band flux differently with wavelength. The absolute normalization of the input spectrum does not affect the result.
from etc import ETCCalculator, get_default_spectrum_file
calc = ETCCalculator()
result = calc.get_SNR_from_spectrum(
exp_time=1800,
spectrum_file=get_default_spectrum_file(),
wave_centers=[550, 650, 750],
binsize=5,
sky_background="grey",
camera_model="QHY268",
grating_id=1294,
airmass=1.3,
fiber_coupling_efficiency=0.75,
target_magnitude=18.0,
magnitude_band="g",
)To solve for the per-bin limiting magnitude instead:
result = calc.get_limiting_magnitudes_from_spectrum(
exp_time=600,
spectrum_file=get_default_spectrum_file(),
wave_centers=[450, 550, 650, 750],
binsize=5,
target_snr=5,
magnitude_band="r",
sky_background="dark",
camera_model="Kepler",
grating_id=1294,
airmass=1.3,
fiber_coupling_efficiency=0.75,
)