Spectrum

absolute_sampled_spectrum.py

Module to represent an absolute sampled spectrum.

class AbsoluteSampledSpectrum(source_id, xp_spectra, sampled_bases, merge, truncation=None)[source]

Bases: SampledSpectrum

A spectrum calibrated onto the absolute system of wavelength and flux. The spectrum is represented by a set of discrete measurements or samples.

generic_spectrum.py

Module to represent a generic spectrum.

class Spectrum(source_id)[source]

Bases: object

Base spectrum. Contain only the source ID.

get_source_id()[source]

Get the source ID of the spectrum.

Returns

Source identifier.

Return type

str

multi_synthetic_photometry.py

Module to represent a synthetic photometry in multiple photometric systems.

class MultiSyntheticPhotometry(photometric_system, photometries)[source]

Bases: object

Synthetic photometry derived from Gaia spectra in multiple photometric systems.

sampled_basis_functions.py

Module to represent a set of basis functions evaluated on a grid.

class SampledBasisFunctions(sampling_grid, design_matrix=None)[source]

Bases: object

Evaluation of a set of basis functions on a user-defined grid.

classmethod from_config(sampling, bases_config)[source]

Instantiate an object starting from a sampling grid and the configuration for the basis functions.

Parameters
  • sampling (ndarray) – 1D array of positions where the bases need to be evaluated.

  • bases_config (DataFrame) – The configuration of the set of bases loaded into a DataFrame.

Returns

An instance of this class.

Return type

object

classmethod from_design_matrix(sampling, design_matrix)[source]

Instantiate an object starting from a sampling grid and the design matrix.

Parameters
  • sampling (ndarray) – 1D array of positions where the bases need to be evaluated.

  • design_matrix (ndarray) – 2D array containing the evaluation of each basis at all positions in the sampling grid.

Returns

An instance of this class.

Return type

object

classmethod from_external_instrument_model(sampling, weights, external_instrument_model)[source]
Instantiate an object starting from a sampling grid, an array of weights and the external calibration instrument

model.

Parameters
  • sampling (ndarray) – 1D array of positions where the bases need to be evaluated.

  • weights (ndarray) – 1D array containing the weights to be applied at each element in the sampling grid. These are simply used to define where in the sampling grid some contribution is expected. Where the weight is 0, the bases will not be evaluated.

  • external_instrument_model (obj) – External calibration instrument model. This object contains information on the dispersion, response and inverse bases.

Returns

An instance of this class.

Return type

object

populate_design_matrix(sampling_grid, config)[source]

Create a design matrix given the internal calibration bases and a user-defined sampling.

Parameters
  • sampling_grid (ndarray) – 1D array of positions where the bases need to be evaluated.

  • config (DataFrame) – The configuration of the set of bases loaded into a DataFrame.

Returns

The resulting design matrix.

Return type

ndarray

sampled_spectrum.py

Module to represent a sampled spectrum.

class SampledSpectrum(source_id, sampling_grid)[source]

Bases: Spectrum

A spectrum defined by a set of discrete measurements. Each measurement is defined by a position in wavelength

(or pseudo-wavelength), a measured flux and an associated flux error. Specific implementations of this class will define the units in use for positions and fluxes.

single_synthetic_photometry.py

Module to represent a synthetic photometry in a single photometric system.

class SingleSyntheticPhotometry(source_id, xp_spectra, sampled_bases, merge, photometric_system)[source]

Bases: AbsoluteSampledSpectrum

Synthetic photometry derived from Gaia spectra in one photometric system.

flux_to_mag(flux, zero_point)[source]

Convert flux to magnitude. :param flux: Flux value. :type flux: float :param zero_point: Photometric zero-point. :type zero_point: float

Returns

The magnitude.

Return type

float

spectral_energy_distribution.py

Module to represent a spectral energy distribution (SED).

class SpectralEnergyDistribution(source_id, wl, flux)[source]

Bases: SampledSpectrum

A spectral energy distribution.

utils.py

Module to hold methods useful for different kinds of spectra.

xp_continuous_spectrum.py

Module to represent a BP/RP continuous spectrum.

class XpContinuousSpectrum(source_id, xp, coefficients, covariance, standard_deviation)[source]

Bases: XpSpectrum

A Gaia BP/RP spectrum represented as a continuous function defined as the sum of a set of bases functions multiplied

by a set of coefficient. This definition is the result of the least squares fit. Covariance and standard deviation for the least square solution are also part of the continuous spectrum definition to allow estimating errors.

classmethod from_data_frame(df, band)[source]

Initialise XP continuous spectrum from a Pandas DataFrame.

Parameters
  • df (DataFrame) – DataFrame containing at least the fields source_id, BAND_n_parameters, BAND_coefficients, BAND_coefficient_correlations, BAND_standard_deviation, where BAND is either ‘bp’ or ‘rp’. The same structure as used in the archive for the correlation matrix is expected.

  • band (str) – Gaia photometer, can be either ‘bp’ or ‘rp’.

get_coefficients()[source]

Get the coefficients associated with the spectrum.

Returns

The 1D array of the coefficients multiplying the basis functions.

Return type

ndarray

get_covariance()[source]

Get the covariance associated with the spectrum.

Returns

The 2D array of the covariance matrix.

Return type

ndarray

get_standard_deviation()[source]

Get the standard deviation associated with the spectrum.

Returns

The standard deviation of the least squares solution.

Return type

float

xp_sampled_spectrum.py

Module to represent a BP/RP sampled spectrum.

class XpSampledSpectrum(source_id=0, xp=None, pos=None, flux=None, flux_error=None)[source]

Bases: XpSpectrum, SampledSpectrum

A Gaia BP/RP spectrum sampled to a given grid of positions.

classmethod from_continuous(continuous_spectrum, sampled_basis_functions, truncation=-1)[source]

Initialise a spectrum.

Parameters
  • continuous_spectrum (object) – The continuous representation of this spectrum.

  • sampled_basis_functions (object) – The set of basis functions sampled onto the grid defining the resolution of the final sampled spectrum.

  • truncation (int) – Number of bases to be used for this spectrum. The set of bases functions used for the continuous representation of the spectra has been optimised to ensure that the first bases are the ones that contribute most. In many cases, the last bases contribution will be below the noise. Truncation of the basis function set to preserve only the significant bases is optional. By default, no truncation will be applied, i.e. all bases will be used.

classmethod from_sampled(source_id, xp, pos, flux, flux_error)[source]

Initialise a spectrum.

Parameters
  • source_id (long) – The source identifier.

  • xp (object) – The photometer enum (BP/RP).

  • pos (ndarray) – The array of positions (in pseudo-wavelength or wavelength) of the samples.

  • flux (ndarray) – The flux value of each sample.

  • flux_error (ndarray) – The uncertainty on the flux value of each sample.

xp_spectrum.py

Module to represent a BP/RP spectrum.

class XpSpectrum(source_id, xp)[source]

Bases: Spectrum

A spectrum observed with one of the Gaia low-resolution photometers (Blue or Red Photometer, BP or RP).

get_xp()[source]

Get band.

Returns

Photometer identifier. Either ‘bp’ or ‘rp’.

Return type

str