Calibrator
calibrator.py
Module for the calibrator functionality.
- calibrate(input_object, sampling=None, truncation=False, output_path='.', output_file='output_spectra', output_format=None, save_file=True, username=None, password=None)[source]
Calibration utility: calibrates the input internally-calibrated continuously-represented mean spectra to the absolute system. An absolute spectrum sampled on a user-defined or default wavelength grid is created for each set of BP and RP input spectra. If either band is missing, the output spectrum will only cover the range covered by the available data.
- Parameters
input_object (object) – Path to the file containing the mean spectra as downloaded from the archive in their continuous representation, a list of sources ids (string or long), or a pandas DataFrame.
sampling (ndarray) – 1D array containing the desired sampling in absolute wavelengths [nm].
truncation (bool) – Toggle truncation of the set of bases. The level of truncation to be applied is defined by the recommended value in the input files.
output_path (str) – Path where to save the output data.
output_file (str) – Name of the output file.
output_format (str) – Format to be used for the output file. If no format is given, then the output file will be in the same format as the input file.
save_file (bool) – Whether to save the output in a file. If false, output_format and output_file are ignored.
username (str) – Cosmos username, only suggested when input_object is a list or ADQL query.
password (str) – Cosmos password, only suggested when input_object is a list or ADQL query.
- Returns
tuple containing:
DataFrame: The values for all sampled absolute spectra. ndarray: The sampling used to calibrate the input spectra (user-provided or default).
- Return type
(tuple)
external_instrument_model.py
Module for handling the various components of the external calibration instrument model. These are dispersion function, instrument response and set of inverse bases.
- class ExternalInstrumentModel(dispersion, response, bases)[source]
Bases:
objectExternal calibration instrument model.
- classmethod from_config_csv(dispersion_path, response_path, bases_path)[source]
Create an external calibration instrument model from the input configuration files.
- Parameters
dispersion_path (str) – Path to the configuration file containing the dispersion.
response_path (str) – Path to the configuration file containing the response.
bases_path (str) – Path to the configuration file containing the inverse bases.
- Returns
An external calibration instrument model object.
- Return type
obj