scopesim.optics.fov_utils module

scopesim.optics.fov_utils.combine_imagehdu_fields(fov_header, src, fields_indexes, wave_min, wave_max, area, wcs_suffix='', cmds=None)[source]

Combine list of ImageHDUs into a single one bounded by the Header WCS.

Parameters:
fov_headerfits.Header

Header from the FieldOfView

srcSource object
fields_indexeslist of ints

Which indexes from <Source>.fields to use

wave_minfloat

[deg] Blue spectral border

wave_maxfloat

[deg] Red spectral border

areafloat

[m2] Area of the primary aperture

wcs_suffixstr

Which coordinate system to use - “” for the on-sky coordinate system - “D” for the image-plane coordinate system

Returns:
canvas_hdufits.ImageHDU
scopesim.optics.fov_utils.combine_table_fields(fov_header, src, field_indexes)[source]

Combine list of Table objects into a single one bounded by the Header WCS.

Parameters:
fov_headerfits.Header

Header from a FieldOfView objects

srcSource object
field_indexeslist of int
Returns:
tblTable
scopesim.optics.fov_utils.extract_area_from_imagehdu(imagehdu, fov_volume)[source]

Extract the part of a ImageHDU that fits inside the fov_volume.

Parameters:
imagehdufits.ImageHDU

The field ImageHDU, either an image or a cube with wavelength [um]

fov_volumedict
Contains {“xs”: [xmin, xmax], “ys”: [ymin, ymax],

“waves”: [wave_min, wave_max], “xy_unit”: “deg” or “mm”, “wave_unit”: “um”}

Returns:
new_imagehdufits.ImageHDU
scopesim.optics.fov_utils.extract_area_from_table(table, fov_volume)[source]

Extract the entries of a Table that fits inside the fov_volume.

Parameters:
tablefits.ImageHDU

The field ImageHDU, either an image of a wavelength [um] cube

fov_volumedict
Contains {“xs”: [xmin, xmax], “ys”: [ymin, ymax],

“waves”: [wave_min, wave_max], “xy_unit”: “deg” or “mm”, “wave_unit”: “um”}

Returns:
new_imagehdufits.ImageHDU
scopesim.optics.fov_utils.extract_common_field(field, fov_volume)[source]

Extract the overlapping parts of a field within a FOV volume.

Parameters:
fieldTable or ImageHDU
fov_volumedict
Contains {“xs”: [xmin, xmax], “ys”: [ymin, ymax],

“waves”: [wave_min, wave_max], “xy_unit”: “deg” or “mm”, “wave_unit”: “um”}

Returns:
field_newTable or ImageHDU
scopesim.optics.fov_utils.extract_range_from_spectrum(spectrum, waverange)[source]
scopesim.optics.fov_utils.get_cube_waveset(hdr, return_quantity=False)[source]
scopesim.optics.fov_utils.is_field_in_fov(fov_header, field, wcs_suffix='')[source]

Return True if Source.field footprint is inside the FieldOfView footprint.

Parameters:
fov_headerfits.Header

Header from a FieldOfView object

field[astropy.Table, astropy.ImageHDU]

Field object from a Source object

wcs_suffixstr

[“S”, “D”] Coordinate system: Sky or Detector

Returns:
is_inside_fovbool
scopesim.optics.fov_utils.make_cube_from_table(table, spectra, waveset, fov_header, sub_pixel=False)[source]
Parameters:
table: astropy.Table
spectra: dict
waveset: np.ndarray
fov_header: fits.Header
sub_pixel: bool, optional
Returns:
cube: fits.ImageHDU

Units of ph/s/m2/bin –> should this be ph / (s * m2 * um)?

scopesim.optics.fov_utils.make_flux_table(source_tbl, src, wave_min, wave_max, area)[source]
scopesim.optics.fov_utils.sky2fp(header, xsky, ysky)[source]

Convert sky coordinates to image plane coordinated.

Parameters:
headerHeader

Header of a FieldOfView object which contains two sets of WCS keywords

xsky, yskyfloat, array

[deg] The on-sky coordinated

Returns:
xdet, ydetfloat, array

[mm] The coordinated on the image plane