scopesim.optics.fov module

Defines FieldOfView class.

class scopesim.optics.fov.FieldOfView(header, waverange, detector_header=None, cmds=None, **kwargs)[source]

Bases: FieldOfViewBase

A FOV is spectro-spatial volume cut out of a Source object.

Flux units after extracting the fields from the Source are in ph/s/pixel

The initial header should contain an on-sky WCS description: - CDELT-, CUNIT-, NAXIS- : for pixel scale and size (assumed CUNIT in deg) - CRVAL-, CRPIX- : for positioning the final image - CTYPE- : is assumed to be “RA—TAN”, “DEC–TAN”

and an image-plane WCS description - CDELT-D, CUNIT-D, NAXISn : for pixel scale and size (assumed CUNIT in mm) - CRVAL-D, CRPIX-D : for positioning the final image - CTYPE-D : is assumed to be “LINEAR”, “LINEAR”

The wavelength range is given by waverange

property background_fields

Return list of BG_SRC ImageHDU fields.

property corners

Return sky footprint, image plane footprint.

property cube_fields

Return list of non-BG_SRC ImageHDU fields with NAXIS=3.

property data

Return either hdu.data, image, cube, spectrum or None.

extract_from(src)[source]

..assumption: Bandpass has been applied.

Note

Spectra are cut and copied from the original Source object. They are in original units. ph/s/pix comes in the make_**** methods

flatten()[source]

If cube, collapse along first axis.

property image_fields

Return list of non-BG_SRC ImageHDU fields with NAXIS=2.

make_cube_hdu()[source]

TBA.

Used for IFUs, slit spectrographs, and coherent MOSs (e.g.KMOS)

Returned cube units are ph s-1 voxel-1

Note

self.make_cube() does NOT store anything in self.cube

self.cube and self.make_cube() are deliberately kept seperately so that self.cube will not be accidently overwritten by a rogue call from an Effect object.

All Effect objects should specifically test whether self.cube is None before assigning a new cube it

The cube is made with these steps:

  1. Make waveset and canvas cube:

    if at least one cube:
        set waveset to equal largest cube waveset
    else:
        make waveset from self.meta values
    make canvas cube based on waveset of largest cube and NAXIS1,2 from fov.header
    
  2. Find Cube fields (see FieldOfView._make_cube_cubefields()).

  3. Find Image fields (see FieldOfView._make_cube_imagefields()).

  4. Find Table fields (see FieldOfView._make_cube_tablefields()).

PHOTLAM = ph / (s * m2 * um). Original source fields are in units of:

  • tables: (PHOTLAM in spectrum)

  • images: arcsec-2 (PHOTLAM in spectrum)

  • cubes: PHOTLAM arcsec-2

Warning

Input Images and Cubes should have units of PHOTLAM arcsec-2

Returns:
canvas_cube_hdufits.ImageHDU

[ph s-1 AA-1 arcsec-2] # as needed by SpectralTrace

make_image_hdu(use_photlam=False)[source]

TBA.

Used for imaging.

Output image units are ph s-1 pixel-1

Note

self.make_image() does NOT store anything in self.image

See make_cube for an explanation

Make canvas image from NAXIS1,2 from fov.header

Parameters:
use_photlambool

Default False. Defines the flux units of the image pixels

Returns:
image_hdufits.ImageHDU

[ph s-1 pixel-1] or PHOTLAM (if use_photlam=True)

make_spectrum()[source]

TBA.

This is needed for when we do incoherent MOS instruments. Each fibre doesn’t care about the spatial information.

Returns:
specSourceSpectrum

[PHOTLAM]

property pixel_area
property table_fields

Return list of Table fields.

property trace_id

Return the name of the trace.

view(hdu_type='image', sub_pixel=None, use_photlam=None)[source]

Force the self.fields to be viewed as a single object.

Parameters:
sub_pixelbool
hdu_typestr

[“cube”, “image”, “spectrum”]

Returns:
self.hdufits.ImageHDU, synphot.SourceSpectrum
volume(wcs_prefix='')[source]
property wavelength

Return central wavelength in um.

property waverange

Return wavelength range in um [wave_min, wave_max].

property waveset

Return a wavelength vector in um.