Live noise via slicersim (lazuli_exo.slicer)
Live slicersim noise: single-transit depth uncertainty per IFS channel.
slicersim and sncosmo are imported inside the functions so that import lazuli_exo stays numpy-only. slicersim normalizes magnitudes as AB (scene/pointsource.py hard-codes bandmag(band, “ab”)); archive magnitudes are Vega, so the default path converts with sncosmo’s own band definitions.
- lazuli_exo.slicer.vega_to_ab_offset(band)[source]
m_AB - m_Vega for band, from sncosmo (independent of the spectrum).
- lazuli_exo.slicer.normalize_setup(nmd=None, tframe=None, spectrograph_mode=None, guiding_sigma=None, zodi_ab_mag=None)[source]
Validate the optional instrument setup and return it as a hashable tuple (the native-noise cache key includes it). None means “slicersim’s default”, so an all-None setup reproduces the pre-setup behaviour.
nmd (groups, frames, drops) MACC readout; fixed, not desaturated. tframe frame time [s] (e.g. 2.83 full frame, 0.7 rapid subframe). spectrograph_mode ‘narrow’ | ‘wide’ input field. guiding_sigma pointing jitter [arcsec], >= 0. zodi_ab_mag zodiacal surface brightness [AB mag/arcsec^2, V band].
- lazuli_exo.slicer.zodi_scale_from_ab_mag(ab_mag, band='bessellv')[source]
slicersim’s multiplicative zodi
scalefor an AB surface brightness; brighter sky (smaller magnitude) -> larger scale, the reference maps to 1.
- lazuli_exo.slicer.pixel_average_sed(wl, flux, centres)[source]
Box-average the SED over the instrument pixels so that slicersim’s point sampling at the pixel centres returns the pixel mean (#37).
Pixel edges are the geometric midpoints of centres (0.1 % of a pixel from slicersim’s own edges). The channel grid is continued geometrically beyond the instrument range to cover the whole SED, so the band used for the magnitude normalization stays covered and the grid spacing is smooth (sncosmo’s bin-edge recovery rejects a spacing jump). The average is exact for the piecewise-linear SED, so a SED coarser than a pixel is unchanged. Pixels the SED does not fully cover are dropped (slicersim then trims those channels). Returns (wavelength, flux) on the centres.
- lazuli_exo.slicer.clear_noise_cache()[source]
Discard this process’s instrument results and magnitude zero points.
Call after editing instrument/calibration files or replacing registered bandpasses in a running process. Restarting the process also clears it.
- lazuli_exo.slicer.depth_error(wl_A, f_lambda, *, mag, band='J', mag_system='vega', t14_s, n_transits=1, instrument='lazuli_cbe', use_cache=True, nmd=None, tframe=None, spectrograph_mode='narrow', guiding_sigma=None, zodi_ab_mag=None, n_reset_frames=1)[source]
Per-channel 1-sigma transit-depth uncertainty for n_transits transits.
depth_err = sqrt(2) / (SNR * sqrt(t14 / t_obs)) / sqrt(n_transits): equal in- and out-of-transit baselines, photon + read noise only. Returns (wavelength_um, depth_err, info) with non-finite channels trimmed.
The SED is box-averaged over each instrument pixel before slicersim sees it (pixel_average_sed), because slicersim point-samples the spectrum at the pixel centres; without this the per-channel signal of an M dwarf is off by ~14 % rms (#37). Saturation is tested on the charge at the last read of the ramp, not on slicersim’s (n-1)-group slope signal (#33); the auto readout shortens the ramp and then tries the RAPID_TFRAME_S subframe. t_obs counts
n_reset_framesextra frame times per ramp (H4RG MACC reset overhead): t_obs = (nframes + n_reset_frames) * tframe * nramps, while info[“t_int_s”] is slicersim’s nframes * tframe * nramps.Instrument setup (optional, None = slicersim’s default; see normalize_setup):
nmdfixes the MACC readout and reports its saturation instead of shortening the ramp (info[“readout_mode”] == “fixed”);tframe[s],spectrograph_mode(‘narrow’|’wide’),guiding_sigma[arcsec] andzodi_ab_mag[AB mag/arcsec^2] are applied before the readout. The field defaults to ‘narrow’ rather than to slicersim’s default because slicersim >= 1.3.3 builds a LazuliTarget without rescaling it to any field (half the throughput); the noise tables were computed in the narrow field. An ETC that shows this result next to its own single-exposure result should pass the same setup so the two describe one observation.By default up to 32 native instrument results are cached per process, keyed by the exact SED contents, AB magnitude, band, instrument and slicersim version/target implementation. Duration and transit count are scaled per call; callers receive independent arrays and metadata. Instrument/calibration files and registered bandpasses are assumed fixed during a process: call clear_noise_cache() after changing them, or use use_cache=False to bypass lookup and storage for a reference calculation.