ObservationInfo

class astro_metadata_translator.ObservationInfo(header: Optional[MutableMapping[str, Any]], filename: Optional[str] = None, translator_class: Optional[Type[MetadataTranslator]] = None, pedantic: bool = False, search_path: Optional[Sequence[str]] = None, required: Optional[Set[str]] = None, subset: Optional[Set[str]] = None)

Bases: object

Standardized representation of an instrument header for a single exposure observation.

There is a core set of instrumental properties that are pre-defined. Additional properties may be defined, either through the makeObservationInfo factory function by providing the extensions definitions, or through the regular ObservationInfo constructor when the extensions have been defined in the MetadataTranslator for the instrument of interest (or in the provided translator_class).

Parameters:
headerdict-like

Representation of an instrument header accessible as a dict. May be updated with header corrections if corrections are found.

filenamestr, optional

Name of the file whose header is being translated. For some datasets with missing header information this can sometimes allow for some fixups in translations.

translator_classMetadataTranslator-class, optional

If not None, the class to use to translate the supplied headers into standard form. Otherwise each registered translator class will be asked in turn if it knows how to translate the supplied header.

pedanticbool, optional

If True the translation must succeed for all properties. If False individual property translations must all be implemented but can fail and a warning will be issued.

search_pathiterable, optional

Override search paths to use during header fix up.

requiredset, optional

This parameter can be used to confirm that all properties contained in the set must translate correctly and also be non-None. For the case where pedantic is True this will still check that the resulting value is not None.

subsetset, optional

If not None, controls the translations that will be performed during construction. This can be useful if the caller is only interested in a subset of the properties and knows that some of the others might be slow to compute (for example the airmass if it has to be derived).

Raises:
ValueError

Raised if the supplied header was not recognized by any of the registered translators. Also raised if the request property subset is not a subset of the known properties.

TypeError

Raised if the supplied translator class was not a MetadataTranslator.

KeyError

Raised if a required property cannot be calculated, or if pedantic mode is enabled and any translations fails.

NotImplementedError

Raised if the selected translator does not support a required property.

Notes

Headers will be corrected if correction files are located and this will modify the header provided to the constructor.

Values of the properties are read-only.

Attributes Summary

altaz_begin

Telescope boresight azimuth and elevation at start of observation.

boresight_airmass

Airmass of the boresight of the telescope.

boresight_rotation_angle

Angle of the instrument in boresight_rotation_coord frame.

boresight_rotation_coord

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

cards_used

Header cards used for the translation.

dark_time

Duration of the exposure with shutter closed (seconds).

datetime_begin

Time of the start of the observation.

datetime_end

Time of the end of the observation.

detector_exposure_id

Unique integer identifier for this detector in this exposure.

detector_group

Collection name of which this detector is a part.

detector_name

Name of the detector within the instrument (might not be unique if there are detector groups).

detector_num

Unique (for instrument) integer identifier for the sensor.

detector_serial

Serial number/string associated with this detector.

detector_unique_name

Unique name of the detector within the focal plane, generally combining detector_group with detector_name.

exposure_group

Label to use to associate this exposure with others (can be related to 'exposure_id').

exposure_id

Unique (with instrument) integer identifier for this observation.

exposure_time

Duration of the exposure with shutter open (seconds).

focus_z

Defocal distance.

group_counter_end

Observation counter for the end of the exposure group.

group_counter_start

Observation counter for the start of the exposure group.Depending on the instrument the relevant group may be visit_id or exposure_group.

has_simulated_content

Boolean indicating whether any part of this observation was simulated.

instrument

The instrument used to observe the exposure.

location

Location of the observatory.

object

Object of interest or field name.

observation_counter

Counter of this observation.

observation_id

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

observation_reason

Reason this observation was taken, or its purpose ('science' and 'calibration' are common values)

observation_type

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

observing_day

Integer in YYYYMMDD format corresponding to the day of observation.

physical_filter

The bandpass filter used for this observation.

pressure

Atmospheric pressure outside the dome.

relative_humidity

Relative humidity outside the dome.

science_program

Observing program (survey or proposal) identifier.

telescope

Full name of the telescope.

temperature

Temperature outside the dome.

tracking_radec

Requested RA/Dec to track.

visit_id

ID of the Visit this Exposure is associated with.

Methods Summary

from_json(json_str)

Create ObservationInfo from JSON string.

from_simple(simple)

Convert the entity returned by to_simple back into an ObservationInfo.

makeObservationInfo(*[, extensions])

Construct an ObservationInfo from the supplied parameters.

stripped_header()

Return a copy of the supplied header with used keywords removed.

to_json()

Serialize the object to JSON string.

to_simple()

Convert the contents of this object to simple dict form.

Attributes Documentation

altaz_begin: astropy.coordinates.builtin_frames.AltAz

Telescope boresight azimuth and elevation at start of observation.

Returns:
altaz_beginastropy.coordinates.AltAz

Access the property.

boresight_airmass: float

Airmass of the boresight of the telescope.

Returns:
boresight_airmassfloat

Access the property.

boresight_rotation_angle: Quantity

Angle of the instrument in boresight_rotation_coord frame.

Returns:
boresight_rotation_angleastropy.coordinates.Angle

Access the property.

boresight_rotation_coord: str

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

Returns:
boresight_rotation_coordstr

Access the property.

cards_used

Header cards used for the translation.

Returns:
usedfrozenset of str

Set of card used.

dark_time: Quantity

Duration of the exposure with shutter closed (seconds).

Returns:
dark_timeastropy.units.Quantity

Access the property.

datetime_begin: astropy.time.Time

Time of the start of the observation.

Returns:
datetime_beginastropy.time.Time

Access the property.

datetime_end: astropy.time.Time

Time of the end of the observation.

Returns:
datetime_endastropy.time.Time

Access the property.

detector_exposure_id: int

Unique integer identifier for this detector in this exposure.

Returns:
detector_exposure_idint

Access the property.

detector_group: str

Collection name of which this detector is a part. Can be None if there are no detector groupings.

Returns:
detector_groupstr

Access the property.

detector_name: str

Name of the detector within the instrument (might not be unique if there are detector groups).

Returns:
detector_namestr

Access the property.

detector_num: int

Unique (for instrument) integer identifier for the sensor.

Returns:
detector_numint

Access the property.

detector_serial: str

Serial number/string associated with this detector.

Returns:
detector_serialstr

Access the property.

detector_unique_name

Unique name of the detector within the focal plane, generally combining detector_group with detector_name.

Returns:
detector_unique_namestr

Access the property.

exposure_group: str

Label to use to associate this exposure with others (can be related to ‘exposure_id’).

Returns:
exposure_groupstr

Access the property.

exposure_id: int

Unique (with instrument) integer identifier for this observation.

Returns:
exposure_idint

Access the property.

exposure_time: Quantity

Duration of the exposure with shutter open (seconds).

Returns:
exposure_timeastropy.units.Quantity

Access the property.

focus_z: Quantity

Defocal distance.

Returns:
focus_zastropy.units.Quantity

Access the property.

group_counter_end: int

Observation counter for the end of the exposure group. Depending on the instrument the relevant group may be visit_id or exposure_group.

Returns:
group_counter_endint

Access the property.

group_counter_start: int

Observation counter for the start of the exposure group.Depending on the instrument the relevant group may be visit_id or exposure_group.

Returns:
group_counter_startint

Access the property.

has_simulated_content: bool

Boolean indicating whether any part of this observation was simulated.

Returns:
has_simulated_contentbool

Access the property.

instrument: str

The instrument used to observe the exposure.

Returns:
instrumentstr

Access the property.

location: astropy.coordinates.EarthLocation

Location of the observatory.

Returns:
locationastropy.coordinates.EarthLocation

Access the property.

object: str

Object of interest or field name.

Returns:
objectstr

Access the property.

observation_counter: int

Counter of this observation. Can be counter within observing_day or a global counter. Likely to be observatory specific.

Returns:
observation_counterint

Access the property.

observation_id: str

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

Returns:
observation_idstr

Access the property.

observation_reason: str

Reason this observation was taken, or its purpose (‘science’ and ‘calibration’ are common values)

Returns:
observation_reasonstr

Access the property.

observation_type: str

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

Returns:
observation_typestr

Access the property.

observing_day: int

Integer in YYYYMMDD format corresponding to the day of observation.

Returns:
observing_dayint

Access the property.

physical_filter: str

The bandpass filter used for this observation.

Returns:
physical_filterstr

Access the property.

pressure: Quantity

Atmospheric pressure outside the dome.

Returns:
pressureastropy.units.Quantity

Access the property.

relative_humidity: float

Relative humidity outside the dome.

Returns:
relative_humidityfloat

Access the property.

science_program: str

Observing program (survey or proposal) identifier.

Returns:
science_programstr

Access the property.

telescope: int

Full name of the telescope.

Returns:
telescopestr

Access the property.

temperature: Quantity

Temperature outside the dome.

Returns:
temperatureastropy.units.Quantity

Access the property.

tracking_radec: astropy.coordinates.SkyCoord

Requested RA/Dec to track.

Returns:
tracking_radecastropy.coordinates.SkyCoord

Access the property.

visit_id: int

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.

Returns:
visit_idint

Access the property.

Methods Documentation

classmethod from_json(json_str: str) ObservationInfo

Create ObservationInfo from JSON string.

Parameters:
json_strstr

The JSON representation.

Returns:
obsinfoObservationInfo

Reconstructed object.

Notes

Round-tripping of extension properties requires that the ObservationInfo was created with the help of a registered MetadataTranslator (which contains the extension property definitions).

classmethod from_simple(simple: MutableMapping[str, Any]) ObservationInfo

Convert the entity returned by to_simple back into an ObservationInfo.

Parameters:
simpledict [str, Any]

The dict returned by to_simple()

Returns:
obsinfoObservationInfo

New object constructed from the dict.

Notes

Round-tripping of extension properties requires that the ObservationInfo was created with the help of a registered MetadataTranslator (which contains the extension property definitions).

classmethod makeObservationInfo(*, extensions: Optional[Dict[str, PropertyDefinition]] = None, **kwargs: Any) ObservationInfo

Construct an ObservationInfo from the supplied parameters.

Parameters:
extensionsdict [str: PropertyDefinition], optional

Optional extension definitions, indexed by extension name (without the ext_ prefix, which will be added by ObservationInfo).

**kwargs

Name-value pairs for any properties to be set. In the case of extension properties, the names should include the ext_ prefix.

Raises:
KeyError

Raised if a supplied parameter key is not a known property.

TypeError

Raised if a supplied value does not match the expected type of the property.

Notes

The supplied parameters should use names matching the property. The type of the supplied value will be checked against the property. Any properties not supplied will be assigned a value of None.

stripped_header() MutableMapping[str, Any]

Return a copy of the supplied header with used keywords removed.

Returns:
strippeddict-like

Same class as header supplied to constructor, but with the headers used to calculate the generic information removed.

to_json() str

Serialize the object to JSON string.

Returns:
jstr

The properties of the ObservationInfo in JSON string form.

Notes

Round-tripping of extension properties requires that the ObservationInfo was created with the help of a registered MetadataTranslator (which contains the extension property definitions).

to_simple() MutableMapping[str, Any]

Convert the contents of this object to simple dict form.

The keys of the dict are the standard properties but the values can be simplified to support JSON serialization. For example a SkyCoord might be represented as an ICRS RA/Dec tuple rather than a full SkyCoord representation.

Any properties with None value will be skipped.

Can be converted back to an ObservationInfo using from_simple().

Returns:
simpledict of [str, Any]

Simple dict of all properties.

Notes

Round-tripping of extension properties requires that the ObservationInfo was created with the help of a registered MetadataTranslator (which contains the extension property definitions).