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]

See parent docstring.

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]

See parent docstring.

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

Return 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(axes=None)[source]
required_keys = {'array_dict', 'filename', 'table'}
class scopesim.effects.apertures.RectangularApertureMask(**kwargs)[source]

Bases: ApertureMask

get_table(**kwargs)[source]
required_keys = {'height', 'width', 'x', 'y'}
class scopesim.effects.apertures.SlitWheel(**kwargs)[source]

Bases: Effect

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"
add_slit(newslit, name=None)[source]

Add a slit to the SlitWheel.

Parameters:
newslitSlit
namestring

Name to be used for the new slit. If None, a name from the newslit object is used.

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.

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

See parent docstring.

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.

required_keys = {'current_slit', 'filename_format', 'slit_names'}
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).