scopesim.effects.mosaic_trace_list.MosaicSpectralTrace#

class scopesim.effects.mosaic_trace_list.MosaicSpectralTrace(trace_tbl, cmds=None, **kwargs)#

Bases: SpectralTrace

A single spectral trace for MOSAIC.

Added in version 0.11.0.

__init__(trace_tbl, cmds=None, **kwargs)#

Methods

__init__(trace_tbl[, cmds])

compute_interpolation_functions()

Compute various interpolation functions between slit and focal plane.

footprint([wave_min, wave_max, xi_min, xi_max])

Return corners of rectangle enclosing spectral trace.

fov_grid()

Provide information on the source space volume required by the effect.

map_spectra_to_focal_plane(fov)

Apply the spectral trace mapping to a spectral cube.

plot([wave_min, wave_max, xi_min, xi_max, ...])

Plot control points (and/or footprint) of the SpectralTrace.

rectify(hdulist[, interps, wcs])

Create 2D spectrum for a trace.

Attributes

trace_id

Return the name of the trace.

compute_interpolation_functions()#

Compute various interpolation functions between slit and focal plane.

Focal plane coordinates are x and y, in mm. Slit coordinates are xi (spatial coordinate along the slit, in arcsec) and lam (wavelength, in um).

The interpolation functions include a shift in the focal-plane coordinates, determined from the CRVAL of the source FOV.

footprint(wave_min=None, wave_max=None, xi_min=None, xi_max=None)#

Return corners of rectangle enclosing spectral trace.

Parameters:
  • wave_min (float [um], Quantity) – Minimum and maximum wavelength to compute the footprint on. If None, use the full range that spectral trace is defined on. Float values are interpreted as microns.

  • wave_max (float [um], Quantity) – Minimum and maximum wavelength to compute the footprint on. If None, use the full range that spectral trace is defined on. Float values are interpreted as microns.

  • xi_min (float [arcsec], Quantity) – Minimum and maximum slit position on the sky. If None, use the full range that spectral trace is defined on. Float values are interpreted as arcsec.

  • xi_max (float [arcsec], Quantity) – Minimum and maximum slit position on the sky. If None, use the full range that spectral trace is defined on. Float values are interpreted as arcsec.

fov_grid()#

Provide information on the source space volume required by the effect.

Returns:

  • A dictionary with entries wave_min and wave_max.

  • Spatial limits are determined by the ApertureMask effect

  • and are not returned here.

map_spectra_to_focal_plane(fov)#

Apply the spectral trace mapping to a spectral cube.

The cube is contained in a FieldOfView object, which also has world coordinate systems for the Source (sky coordinates and wavelengths) and for the focal plane. The method returns a section of the fov image along with info on where this image lies in the focal plane.

plot(wave_min=None, wave_max=None, xi_min=None, xi_max=None, *, c='r', axes=None, plot_footprint=True, plot_wave=True, plot_ctrlpnts=True, plot_outline=False, plot_trace_id=False)#

Plot control points (and/or footprint) of the SpectralTrace.

Parameters:
  • wave_min (float, optional) – Minimum wavelength, if any.

  • wave_max (float, optional) – Maximum wavelength, if any.

  • xi_min (float, optional) – Minimum slit, if any.

  • xi_max (float, optional) – Maximum slit, if any.

  • c (str, optional) – Colour, any valid matplotlib colour string. The default is “r”.

  • axes (matplotlib axes, optional) – The axes object to use for the plot. If None (default), a new figure with one axes will be created.

  • plot_footprint (bool, optional) – Plot a rectangle encompassing all control points, which may be larger than the area actually covered by the trace, if the trace is not exactly perpendicular to the detector. The default is True.

  • plot_wave (bool, optional) – Annotate the wavelength points. The default is True.

  • plot_ctrlpnts (bool, optional) – Plot the individual control points as makers. The default is True.

  • plot_outline (bool, optional) – Plot the smallest tetragon encompassing all control points. The default is False.

  • plot_trace_id (bool, optional) – Write the trace ID in the middle of the trace. The default is False.

Returns:

axes – The axes object containing the plot.

Return type:

matplotlib axes

rectify(hdulist, interps=None, wcs=None, **kwargs)#

Create 2D spectrum for a trace.

Parameters:
  • hdulist (HDUList) – The result of scopesim readout

  • interps (list of interpolation functions) – If provided, there must be one for each image extension in hdulist. The functions go from pixels to the images and can be created with, e.g., RectBivariateSpline.

  • wcs (The WCS describing the rectified XiLamImage. This can be created) – in a simple way from the fov included in the OpticalTrain used in the simulation run producing hdulist.

  • keywords (The WCS can also be set up via the following)

  • bin_width (float [um]) – The spectral bin width. This is best computed automatically from the spectral dispersion of the trace.

  • wave_min (float [um]) – Limits of the wavelength range to extract. The default is the the full range on which the SpectralTrace is defined. This may extend significantly beyond the filter window.

  • wave_max (float [um]) – Limits of the wavelength range to extract. The default is the the full range on which the SpectralTrace is defined. This may extend significantly beyond the filter window.

  • xi_min (float [arcsec]) – Spatial limits of the slit on the sky. This should be taken from the header of the hdulist, but this is not yet provided by scopesim

  • xi_max (float [arcsec]) – Spatial limits of the slit on the sky. This should be taken from the header of the hdulist, but this is not yet provided by scopesim

property trace_id#

Return the name of the trace.