scopesim.optics.fov module

Defines FieldOfView class

class scopesim.optics.fov.FieldOfView(header, waverange, detector_header=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
property corners
property cube_fields
property data
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]
property image_fields
make_cube_hdu()[source]

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:

    rescale and reorient cubes
    interp1d smaller cubes with waveset
    add cubes to cavas cube
    
  3. Find Image fields:

    rescale and reorient images
    evaluate spectra at waveset
    expand image by spectra to 3D form
    add image cubes to canvas cube
    
  4. Find Table fields:

    evaluate spectra at waveset
    add spectrum at x,y position in canvas cube
    

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]

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

  1. Make waveset and canvas image

    make canvas image from NAXIS1,2 from fov.header

  2. Find Cube fields

    collapse cube along wavelength axis rescale and reorient image add cube image to canvas image

  3. Find Image fields

    rescale and reorient images sum spectra between wavelength edges multiply image by summed spectrum add image to canvas image

  4. Find Table fields

    sum spectra between wavelength edges add summed flux at x,y position in canvas image

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]

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

  1. Make waveset and zeros flux

    make dict of spectra evaluated at waveset

  2. Find Cube fields

    collapse cube along spatial dimensions –> spectrum vector convert vector to PHOTLAM interpolate at waveset add to zeros flux vector

  3. Find Image fields

    sum image over both dimensions evaluate SPEC_REF spectum at waveset multiply by sum add to zeros flux vector

  4. Find Table fields

    evaluate all spectra at waveset for each unique ref, sum the weights add each spectra * sum of weights to zeros flux vector

Returns:
specSourceSpectrum

[PHOTLAM]

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

Forces 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

Returns central wavelength in um

property waverange

Returns wavelength range in um [wave_min, wave_max]

property waveset

Returns a wavelength vector in um