scopesim.optics.fov.FieldOfView3D#

class scopesim.optics.fov.FieldOfView3D(header, waverange, detector_header=None, cmds=None, **kwargs)#

Bases: FieldOfView

For spectroscopy, output 3D datacube (wave, x, y).

Added in version 0.11.0: Split FieldOfView into nD-subclasses.

__init__(header, waverange, detector_header=None, cmds=None, **kwargs)#

Methods

__init__(header, waverange[, ...])

extract_area_from_imagehdu(imagehdu, corners)

Extract the part of a ImageHDU that fits inside the FOV volume.

extract_area_from_table(table, minmax)

Extract the entries of a Table that fit inside the FOV volume.

extract_from(src)

Extract relevent fields from source object.

flatten()

If cube, collapse along first axis.

get_corners([new_unit])

Return sky footprint, image plane footprint.

get_fields_in_fov(fields)

Return True if Source.field footprint is inside FOV footprint.

make_hdu()

TBA.

plot(axes[, units])

Plot FOV footprint.

plot_data()

Plot HDU data if already exists.

view([sub_pixel])

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

Attributes

area

Return meta["area"] from cmds.

data

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

pixel_area

Return the area in arcsec**2 covered by one pixel.

spectra

Return a collection of all fields' spectra.

spline_order

Return "!SIM.computing.spline_order" from cmds.

sub_pixel

Return meta["sub_pixel"] from cmds.

trace_id

Return the name of the trace.

wavelength

Return central wavelength in um.

waverange

Return wavelength range in um [wave_min, wave_max].

waveset

Return a wavelength vector in um.

property area: float#

Return meta[“area”] from cmds.

property data#

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

extract_area_from_imagehdu(imagehdu, corners)#

Extract the part of a ImageHDU that fits inside the FOV volume.

Parameters:
  • imagehdu (fits.ImageHDU) – The field ImageHDU, either an image or a cube with wavelength [um].

  • corners (quantity) – From FOV corners in deg.

Returns:

new_imagehdu

Return type:

fits.ImageHDU

static extract_area_from_table(table, minmax)#

Extract the entries of a Table that fit inside the FOV volume.

Parameters:
  • table (table.Table) – The field table.

  • minmax (quantity) – From FOV corners in the form of [[xmin, ymin], [xmax, ymax]].

Returns:

cut_table – Table reduced to sources inside the FOV.

Return type:

table.Table

extract_from(src) None#

Extract relevent fields from source object.

Parameters:

src (Source) – Input Source object to be “observed”.

Return type:

None

Notes

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

This method assumes that Bandpass has been applied.

flatten()#

If cube, collapse along first axis.

get_corners(new_unit: str = None)#

Return sky footprint, image plane footprint.

get_fields_in_fov(fields: Iterable[SourceField]) Generator#

Return True if Source.field footprint is inside FOV footprint.

make_hdu()#

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 / (cm2 * s * AA). 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_hdu – [ph s-1 um-1 arcsec-2] # as needed by SpectralTrace

Return type:

fits.ImageHDU

property pixel_area#

Return the area in arcsec**2 covered by one pixel.

plot(axes, units: str = 'arcsec') None#

Plot FOV footprint.

plot_data()#

Plot HDU data if already exists.

Added in version 0.11.0.

property spectra: dict[int, SourceSpectrum]#

Return a collection of all fields’ spectra.

Deprecated since version 0.10.0: Use individual fields’ spectra instead.

property spline_order: int#

Return “!SIM.computing.spline_order” from cmds.

property sub_pixel: bool#

Return meta[“sub_pixel”] from cmds.

property trace_id#

Return the name of the trace.

view(sub_pixel: bool | None = None)#

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

Parameters:

sub_pixel (bool | None, optional) – If None (the default), use value from meta.

Returns:

  • self.hdu (fits.ImageHDU, synphot.SourceSpectrum)

  • .. versionchanged:: 0.11.0 – Removed hdu_type and use_photlam arguments, this is now handled by the subclasses.

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.