scopesim.effects.apertures module

Effects related to field masks, including spectroscopic slits

class scopesim.effects.apertures.ApertureList(**kwargs)[source]

Bases: Effect

A list of apertures, useful for IFU or MOS instruments

Parameters:
property apertures
apply_to(obj, **kwargs)[source]
get_apertures(row_ids)[source]
plot()[source]
plot_masks()[source]
class scopesim.effects.apertures.ApertureMask(**kwargs)[source]

Bases: Effect

Only provides the on-sky window coords of the Aperture

  • Case: Imaging
    • Covers the whole FOV of the detector

    • Round (with mask), square (without mask)

  • CaseLS Spec
    • Covers the slit FOV

    • Polygonal (with mask), square (without mask)

  • CaseIFU Spec
    • Covers the on-sky FOV of one slice of the IFU

    • Square (without mask)

  • CaseMOS Spec
    • Covers a single MOS fibre FOV

    • Round, Polygonal (with mask), square (without mask)

The geometry of an ApertureMask can be initialised with the standard DataContainer methods (see Parameters below). Regardless of which method is used, the following columns must be present:

x       y
arcsec  arcsec
float   float

Certain keywords need to also be included in the ascii header:

# id: <int>
# conserve_image: <bool>
# x_unit: <str>
# y_unit: <str>

If conserve_image is False, the flux from all sources in the aperture is summed and distributed uniformly over the aperture area.

Parameters:
filenamestr

Path to ASCII file containing the columns listed above

tableastropy.Table

An astropy Table containing the columns listed above

array_dictdict

A dictionary containing the columns listed above: {x: [...], y: [...], id: <int>, conserve_image: <bool>}

Other Parameters:
pixel_scalefloat

[arcsec] Defaults to "!INST.pixel_scale" from the config

idint

An integer to identify the ApertureMask in a list of apertures

apply_to(obj, **kwargs)[source]
fov_grid(which='edges', **kwargs)[source]

Returns a header with the sky coordinates

get_header()[source]
get_mask()[source]

For placing over FOVs if the Aperture is rotated w.r.t. the field

property hdu
property header
property mask
plot(new_figure=True)[source]
class scopesim.effects.apertures.RectangularApertureMask(**kwargs)[source]

Bases: ApertureMask

get_table(**kwargs)[source]
class scopesim.effects.apertures.SlitWheel(**kwargs)[source]

Bases: Effect

A selection of predefined spectroscopic slits and possibly other field masks

It should contain an open position. A user can define a non-standard slit by directly using the Aperture effect.

Parameters:
slit_nameslist of str
filename_formatstr

A f-string for the path to the slit files

current_slitstr

Default name

Examples

This Effect assumes a folder full of ASCII files containing the edges of each slit. Each file should be names the same except for the slit’s name or identifier.

This example assumes a folder masks containing the slit ASCII files with the naming convention: slit_A.dat, slit_B.dat, etc.

name: slit_wheel
class: SlitWheel
kwargs:
    slit_names:
        - A
        - B
        - C
    filename_format: "masks/slit_{}.dat
    current_slit: "C"
apply_to(obj, **kwargs)[source]

Use apply_to of current_slit

change_slit(slitname=None)[source]

Change the current slit

property current_slit

Return the currently used slit

property display_name
fov_grid(which='edges', **kwargs)[source]

Returns the edges needed to generate FieldOfViews for an observation

Parameters:
whichstr

[“waveset”, “edges”, “shifts”] where: * waveset - wavelength bin extremes * edges - on sky coordinate edges for each FOV box * shifts - wavelength dependent FOV position offsets

Returns:
wavesetlist

[um] N+1 wavelengths that set edges of N spectral bins

edgeslist of lists

[arcsec] Contains a list of footprint lists

shiftslist of 3 lists

[wave, dx, dy] Contains lists corresponding to the (dx, dy) offset from the optical axis (0, 0) induced for each wavelength in (wave) [um, arcsec, arcsec]

get_table()[source]

Create a table of slits with centre position, width and length

Width is defined as the extension in the y-direction, length in the x-direction. All values are in milliarcsec.

scopesim.effects.apertures.make_aperture_polygon(left, right, top, bottom, angle, shape, **kwargs)[source]
scopesim.effects.apertures.mask_from_coords(x, y, pixel_scale)[source]
scopesim.effects.apertures.points_on_a_circle(n, x0=0, y0=0, dx=1, dy=1, offset=0)[source]
scopesim.effects.apertures.rotate(x, y, x0, y0, angle)[source]

Rotate a line by angle [deg] around the point (x0, y0)