get_apertures

sofia_redux.spectroscopy.getapertures.get_apertures(profiles, apertures, refit_fwhm=True, get_bg=True, bg_threshold=3.0, min_bg_pts=3)[source]

Determine aperture radii for extraction.

Profiles expected are the median profiles produced by sofia_redux.spectroscopy.mkspatprof. Aperture positions may be produced by sofia_redux.spectroscopy.findapertures. The positions dictionary will be copied to the return value and updated with appropriate values for the aperture radii:

""aperture_radius"

The aperture radius, used as the integration radius in optimal extraction.

"psf_radius"

The position at which the flux drops to zero. Used as the total flux weighting radius for optimal extraction. For standard extraction, is used as the full integration radius.

Background regions, if requested, are specified for the whole order, rather than for an individual aperture.

Parameters:
profilesdict
order (int) -> profile (numpy.ndarray)

(2, n_spatial) spatial profile where profile[0] = spatial coordinate and profile[1] = median spatial profile.

aperturesdict

Apertures to update. Keys are orders, values are list of dict. Required keys are:

"position"

Aperture position (float)

"fwhm"

Aperture FWHM (float)

"sign"

Aperture sign ({1, -1})

The dictionaries may optionally contain ‘aperture_radius’ and ‘psf_radius’: if present, these values are treated as fixed.

refit_fwhmbool, optional

If set, the peak will be fit to re-determine the spatial FWHM of the aperture.

get_bgbool, optional

If set, background regions will be determined from the non-aperture regions.

Returns:
aperture_regionsdict
order (int) -> dict

Keys and values are as follows:

"apertures"

List of dict with keys:

"position"

Aperture position (float)

"fwhm"

Aperture FWHM (float)

"sign"

Aperture sign ({1, -1})

"aperture_radius"

Aperture radius (float)

"psf_radius"

PSF radius (float)

"mask"

Aperture mask (numpy.ndarray)

"background"

Dict with keys:

"regions"

List of tuple. Values are (start, stop) positions in arcsec up the slit.

"mask"

Background mask (numpy.ndarray)