Slitless grating ================ .. warning:: Under development. The grating design (line density, blaze wavelengths, passbands, coatings) and its throughput are still being defined. The defaults and the numbers on this page are provisional and will change. Building a ``GratingSimulation`` emits a :class:`~wcc_etc.grating.GratingDevelopmentWarning`; silence it with ``warnings.simplefilter("ignore", wcc_etc.grating.GratingDevelopmentWarning)``. ``wcc_etc.grating`` models the low-resolution slitless grating studied as a replacement for one 2.0 mm WCC filter (WCC grating trade memo, 2026-11-16): a 16-level fused-silica staircase 70 mm in front of the sensor, 4.414 lines/mm, R of about 20. The grating has two halves, each behind an edge coating so that first and second orders do not overlap: ======== ============ ========== ========= ==================== Half Passband Blaze Bands Dispersion direction ======== ============ ========== ========= ==================== ``blue`` 350-700 nm 430 nm u, g, r pixel rows ``red`` 600-1100 nm 775 nm i, z pixel columns ======== ============ ========== ========= ==================== A :class:`~wcc_etc.GratingSimulation` covers one half on one sensor, the Sony IMX455 (``"zwo"``) or the HWK4123 (``"qcmos"``): .. code-block:: python import wcc_etc scene = wcc_etc.get_scene("G2V", mag=15, bandpass="johnson_v") grating = wcc_etc.GratingSimulation.from_sensor_and_scene("zwo", scene, half="blue") grating.get_band_snr(60, n_reads=1) # {'u': ..., 'g': ..., 'r': ...} grating.get_band_exptime_for_snr(10) # seconds per band grating.is_saturated(60, n_reads=1) image = grating.simulate(60, seed=1) # a SimulatedImage image.plot_image() Throughput ---------- The sensor curve is ``"zwo:nofilter"`` or ``"qcmos:nofilter"``: the end-of-life telescope times the WCC contamination and reserve times the detector QE, from the Lazuli throughput budget v0.4. The grating multiplies it by the edge coating (0.95 in band, 15 nm edges) and by the scalar diffraction efficiency of the staircase in each order (:func:`~wcc_etc.grating.staircase_efficiency`); the mean first-order efficiency is 0.85 in the blue half and 0.89 in the red half. Image ----- Each star becomes a zeroth-order image plus a short spectrum: the first order of wavelength :math:`\lambda` lands ``grating.offset_px(wavelength)`` pixels from the zeroth order (29-58 px for 350-700 nm on the IMX455). The image holds orders -1 to +2 by default (``orders=``). The PSF is rendered every 25 nm, with the telescope jitter; pass ``psf=`` for anything other than an Airy pattern. ``grating.rate_image(oversample=k)`` returns the noiseless e-/s image on k x k fine pixels per detector pixel (k odd), dispersion along x, with the zeroth order on the centre fine pixel of the ``canvas()`` origin; shifting it by whole fine pixels and summing k x k blocks places a source at a sub-pixel position. The sky is slitless too: every pixel collects zodiacal light from the whole passband of the half. The spectrum is integrated over 1 nm bins, so an emission line narrower than a bin keeps its flux. ``simulate(time, n_reads=...)`` draws each frame separately; its saturation mask flags a pixel that saturates in any frame. Extended (profiled) scene elements raise ``NotImplementedError``. Per-band SNR ------------ Each band is summed in a box of ``aperture_mas`` (70 mas) either side of the trace by the length of the band along the first order. The signal is the first-order light of the source in the box; the noise adds the other orders, any unresolved host, the sky, the dark current and the read noise of the box pixels, once per read. Partially covered boundary pixels enter with their fractional weight in the signal and its square in the variance. The image must include order +1 (``orders=``), and ``n_reads`` must be a positive integer. ``get_band_snr`` and ``get_band_exptime_for_snr`` warn when the brightest pixel saturates. Results are cached per grating and follow the wrapped simulation: changing the scene, sensor or telescope through ``grating.sim`` (``set_scene``, ``update``, ``update_scene`` ...) recomputes them. Limits ------ The static wavefront error, the FSM smear for bright hosts, the 3.6% change of the dispersion across the tilted sensor, and extended sources are not modelled.