lephare.filterSvc
Exceptions
The SVO filter service could not be reached, or gave an unusable answer. |
Classes
Filter service for retrieving filters from various sources. |
Module Contents
Bases:
ConnectionErrorThe SVO filter service could not be reached, or gave an unusable answer.
The service is sometimes down, so callers which can do without it (tests, notebooks) can catch this exception and fall back on local filters.
- class FilterSvc[source]
Filter service for retrieving filters from various sources.
This class defines a number of methods for loading and manipulating filters.
- classmethod from_yaml(yaml_file)[source]
Load filter from a yaml file
- Parameters:
yaml_file (str) – Path to yaml file
- Returns:
flt_array – Array of wavelengths in Angstrom and filter transmissivity.
- Return type:
list of lephare.flt
- Raises:
SVOUnavailableError – If a filter is requested to the SVO (“svo:” prefix) and the server cannot be reached.
- classmethod from_config(config_file)[source]
Load filter from a .para config file
- Parameters:
config_file (str) – Path to config file
- Returns:
flt_array – List of filters.
- Return type:
list of lephare.flt
- classmethod from_svo(counter, filter_id, system='AB', calib=0)[source]
Return filter from SVO
- Parameters:
counter (int) – Filter number
filter_id (str) – Id of filter in SVO format.
system (str, optional) – Photometric system
calib (float, optional) – Calibration value. Not currently used.
- Returns:
res – Filter in native lephare format.
- Return type:
lephare.flt
- Raises:
SVOUnavailableError – If the SVO server cannot be reached or does not give a valid answer.
- classmethod from_file(filename, counter=-1, trans=0, calib=0)[source]
Return filter from SVO
- Parameters:
filename (str) – Path to filter file.
counter (int) – Filter number
trans (int, optional) – Photometric system.
calib (int, optional) – Calibration value.
- Returns:
f – Filter in native lephare format.
- Return type:
lephare.flt
- classmethod svo_request(counter, filter_id, system)[source]
Retrieve a filter from the SVO
- Parameters:
counter (int) – Filter number
filter_id (str) – Id of filter in SVO format.
system (str, optional) – Photometric system
- Returns:
res – Filter in native lephare format.
- Return type:
lephare.flt
- Raises:
SVOUnavailableError – If the SVO server cannot be reached or does not give a valid answer.
AssertionError – If the SVO reports an invalid
filter_id.