pypeit.core.standard module

Implements classes for flux standard spectra used for flux calibration.

class pypeit.core.standard.ArchivedFluxStandard(wave, flux, ivar=None, gpm=None, meta=None)[source]

Bases: Spectrum

Abstract class used to provide common methods for all archive standards.

classmethod _init_meta(row=None)[source]

Instantiate the metadata.

archive = None

Archive identifier

classmethod found_match(ra, dec, tol=20.0, unit=None)[source]

Check if there is a match to the provided coordinates within the tolerance.

Parameters:
  • ra (float, str) – On-sky coordinates. If units are None, the coordinates are assumed to be in degree if provided as floats, and they are assumed to be in hours and degrees if provided as (e.g., sexagesimal) strings.

  • dec (float, str) – On-sky coordinates. If units are None, the coordinates are assumed to be in degree if provided as floats, and they are assumed to be in hours and degrees if provided as (e.g., sexagesimal) strings.

  • tol (float, optional) – Tolerance for coordinate matching in arcmin

  • unit (str, tuple, optional) – Units for the on-sky coordinates. See ra and dec for the default behavior.

Returns:

Flag that an appropriate match was found.

Return type:

bool

classmethod from_coordinates(ra, dec, tol=20.0, unit=None)[source]

Instantiate the class using the spectrum for the object closest to the provided set of coordinates.

Parameters:
  • ra (float, str) – On-sky coordinates. If units are None, the coordinates are assumed to be in degree if provided as floats, and they are assumed to be in hours and degrees if provided as (e.g., sexagesimal) strings.

  • dec (float, str) – On-sky coordinates. If units are None, the coordinates are assumed to be in degree if provided as floats, and they are assumed to be in hours and degrees if provided as (e.g., sexagesimal) strings.

  • tol (float, optional) – Tolerance for coordinate matching in arcmin

  • unit (str, tuple, optional) – Units for the on-sky coordinates. See ra and dec for the default behavior.

classmethod from_name(name)[source]

Instantiate from the name of an archive source.

Parameters:

name (str) – Name of the source in the archive data table. Must be an exact match.

classmethod nearest_standard(ra, dec, unit=None)[source]

Find the standard star with an archived flux-calibration spectrum nearest the provided set of coordinates.

Parameters:
  • ra (float, str) – On-sky coordinates. If units are None, the coordinates are assumed to be in degree if provided as floats, and they are assumed to be in hours and degrees if provided as (e.g., sexagesimal) strings.

  • dec (float, str) – On-sky coordinates. If units are None, the coordinates are assumed to be in degree if provided as floats, and they are assumed to be in hours and degrees if provided as (e.g., sexagesimal) strings.

  • unit (str, tuple, optional) – Units for the on-sky coordinates. See ra and dec for the default behavior.

Returns:

  • float – Separation between the nearest standard star and the provided coordinates.

  • str – Name of the object in the archive.

  • str – Name of the file with the archived spectrum.

path = None

Root with data files

class pypeit.core.standard.BlackbodyStandard(a, teff, wave=None, meta=None)[source]

Bases: ModelFluxStandard

Generate a blackbody spectrum based on the normalisation and effective temperature. See Suzuki & Fukugita, 2018, AJ, 156, 219: https://ui.adsabs.harvard.edu/abs/2018AJ….156..219S/abstract

Parameters:
  • a (float) – flux normalisation factor (dimensionless)

  • teff (float) – Effective temperature of the blackbody in Kelvin

  • wave (array-like, optional) – Vacuum wavelength in angstroms at which to calculate the blackbody flux. If None, the default wavelength range is set to 912 - 26000 Angstrom at a step of 0.1 Angstrom.

  • meta (dict, optional) – The metadata to keep with the spectrum.

classmethod found_match(ra, dec, tol=20.0, unit=None)[source]

Check if there is a match to the provided coordinates within the tolerance.

Parameters:
  • ra (float, str) – On-sky coordinates. If units are None, the coordinates are assumed to be in degree if provided as floats, and they are assumed to be in hours and degrees if provided as (e.g., sexagesimal) strings.

  • dec (float, str) – On-sky coordinates. If units are None, the coordinates are assumed to be in degree if provided as floats, and they are assumed to be in hours and degrees if provided as (e.g., sexagesimal) strings.

  • tol (float, optional) – Tolerance for coordinate matching in arcmin

  • unit (str, tuple, optional) – Units for the on-sky coordinates. See ra and dec for the default behavior.

Returns:

Flag that an appropriate match was found.

Return type:

bool

classmethod from_coordinates(ra, dec, tol=20.0, unit=None, wave=None)[source]

Instantiate the class using coefficients for the object closest to the provided set of coordinates.

Parameters:
  • ra (float, str) – On-sky coordinates. If units are None, the coordinates are assumed to be in degree if provided as floats, and they are assumed to be in hours and degrees if provided as (e.g., sexagesimal) strings.

  • dec (float, str) – On-sky coordinates. If units are None, the coordinates are assumed to be in degree if provided as floats, and they are assumed to be in hours and degrees if provided as (e.g., sexagesimal) strings.

  • tol (float, optional) – Tolerance for coordinate matching in arcmin

  • unit (str, tuple, optional) – Units for the on-sky coordinates. See ra and dec for the default behavior.

  • wave (array-like, optional) – Vacuum wavelength in angstroms at which to calculate the blackbody flux. If None, the default wavelength range is set to 912 - 26000 Angstrom at a step of 0.1 Angstrom.

classmethod from_name(name, wave=None)[source]

Instantiate from the name of an archive source.

Parameters:

name (str) – Name of the source in the archive data table. Must be an exact match.

model_type = 'blackbody'

Identifier for the type of model spectrum.

classmethod nearest_blackbody_coeffs(ra, dec, unit=None)[source]

Find the entry in the blackbody reference table nearest to the provided coordinates and return the angular separation and the coefficients needed to construct the model.

Parameters:
  • ra (float, str) – On-sky coordinates. If units are None, the coordinates are assumed to be in degree if provided as floats, and they are assumed to be in hours and degrees if provided as (e.g., sexagesimal) strings.

  • dec (float, str) – On-sky coordinates. If units are None, the coordinates are assumed to be in degree if provided as floats, and they are assumed to be in hours and degrees if provided as (e.g., sexagesimal) strings.

  • unit (str, tuple, optional) – Units for the on-sky coordinates. See ra and dec for the default behavior.

Returns:

  • sep (Quantity) – Angular separation between the provided coordinates and the nearest entry in the blackbody reference table.

  • name (str) – Name of the blackbody reference object.

  • a, teff (float) – Parameters used to construct the blackbody spectrum.

class pypeit.core.standard.CalSpecFluxStandard(file, meta=None)[source]

Bases: ArchivedFluxStandard

Container class for a “calspec” standard star spectrum.

archive = 'calspec'

Archive identifier

path = PypeItDataPath('/home/docs/checkouts/readthedocs.org/user_builds/pypeit/envs/latest/lib/python3.12/site-packages/pypeit/data/standards/calspec')

Root with data files

class pypeit.core.standard.ESOFilFluxStandard(file, meta=None)[source]

Bases: ArchivedFluxStandard

Container class for an “esofil” standard star spectrum.

archive = 'esofil'

Archive identifier

path = PypeItDataPath('/home/docs/checkouts/readthedocs.org/user_builds/pypeit/envs/latest/lib/python3.12/site-packages/pypeit/data/standards/esofil')

Root with data files

class pypeit.core.standard.INGFluxStandard(file, meta=None)[source]

Bases: ArchivedFluxStandard

Container class for an “ing” standard star spectrum.

archive = 'ing'

Archive identifier

path = PypeItDataPath('/home/docs/checkouts/readthedocs.org/user_builds/pypeit/envs/latest/lib/python3.12/site-packages/pypeit/data/standards/ing')

Root with data files

class pypeit.core.standard.KuruczModelStandard(V_mag, spectral_type)[source]

Bases: ModelFluxStandard

The Kurucz stellar model for a given apparent magnitude and spectral type.

The spectrum is instantiated as follows:

  • Get the temperature, logg, and bolometric luminosity from the Schmidt-Kaler (1982) table for the provided spectral type.

  • Find the nearest neighbor in the Kurucz stellar atmosphere ATLAS.

  • Convert the units for the wavelength and flux.

Warning

Spectra can currently only be generated for spectral types provided in the Schmidt-Kaler (1982) table. See here for available spectral types.

Parameters:
  • V_mag (float) – Apparent magnitude of the star in the V band (Vega system).

  • spectral_type (str) – Stellar spectral type

model_type = 'Kurucz'

Identifier for the type of model spectrum.

class pypeit.core.standard.ModelFluxStandard(wave, flux, ivar=None, gpm=None, meta=None)[source]

Bases: Spectrum

Base class for “model-based” flux standard spectra.

classmethod _init_meta(row=None)[source]

Instantiate the metadata.

model_type = None
required_metadata = ['Name', 'File', 'ra_deg', 'dec_deg']
class pypeit.core.standard.NOAOFluxStandard(file, meta=None)[source]

Bases: ArchivedFluxStandard

Container class for an “noao” standard star spectrum.

archive = 'noao'

Archive identifier

path = PypeItDataPath('/home/docs/checkouts/readthedocs.org/user_builds/pypeit/envs/latest/lib/python3.12/site-packages/pypeit/data/standards/noao')

Root with data files

class pypeit.core.standard.PhoenixStandard(V_mag)[source]

Bases: ModelFluxStandard

Provides the PHOENIX spectrum.

Parameters:

V_mag (float) – The V-band magnitude for the star.

model_type = 'PHOENIX'

Identifier for the type of model spectrum.

class pypeit.core.standard.PseudoStandard(wave=None)[source]

Bases: ModelFluxStandard

Provides a unity continuum spectrum.

Parameters:

wave (array-like, optional) – The wavelength array to use. If None, wavelengths range from 0.2-5 micron in steps of 1 Angstrom.

model_type = 'pseudo'

Identifier for the type of model spectrum.

class pypeit.core.standard.VegaStandard(V_mag)[source]

Bases: ModelFluxStandard

Provides a Vega spectrum from TSpecTool.

Parameters:

V_mag (float) – The V-band magnitude for the star.

model_type = 'Vega'

Identifier for the type of model spectrum.

class pypeit.core.standard.XShooterFluxStandard(file, meta=None)[source]

Bases: ArchivedFluxStandard

Container class for an “xshooter” standard star spectrum.

archive = 'xshooter'

Archive identifier

path = PypeItDataPath('/home/docs/checkouts/readthedocs.org/user_builds/pypeit/envs/latest/lib/python3.12/site-packages/pypeit/data/standards/xshooter')

Root with data files

pypeit.core.standard.archive_entry(archive, name)[source]

Find the row of data in the specified archive associated with the named source.

Parameters:
  • archive (str) – Name of the archive to search; see get_archive_sets(). This function also works for archive=’blackbody’.

  • name (str) – The name of the archive source. Must be an exact match.

Returns:

Single table row with the data from the archive.

Return type:

astropy.table.Row

pypeit.core.standard.archived_flux_classes()[source]

Construct a dictionary with the set of classes that subclass from ArchivedFluxStandard.

Returns:

Dictionary with keys that identify the archive name and class.

Return type:

dict

pypeit.core.standard.get_archive_sets(archives=['xshooter', 'calspec', 'esofil', 'noao', 'ing'])[source]

Helper function to setup the prioritized list of archive sets to search through when matching a set of coordinates to a file containing the flux standard data.

Parameters:

archives (array-like, str, optional) – Name of the archives to search, in a prioritized order. If None, all archives are searched.

Returns:

The list of standard sets to search

Return type:

numpy.ndarray

Raises:

PypeItError – Raised if none of the provided sets are recognized.

pypeit.core.standard.get_archive_standard(ra, dec, tol=20.0, unit=None, archives='default', check=False)[source]

Attempt to find and return an archive flux calibration spectrum that is closest to the provided coordinates.

The archives searched always start with the empirical archives (see get_archive_standard()). If no archive match is found, the function attempts (unless explicitly excluded via the archives argument) to find a suitable set of blackbody parameters; see BlackbodyStandard.

Parameters:
  • ra (float, str) – On-sky coordinates. If units are None, the coordinates are assumed to be in degree if provided as floats, and they are assumed to be in hours and degrees if provided as (e.g., sexagesimal) strings.

  • dec (float, str) – On-sky coordinates. If units are None, the coordinates are assumed to be in degree if provided as floats, and they are assumed to be in hours and degrees if provided as (e.g., sexagesimal) strings.

  • tol (float, optional) – Tolerance for coordinate matching in arcmin

  • unit (str, tuple, optional) – Units for the on-sky coordinates. See ra and dec for the default behavior.

  • archives (array-like, str, optional) – Name of the archives to search, in a prioritized order. If 'default', all archives are searched. To only search for suitable blackbody parameters, set archives='blackbody'.

  • check (bool, optional) – Only check if a standard matches the provided coordinates, as opposed to also reading the spectral data.

Returns:

If check is True, a flag is returned indicating if a standard matches the provided coordinates. Otherwise, the standard spectrum is returned.

Return type:

spectrum.Spectrum, bool

pypeit.core.standard.get_model_standard(spectral_type, V_mag)[source]

Return a model flux standard based on the spectral type and V-band magnitude.

The models returned are as follows:

If spectral type is:

  • “A0”: the TSpecTool spectrum of Vega is returned (see VegaStandard);

  • “PHOENIX”: a PHOENIX model of a Teff = 10k, log(g) = 4. star is returned (see PhoenixStandard);

  • “NONE”: A constant unity spectrum is returned (see PseudoStandard);

  • otherwise, a Kurucz model is returned (see KuruczModelStandard).

Parameters:
  • spectral_type (str) – The spectral type of the star or the signifier of the spectrum to use. See above.

  • V_mag (float) – The V-band magnitude for the star.

Returns:

The standard spectrum.

Return type:

spectrum.Spectrum

pypeit.core.standard.get_standard_spectrum(spectral_type=None, V_mag=None, ra=None, dec=None, tol=20.0, unit=None, archives='default')[source]

Return a standard spectrum.

Must provide either the spectral type and the magnitude (for use with get_model_standard()) or a set of on-sky coordinates (for use with get_archive_standard()). If all four are provided, the spectral type and magnitude take precedence.

Parameters:
  • spectral_type (str, optional) – The spectral type of the star or the signifier of the spectrum to use. See get_model_standard().

  • V_mag (float, optional) – The V-band magnitude for the star.

  • ra (float, str) – On-sky coordinates. If units are None, the coordinates are assumed to be in degree if provided as floats, and they are assumed to be in hours and degrees if provided as (e.g., sexagesimal) strings.

  • dec (float, str) – On-sky coordinates. If units are None, the coordinates are assumed to be in degree if provided as floats, and they are assumed to be in hours and degrees if provided as (e.g., sexagesimal) strings.

  • tol (float, optional) – Tolerance for coordinate matching in arcmin

  • unit (str, tuple, optional) – Units for the on-sky coordinates. See ra and dec for the default behavior.

  • archives (array-like, str, optional) – Name of the archives to search, in a prioritized order. If 'default', all archives are searched.

Returns:

Standard star spectrum

Return type:

spectrum.Spectrum

pypeit.core.standard.mAB_to_cgs(wave, mAB)[source]

Convert AB magnitudes to \(F_\lambda\) in the cgs units \({\rm erg/cm}^2{\rm/s}/\AA\).

Parameters:
  • wave (scalar-like, array-like) – Vacuum Wavelength in Angstrom.

  • mAB (scalar-like, array-like) – AB magnitudes. If array-like, must be possible to broadcast to match wave.

Returns:

Flux density in cgs units. Returned as scalar or array depending on input.

Return type:

float, numpy.ndarray

pypeit.core.standard.nearest_archive_entry(archive, ra, dec, unit=None)[source]

Find the row of data in the specified archive with coordinates nearest to the provided coordinates.

Parameters:
  • archive (str) – Name of the archive to search; see get_archive_sets(). This function also works for archive=’blackbody’.

  • ra (float, str) – On-sky coordinates. If units are None, the coordinates are assumed to be in degree if provided as floats, and they are assumed to be in hours and degrees if provided as (e.g., sexagesimal) strings.

  • dec (float, str) – On-sky coordinates. If units are None, the coordinates are assumed to be in degree if provided as floats, and they are assumed to be in hours and degrees if provided as (e.g., sexagesimal) strings.

  • unit (str, tuple, optional) – Units for the on-sky coordinates. See ra and dec for the default behavior.

Returns:

  • float – Separation between the nearest standard star and the provided coordinates.

  • astropy.table.Row – Single table row with the data from the archive.