scopesim.effects.spectral_trace_list module

Effect for mapping spectral cubes to the detector plane.

The Effect is called SpectralTraceList, it applies a list of spectral_trace_list_utils.SpectralTrace objects to a FieldOfView.

class scopesim.effects.spectral_trace_list.SpectralTraceList(**kwargs)[source]

Bases: Effect

List of spectral trace geometries for the detector plane.

Should work in concert with an ApertureList (or ApertureMask) object and a DetectorList object

Spectral trace patterns are to be kept in a fits.HDUList with one or more fits.BinTableHDU extensions, each one describing the geometry of a single trace. The first extension should be a BinTableHDU connecting the traces to the correct Aperture and ImagePlane objects.

The fits.HDUList objects can be loaded using one of these two keywords:

  • filename: for on disk FITS files, or

  • hdulist: for in-memory fits.HDUList objects

The format and contents of the extensions in the HDUList (FITS file) object is listed below

apply_to(obj, **kwargs)[source]

Interface between FieldOfView and SpectralTraceList.

This is called twice: 1. During setup of the required FieldOfView objects, the SpectralTraceList is asked for the source space volumes that it requires (spatial limits and wavelength limits). 2. During “observation” the method is passed a single FieldOfView object and applies the mapping to the image plane to it. The FieldOfView object is associated to one SpectralTrace from the list, identified by meta[“trace_id”].

property footprint

Return the footprint of the entire SpectralTraceList.

property image_plane_header

Create and return header for the ImagePlane.

make_spectral_traces()[source]

Return a dictionary of spectral traces read in from a file.

plot(wave_min=None, wave_max=None, axes=None, **kwargs)[source]

Plot every spectral trace in the spectral trace list.

Parameters:
wave_minfloat, optional

Minimum wavelength, if any. If None, value from_currsys is used.

wave_maxfloat, optional

Maximum wavelength, if any. If None, value from_currsys is used.

axesmatplotlib axes, optional

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

**kwargsdict

Any other parameters passed along to the plot method of the individual spectral traces.

Returns:
figmatplotlib figure

DESCRIPTION.

rectify_cube(hdulist)[source]

Rectify traces and combine into a cube.

rectify_traces(hdulist, xi_min=None, xi_max=None, interps=None, **kwargs)[source]

Create rectified 2D spectra for all traces in the list.

This method creates an HDU list with one extension per spectral trace, i.e. it essentially treats all traces independently. For the case of an IFU where the traces correspond to spatial slices for the same wavelength range, use method rectify_cube (not yet implemented).

Parameters:
hduliststr or fits.HDUList

The result of scopesim readout()

xi_min, xi_maxfloat [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. For the time being, these limits must be provided by the user.

interpslist 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.

update_meta()[source]

Update fov related meta values.

The values describe the full extent of the spectral trace volume in wavelength and space

class scopesim.effects.spectral_trace_list.SpectralTraceListWheel(**kwargs)[source]

Bases: Effect

A Wheel-Effect object for selecting between multiple gratings/grisms.

See SpectralTraceList for the trace file format description.

Parameters:
trace_list_nameslist

The list of unique identifiers in the trace filenames

filename_formatstr

f-string that directs scopesim to the folder containing the trace files. This can be a !-string if the trace names are shared with other *Wheel effect objects (e.g. a FilterWheel). See examples.

current_trace_liststr

default trace file to use

kwargskey-value pairs

Addition keywords that are passed to the SpectralTraceList objects See SpectralTraceList docstring

Examples

A simplified YAML file example taken from the OSIRIS instrument package:

alias: INST
name: OSIRIS_LSS

properties:
  decouple_detector_from_sky_headers: True
  grism_names:
    - R300B
    - R500B
    - R1000B
    - R2500V

effects:
  - name: spectral_trace_wheel
    description: grism wheel contining spectral trace geometries
    class: SpectralTraceListWheel
    kwargs:
      current_trace_list: "!OBS.grating_name"
      filename_format: "traces/LSS_{}_TRACE.fits"
      trace_list_names: "!INST.grism_names"

  - name: grating_efficiency
    description: OSIRIS grating efficiency curves, piggybacking on FilterWheel
    class: FilterWheel
    kwargs:
      minimum_throughput: !!float 0.
      filename_format: "gratings/{}.txt"
      current_filter: "!OBS.grating_name"
      filter_names: "!INST.grism_names"
apply_to(obj, **kwargs)[source]

Use apply_to of current trace list.

property current_trace_list
required_keys = {'current_trace_list', 'filename_format', 'trace_list_names'}