Slitless grating ================ .. warning:: Under development. The grating design in ``wcc_etc.grating`` (line density, blaze wavelengths, passbands, coatings) is still being defined, so the numbers on this page are provisional. :func:`wcc_sim.simulate_grating_field` simulates a full-frame exposure with the low-resolution transmission grating in the beam instead of a filter. Every star in the field becomes a zeroth-order image and a short spectrum. The function takes the same pointing, catalogue, exposure and output arguments as :func:`~wcc_sim.simulate_field` and returns the same :class:`~wcc_sim.SimulatedField`: .. code-block:: python from wcc_sim import simulate_grating_field field = simulate_grating_field(ra=10.0, dec=20.0, sensor="zwo", exptime=60, n_reads=6, seed=1, output="grating.fits") field.plot() ``sensor`` is ``"zwo"`` (Sony IMX455) or ``"qcmos"`` (HWK4123). The tutorial :doc:`../notebooks/13_slitless_grating` walks through the images step by step. What comes from wcc-etc ----------------------- The physics of one star on one half of the grating is :class:`wcc_etc.GratingSimulation`: the ``nofilter`` throughput of the sensor, the edge coating, the diffraction efficiency of each order, the dispersion and the dispersed image of the star, and the slitless sky rate. wcc-sim adds the catalogue, the position of every star on the detector, the layout of the two halves, the noise and the FITS output. wcc-sim needs wcc-etc 0.1.2 or later. Layout on the detector ---------------------- ======== ============ =================== ==================== Half Passband Side of the split Dispersion direction ======== ============ =================== ==================== ``blue`` 350-700 nm left (smaller x) +x, along pixel rows ``red`` 600-1100 nm right (larger x) +y, along columns ======== ============ =================== ==================== The zeroth order of a star is at its catalogue position. In the first order, light of wavelength :math:`\lambda` lands ``GRDISP`` :math:`\times \lambda` pixels from it: 0.0822 px/nm on the IMX455, so 29 to 58 px for the blue half and 49 to 90 px for the red half. Orders -1 to +2 are drawn by default (``orders=``). The halves meet at column ``split_x``, by default the centre of the array, ``(nx - 1) / 2``. For a subarray (``shape=``) that is the centre of the subarray; pass ``split_x`` to place the boundary elsewhere, or far outside the frame to simulate one half alone. The transition zone ------------------- The grating is 70 mm in front of the detector, where the f/15 beam of a star is 4.67 mm across. On the detector that is a radius of 620 px (IMX455) or 507 px (HWK4123). A star closer to the split than that sends part of its beam through each half and gets both spectra. Each is scaled by the fraction of the beam on its half, from :func:`wcc_sim.grating.blue_fraction` (the area of a filled circle on each side of the split), and the catalogue column ``blue_fraction`` records it. The zone covers 13% of the IMX455 width and 25% of the HWK4123 width. The sky is slitless as well: each pixel collects sky light over the whole passband of the half in front of it. The sky rate therefore differs between the halves and changes across the transition zone with the same fraction. Stars and their spectra ----------------------- Each star gets the stellar template that :func:`~wcc_sim.simulate_field` would give it (from its Gaia colour, or the optional ``spt`` column) and is scaled by its G magnitude. All stars of one template share one dispersed image per half (:func:`wcc_sim.grating.grating_template`), rendered by wcc-etc on a grid of ``oversample`` fine pixels per detector pixel (default 5) and shifted to the star's sub-pixel position. Templates are cached, so the first call for a field takes longer than the following ones: about 30 s and 3 s for 1500 stars of 22 spectral types on the full IMX455 frame. Output ------ The FITS file has the layout of :doc:`output`. The grating adds these header cards: ============ ========================================================== Card Meaning ============ ========================================================== ``GRATING`` ``T`` for a grating image ``GRSPLITX`` column of the boundary between the halves [px] ``GRBEAMR`` beam radius on the grating, in detector pixels ``GRDISP`` first-order dispersion [px/nm]; blue along +x, red along +y ``GRORDERS`` diffraction orders drawn ``SKYBLUE`` sky rate behind the blue half [e-/s/px] ``SKYRED`` sky rate behind the red half [e-/s/px] ============ ========================================================== The catalogue (``CAT``) has ``x``, ``y`` (the zeroth order), ``spt``, ``blue_fraction``, ``rate_e_s`` (the rate drawn, all orders and both halves) and ``saturated``, which is true when the star's own brightest pixel reaches the per-read ceiling. ``SATMASK`` marks every saturated pixel. Checks ------ For one star, the electrons in the per-band boxes of the exposure time calculator agree with the calculator's own image to 0.5% in g, r, i and z and to 1.8% in u. The u box is 3.7 px long, and the detector-sampled image of the calculator puts slightly more of the neighbouring light into it than the finer grid used here. The noise of simulated exposures matches ``GratingSimulation.get_band_snr`` (tutorial, section 6). Limits ------ The simulation does not model: - the wider image of a beam clipped by the split. Both spectra of a star in the transition zone use the full-beam image, and the central obscuration is ignored in the beam fraction; - the wings and scattered light of a star beyond the template, which is 65 px wide across the dispersion. Stars brighter than about G = 12 show the edge of the template; - extended sources, defocus and a jitter other than the wcc-etc default; - what ``wcc_etc.grating`` leaves out: the static wavefront error and the 3.6% change of the dispersion across the tilted sensor. Extraction of the spectra is not part of wcc-sim yet.