castor_etc.background

Background Tools

castor_etc.background provides utilities to characterize the sky background (Earthshine, zodiacal light, geocoronal emission) through the Background class.

Module Contents

Classes

Background

Object to characterize the sky background.

API

class castor_etc.background.Background(earthshine_file: str | None = join(DATAPATH, 'sky_background', 'earthshine.fits'), zodi_file: str | None = join(DATAPATH, 'sky_background', 'zodi.fits'), mags_per_sq_arcsec: dict[float] | None = None)

Object to characterize the sky background.

Initialization

Create a Background object that characterizes the sky background. Can contain Earthshine, zodiacal light, and geocoronal emission lines.

Parameters

earthshine_file :: str or None The absolute path to the file containing the Earthshine data. It must be a FITS file with the first field (index zero) containing the wavelengths in angstroms and the second field (index one) containing the Earthshine flux in flam (erg/cm^2/s/A) per sq. arcsec. If None, omit Earthshine component. If mags_per_sq_arcsec provided, the data from this file will not be used.

zodi_file :: str or None The absolute path to the file containing the zodiacal light data. It must be a FITS file with the first field (index zero) containing the wavelengths in angstroms and the second field (index one) containing the Earthshine flux in flam (erg/cm^2/s/A) per sq. arcsec. If None, omit zodiacal light component. If mags_per_sq_arcsec provided, the data from this file will not be used.

mags_per_sq_arcsec :: dict of floats or None The sky background AB magnitudes per square arcsecond (incl. Earthshine & zodiacal light) in each of the telescope’s passbands. If provided, will use these values & the telescope’s photometric zero-points to convert the sky background to electron/s. If None, will use the earthshine file and zodi file & passband response curves to convert the sky background spectra to electron/s. Example: mags_per_sq_arcsec={"uv": 26.08, "u": 23.74, "g": 22.60}

Attributes

earthshine_wavelengths :: array of floats or None Earthshine spectrum wavelengths in angstrom.

earthshine_flam :: array of floats or None Earthshine flux density in flam (erg/cm^2/s/A) per sq. arcsec.

zodi_wavelengths :: array of floats or None Zodiacal light spectrum wavelengths in angstrom.

zodi_flam :: array of floats or None Zodiacal light flux density in flam (erg/cm^2/s/A) per sq. arcsec.

mags_per_sq_arcsec :: dict of floats or None The sky background AB magnitudes per square arcsecond (incl. Earthshine & zodiacal light) in each of the telescope’s passbands.

Returns

background :: Background object The Background object containing earthshine and zodiacal light data. Geocoronal emission lines can be added via the add_geocoronal_emission() function.

copy()

Convenience function for creating a deep copy of the Background object.

Parameters

None

Returns

Background_copy :: Background object The deep copy of the Background object.

add_geocoronal_emission(flux='avg', wavelength=GEOCORONAL_WAVELENGTH, linewidth=GEOCORONAL_LINEWIDTH)

Add a geocoronal emission line.

Parameters

flux :: float or “high” or “avg” or “low” The flux of the geocoronal emission line in erg/cm^2/s/arcsec^2. If “high”, “avg”, or “low”, use the pre-defined geocoronal emission line values (3.0e-15, 1.5e-15, and 7.5e-17 erg/cm^2/s/arcsec^2, respectively).

wavelength :: int or float or astropy.Quantity length The central wavelength of the geocoronal emission line. If an int or float, it is assumed to be in angstrom.

linewidth :: int or float or astropy.Quantity length The linewidth of the geocoronal emission line. If an int or float, it is assumed to be in angstrom. This is currently not used in any calculations.

Attributes

geo_flux :: list of floats The fluxes of the geocoronal emission lines in erg/cm^2/s/arcsec^2.

geo_wavelength :: list of floats The central wavelengths of the geocoronal emission lines in angstrom.

geo_linewidth :: list of floats The linewidths of the geocoronal emission lines in angstrom. This is currently not used in any calculations.

Returns

None

_get_mags_per_sq_arcsec(TelescopeObj)

Internal function to calculate the sky background AB magnitudes per square arsecond (not including geocoronal emission lines) through the given TelescopeObj’s passbands based on Earthshine and/or zodiacal light spectra.

Users should use the calc_mags_per_sq_arcsec() method instead.

Parameters

TelescopeObj :: Telescope object The castor_etc.Telescope object to use for the sky background calculations.

Returns

mags_per_sq_arcsec :: dict of floats The total sky background AB magnitudes per square arcsecond in the telescope’s passbands, excluding geocoronal emission lines.

calc_mags_per_sq_arcsec(TelescopeObj, overwrite=False)

Calculates the sky background AB magnitudes per square arcsecond (not including geocoronal emission lines) through the telescope’s passbands based on Earthshine and/or zodiacal light spectra. This is useful if reusing the same sky background object for multiple Photometry/Spectroscopy instances with the same Telescope object.

Parameters

TelescopeObj :: Telescope object The castor_etc.Telescope object to use for the sky background calculations.

overwrite :: bool If True, calculate the sky background AB magnitudes per square arsec in each Telescope passband (excluding geocoronal emission) based on Earthshine and/or zodiacal light spectra and the provided Telescope object and overwrite any existing mags_per_sq_arcsec attribute. If False and the mags_per_sq_arcsec attribute is not None, raise an error.

Attributes

mags_per_sq_arcsec :: dict of floats The total sky background AB magnitudes per square arcsecond in the telescope’s passbands, excluding geocoronal emission lines.

Returns

mags_per_sq_arcsec :: dict of floats The total sky background AB magnitudes per square arcsecond in the telescope’s passbands, excluding geocoronal emission lines.