scopesim.optics.fov.FieldOfView3D#
- class scopesim.optics.fov.FieldOfView3D(header, waverange, detector_header=None, cmds=None, **kwargs)#
Bases:
FieldOfViewFor spectroscopy, output 3D datacube (wave, x, y).
Added in version 0.11.0: Split
FieldOfViewinto 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
ImageHDUthat fits inside the FOV volume.extract_area_from_table(table, minmax)Extract the entries of a
Tablethat 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 HDU data if already exists.
view([sub_pixel])Force the self.fields to be viewed as a single object.
Attributes
Return meta["area"] from cmds.
Return either hdu.data, image, cube, spectrum or None.
Return the area in arcsec**2 covered by one pixel.
Return a collection of all fields' spectra.
Return "!SIM.computing.spline_order" from cmds.
Return meta["sub_pixel"] from cmds.
Return the name of the trace.
Return central wavelength in um.
Return wavelength range in um [wave_min, wave_max].
Return a wavelength vector in um.
- property data#
Return either hdu.data, image, cube, spectrum or None.
- extract_area_from_imagehdu(imagehdu, corners)#
Extract the part of a
ImageHDUthat 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
Tablethat 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_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-1Note
self.make_cube()does NOT store anything inself.cubeself.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 Nonebefore assigning a new cube itThe cube is made with these steps:
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
Find Cube fields (see
FieldOfView._make_cube_cubefields()).Find Image fields (see
FieldOfView._make_cube_imagefields()).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_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 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.