StubTranslator

class astro_metadata_translator.StubTranslator(header)

Bases: astro_metadata_translator.MetadataTranslator

Translator where all the translations are stubbed out and issue warnings.

This translator can be used as a base class whilst developing a new translator. It allows testing to proceed without being required to fully define all translation methods. Once complete the class should be removed from the inheritance tree.

Attributes Summary

supported_instrument
translators

Methods Summary

can_translate(header) Indicate whether this translation class can translate the supplied header.
cards_used() Cards used during metadata extraction.
determine_translator(header) Determine a translation class by examining the header
quantity_from_card(keywords, unit[, …]) Calculate a Astropy Quantity from a header card and a unit.
to_altaz_begin() Unimplemented translator for altaz_begin.
to_boresight_airmass() Unimplemented translator for boresight_airmass.
to_boresight_rotation_angle() Unimplemented translator for boresight_rotation_angle.
to_boresight_rotation_coord() Unimplemented translator for boresight_rotation_coord.
to_dark_time() Unimplemented translator for dark_time.
to_datetime_begin() Unimplemented translator for datetime_begin.
to_datetime_end() Unimplemented translator for datetime_end.
to_detector_exposure_id() Unimplemented translator for detector_exposure_id.
to_detector_name() Unimplemented translator for detector_name.
to_detector_num() Unimplemented translator for detector_num.
to_exposure_id() Unimplemented translator for exposure_id.
to_exposure_time() Unimplemented translator for exposure_time.
to_instrument() Unimplemented translator for instrument.
to_location() Unimplemented translator for location.
to_object() Unimplemented translator for object.
to_observation_id() Unimplemented translator for observation_id.
to_observation_type() Unimplemented translator for observation_type.
to_physical_filter() Unimplemented translator for physical_filter.
to_pressure() Unimplemented translator for pressure.
to_relative_humidity() Unimplemented translator for relative_humidity.
to_science_program() Unimplemented translator for science_program.
to_telescope() Unimplemented translator for telescope.
to_temperature() Unimplemented translator for temperature.
to_tracking_radec() Unimplemented translator for tracking_radec.
to_visit_id() Unimplemented translator for visit_id.
validate_value(value, default[, minimum, …]) Validate the supplied value, returning a new value if out of range

Attributes Documentation

supported_instrument = None
translators = {'DECam': <class 'astro_metadata_translator.translators.decam.DecamTranslator'>, 'HSC': <class 'astro_metadata_translator.translators.hsc.HscTranslator'>, 'MegaPrime': <class 'astro_metadata_translator.translators.megaprime.MegaPrimeTranslator'>, 'SuprimeCam': <class 'astro_metadata_translator.translators.suprimecam.SuprimeCamTranslator'>}

Methods Documentation

classmethod can_translate(header)

Indicate whether this translation class can translate the supplied header.

Parameters:
header : dict-like

Header to convert to standardized form.

Returns:
can : bool

True if the header is recognized by this class. False otherwise.

cards_used()

Cards used during metadata extraction.

Returns:
used : frozenset of str

Cards used when extracting metadata.

classmethod determine_translator(header)

Determine a translation class by examining the header

Parameters:
header : dict-like

Representation of a header.

Returns:
translator : MetadataTranslator

Translation class that knows how to extract metadata from the supplied header.

Raises:
ValueError

None of the registered translation classes understood the supplied header.

quantity_from_card(keywords, unit, default=None, minimum=None, maximum=None)

Calculate a Astropy Quantity from a header card and a unit.

Parameters:
keywords : str or list of str

Keyword to use from header. If a list each keyword will be tried in turn until one matches.

unit : astropy.units.UnitBase

Unit of the item in the header.

default : float, optional

Default value to use if the header value is invalid. Assumed to be in the same units as the value expected in the header. If None, no default value is used.

minimum : float

Minimum possible valid value, optional. If the calculated value is below this value, the default value will be used.

maximum : float

Maximum possible valid value, optional. If the calculated value is above this value, the default value will be used.

Returns:
q : astropy.units.Quantity

Quantity representing the header value.

Raises:
KeyError

The supplied header key is not present.

to_altaz_begin()

Unimplemented translator for altaz_begin.

Telescope boresight azimuth and elevation at start of observation.

Issues a warning reminding the implementer to override this method.

Returns:
altaz_begin : None

Always returns None.

to_boresight_airmass()

Unimplemented translator for boresight_airmass.

Airmass of the boresight of the telescope.

Issues a warning reminding the implementer to override this method.

Returns:
boresight_airmass : None

Always returns None.

to_boresight_rotation_angle()

Unimplemented translator for boresight_rotation_angle.

Angle of the instrument in boresight_rotation_coord frame.

Issues a warning reminding the implementer to override this method.

Returns:
boresight_rotation_angle : None

Always returns None.

to_boresight_rotation_coord()

Unimplemented translator for boresight_rotation_coord.

Coordinate frame of the instrument rotation angle (options: sky, unknown).

Issues a warning reminding the implementer to override this method.

Returns:
boresight_rotation_coord : None

Always returns None.

to_dark_time()

Unimplemented translator for dark_time.

Duration of the exposure with shutter closed (seconds).

Issues a warning reminding the implementer to override this method.

Returns:
dark_time : None

Always returns None.

to_datetime_begin()

Unimplemented translator for datetime_begin.

Time of the start of the observation.

Issues a warning reminding the implementer to override this method.

Returns:
datetime_begin : None

Always returns None.

to_datetime_end()

Unimplemented translator for datetime_end.

Time of the end of the observation.

Issues a warning reminding the implementer to override this method.

Returns:
datetime_end : None

Always returns None.

to_detector_exposure_id()

Unimplemented translator for detector_exposure_id.

Unique integer identifier for this detector in this exposure.

Issues a warning reminding the implementer to override this method.

Returns:
detector_exposure_id : None

Always returns None.

to_detector_name()

Unimplemented translator for detector_name.

Name of the detector within the instrument (might not be unique).

Issues a warning reminding the implementer to override this method.

Returns:
detector_name : None

Always returns None.

to_detector_num()

Unimplemented translator for detector_num.

Unique (for instrument) integer identifier for the sensor.

Issues a warning reminding the implementer to override this method.

Returns:
detector_num : None

Always returns None.

to_exposure_id()

Unimplemented translator for exposure_id.

Unique (with instrument) integer identifier for this observation.

Issues a warning reminding the implementer to override this method.

Returns:
exposure_id : None

Always returns None.

to_exposure_time()

Unimplemented translator for exposure_time.

Duration of the exposure with shutter open (seconds).

Issues a warning reminding the implementer to override this method.

Returns:
exposure_time : None

Always returns None.

to_instrument()

Unimplemented translator for instrument.

The instrument used to observe the exposure.

Issues a warning reminding the implementer to override this method.

Returns:
instrument : None

Always returns None.

to_location()

Unimplemented translator for location.

Location of the observatory.

Issues a warning reminding the implementer to override this method.

Returns:
location : None

Always returns None.

to_object()

Unimplemented translator for object.

Object of interest or field name.

Issues a warning reminding the implementer to override this method.

Returns:
object : None

Always returns None.

to_observation_id()

Unimplemented translator for observation_id.

Label uniquely identifying this observation (can be related to ‘exposure_id’).

Issues a warning reminding the implementer to override this method.

Returns:
observation_id : None

Always returns None.

to_observation_type()

Unimplemented translator for observation_type.

Type of observation (currently: science, dark, flat, bias, focus).

Issues a warning reminding the implementer to override this method.

Returns:
observation_type : None

Always returns None.

to_physical_filter()

Unimplemented translator for physical_filter.

The bandpass filter used for this observation.

Issues a warning reminding the implementer to override this method.

Returns:
physical_filter : None

Always returns None.

to_pressure()

Unimplemented translator for pressure.

Atmospheric pressure outside the dome.

Issues a warning reminding the implementer to override this method.

Returns:
pressure : None

Always returns None.

to_relative_humidity()

Unimplemented translator for relative_humidity.

Relative humidity outside the dome.

Issues a warning reminding the implementer to override this method.

Returns:
relative_humidity : None

Always returns None.

to_science_program()

Unimplemented translator for science_program.

Observing program (survey or proposal) identifier.

Issues a warning reminding the implementer to override this method.

Returns:
science_program : None

Always returns None.

to_telescope()

Unimplemented translator for telescope.

Full name of the telescope.

Issues a warning reminding the implementer to override this method.

Returns:
telescope : None

Always returns None.

to_temperature()

Unimplemented translator for temperature.

Temperature outside the dome.

Issues a warning reminding the implementer to override this method.

Returns:
temperature : None

Always returns None.

to_tracking_radec()

Unimplemented translator for tracking_radec.

Requested RA/Dec to track.

Issues a warning reminding the implementer to override this method.

Returns:
tracking_radec : None

Always returns None.

to_visit_id()

Unimplemented translator for visit_id.

ID of the Visit this Exposure is associated with.

Science observations should essentially always be associated with a visit, but calibration observations may not be.

Issues a warning reminding the implementer to override this method.
Returns:
visit_id : None

Always returns None.

static validate_value(value, default, minimum=None, maximum=None)

Validate the supplied value, returning a new value if out of range

Parameters:
value : float

Value to be validated.

default : float

Default value to use if supplied value is invalid or out of range. Assumed to be in the same units as the value expected in the header.

minimum : float

Minimum possible valid value, optional. If the calculated value is below this value, the default value will be used.

maximum : float

Maximum possible valid value, optional. If the calculated value is above this value, the default value will be used.

Returns:
value : float

Either the supplied value, or a default value.