ObservationInfo¶
- class astro_metadata_translator.ObservationInfo(header: MutableMapping[str, Any] | None, filename: str | None = None, translator_class: type[astro_metadata_translator.translator.MetadataTranslator] | None = None, pedantic: bool = False, search_path: Sequence[str] | None = None, required: set[str] | None = None, subset: set[str] | None = 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 theextensions
definitions, or through the regularObservationInfo
constructor when the extensions have been defined in theMetadataTranslator
for the instrument of interest (or in the providedtranslator_class
).- Parameters:
- header
dict
-like Representation of an instrument header accessible as a
dict
. May be updated with header corrections if corrections are found.- filename
str
, 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_class
MetadataTranslator
-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.- pedantic
bool
, 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.
- required
set
, 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
isTrue
this will still check that the resulting value is notNone
.- subset
set
, 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).
- header
- 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
Telescope boresight azimuth and elevation at start of observation.
Airmass of the boresight of the telescope.
Angle of the instrument in boresight_rotation_coord frame.
Coordinate frame of the instrument rotation angle (options: sky, unknown).
True if the observation is looking at sky, False if it is definitely not looking at the sky.
Header cards used for the translation.
Duration of the exposure with shutter closed (seconds).
Time of the start of the observation.
Time of the end of the observation.
Unique integer identifier for this detector in this exposure.
Collection name of which this detector is a part.
Name of the detector within the instrument (might not be unique if there are detector groups).
Unique (for instrument) integer identifier for the sensor.
Serial number/string associated with this detector.
Unique name of the detector within the focal plane, generally combining detector_group with detector_name.
Label to use to associate this exposure with others (can be related to 'exposure_id').
Unique (with instrument) integer identifier for this observation.
Duration of the exposure with shutter open (seconds).
Defocal distance.
Observation counter for the end of the exposure group.
Observation counter for the start of the exposure group.Depending on the instrument the relevant group may be visit_id or exposure_group.
Boolean indicating whether any part of this observation was simulated.
The instrument used to observe the exposure.
Location of the observatory.
Object of interest or field name.
Counter of this observation.
Label uniquely identifying this observation (can be related to 'exposure_id').
Reason this observation was taken, or its purpose ('science' and 'calibration' are common values)
Type of observation (currently: science, dark, flat, bias, focus).
Integer in YYYYMMDD format corresponding to the day of observation.
Offset to subtract from an observation date when calculating the observing day.
The bandpass filter used for this observation.
Atmospheric pressure outside the dome.
Relative humidity outside the dome.
Observing program (survey or proposal) identifier.
Full name of the telescope.
Temperature outside the dome.
Requested RA/Dec to track.
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 anObservationInfo
.makeObservationInfo
(*[, extensions])Construct an
ObservationInfo
from the supplied parameters.Return a copy of the supplied header with used keywords removed.
to_json
()Serialize the object to JSON string.
Convert the contents of this object to simple dict form.
Attributes Documentation
- altaz_begin: AltAz¶
Telescope boresight azimuth and elevation at start of observation.
- Returns:
- altaz_begin
astropy.coordinates.AltAz
Access the property.
- altaz_begin
- boresight_airmass: float¶
Airmass of the boresight of the telescope.
- Returns:
- boresight_airmass
float
Access the property.
- boresight_airmass
- boresight_rotation_angle: Quantity¶
Angle of the instrument in boresight_rotation_coord frame.
- Returns:
- boresight_rotation_angle
astropy.coordinates.Angle
Access the property.
- boresight_rotation_angle
- boresight_rotation_coord: str¶
Coordinate frame of the instrument rotation angle (options: sky, unknown).
- Returns:
- boresight_rotation_coord
str
Access the property.
- boresight_rotation_coord
- can_see_sky¶
True if the observation is looking at sky, False if it is definitely not looking at the sky. None indicates that it is not known whether sky could be seen.
- Returns:
- can_see_sky
bool
Access the property.
- can_see_sky
- dark_time: Quantity¶
Duration of the exposure with shutter closed (seconds).
- Returns:
- dark_time
astropy.units.Quantity
Access the property.
- dark_time
- datetime_begin: Time¶
Time of the start of the observation.
- Returns:
- datetime_begin
astropy.time.Time
Access the property.
- datetime_begin
- datetime_end: Time¶
Time of the end of the observation.
- Returns:
- datetime_end
astropy.time.Time
Access the property.
- datetime_end
- detector_exposure_id: int¶
Unique integer identifier for this detector in this exposure.
- Returns:
- detector_exposure_id
int
Access the property.
- detector_exposure_id
- detector_group: str¶
Collection name of which this detector is a part. Can be None if there are no detector groupings.
- Returns:
- detector_group
str
Access the property.
- detector_group
- detector_name: str¶
Name of the detector within the instrument (might not be unique if there are detector groups).
- Returns:
- detector_name
str
Access the property.
- detector_name
- detector_num: int¶
Unique (for instrument) integer identifier for the sensor.
- Returns:
- detector_num
int
Access the property.
- detector_num
- detector_serial: str¶
Serial number/string associated with this detector.
- Returns:
- detector_serial
str
Access the property.
- detector_serial
- detector_unique_name¶
Unique name of the detector within the focal plane, generally combining detector_group with detector_name.
- Returns:
- detector_unique_name
str
Access the property.
- detector_unique_name
- exposure_group: str¶
Label to use to associate this exposure with others (can be related to ‘exposure_id’).
- Returns:
- exposure_group
str
Access the property.
- exposure_group
- exposure_id: int¶
Unique (with instrument) integer identifier for this observation.
- Returns:
- exposure_id
int
Access the property.
- exposure_id
- exposure_time: Quantity¶
Duration of the exposure with shutter open (seconds).
- Returns:
- exposure_time
astropy.units.Quantity
Access the property.
- exposure_time
- focus_z: Quantity¶
Defocal distance.
- Returns:
- focus_z
astropy.units.Quantity
Access the property.
- focus_z
- 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_end
int
Access the property.
- group_counter_end
- 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_start
int
Access the property.
- group_counter_start
- has_simulated_content: bool¶
Boolean indicating whether any part of this observation was simulated.
- Returns:
- has_simulated_content
bool
Access the property.
- has_simulated_content
- instrument: str¶
The instrument used to observe the exposure.
- Returns:
- instrument
str
Access the property.
- instrument
- location: EarthLocation¶
Location of the observatory.
- Returns:
- location
astropy.coordinates.EarthLocation
Access the property.
- location
- observation_counter: int¶
Counter of this observation. Can be counter within observing_day or a global counter. Likely to be observatory specific.
- Returns:
- observation_counter
int
Access the property.
- observation_counter
- observation_id: str¶
Label uniquely identifying this observation (can be related to ‘exposure_id’).
- Returns:
- observation_id
str
Access the property.
- observation_id
- observation_reason: str¶
Reason this observation was taken, or its purpose (‘science’ and ‘calibration’ are common values)
- Returns:
- observation_reason
str
Access the property.
- observation_reason
- observation_type: str¶
Type of observation (currently: science, dark, flat, bias, focus).
- Returns:
- observation_type
str
Access the property.
- observation_type
- observing_day: int¶
Integer in YYYYMMDD format corresponding to the day of observation.
- Returns:
- observing_day
int
Access the property.
- observing_day
- observing_day_offset: TimeDelta | None¶
Offset to subtract from an observation date when calculating the observing day. Conversely, the offset to add to an observing day when calculating the time span of a day.
- Returns:
- observing_day_offset
astropy.time.TimeDelta
Access the property.
- observing_day_offset
- physical_filter: str¶
The bandpass filter used for this observation.
- Returns:
- physical_filter
str
Access the property.
- physical_filter
- pressure: Quantity¶
Atmospheric pressure outside the dome.
- Returns:
- pressure
astropy.units.Quantity
Access the property.
- pressure
- relative_humidity: float¶
Relative humidity outside the dome.
- Returns:
- relative_humidity
float
Access the property.
- relative_humidity
- science_program: str¶
Observing program (survey or proposal) identifier.
- Returns:
- science_program
str
Access the property.
- science_program
- temperature: Quantity¶
Temperature outside the dome.
- Returns:
- temperature
astropy.units.Quantity
Access the property.
- temperature
- tracking_radec: SkyCoord¶
Requested RA/Dec to track.
- Returns:
- tracking_radec
astropy.coordinates.SkyCoord
Access the property.
- tracking_radec
- 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_id
int
Access the property.
- visit_id
Methods Documentation
- classmethod from_json(json_str: str) ObservationInfo ¶
Create
ObservationInfo
from JSON string.- Parameters:
- json_str
str
The JSON representation.
- json_str
- Returns:
- obsinfo
ObservationInfo
Reconstructed object.
- obsinfo
Notes
Round-tripping of extension properties requires that the
ObservationInfo
was created with the help of a registeredMetadataTranslator
(which contains the extension property definitions).
- classmethod from_simple(simple: MutableMapping[str, Any]) ObservationInfo ¶
Convert the entity returned by
to_simple
back into anObservationInfo
.- Parameters:
- simple
dict
[str
,Any
] The dict returned by
to_simple()
.
- simple
- Returns:
- obsinfo
ObservationInfo
New object constructed from the dict.
- obsinfo
Notes
Round-tripping of extension properties requires that the
ObservationInfo
was created with the help of a registeredMetadataTranslator
(which contains the extension property definitions).
- classmethod makeObservationInfo(*, extensions: dict[str, astro_metadata_translator.properties.PropertyDefinition] | None = None, **kwargs: Any) ObservationInfo ¶
Construct an
ObservationInfo
from the supplied parameters.- Parameters:
- extensions
dict
[str
:PropertyDefinition
], optional Optional extension definitions, indexed by extension name (without the
ext_
prefix, which will be added byObservationInfo
).- **kwargs
Name-value pairs for any properties to be set. In the case of extension properties, the names should include the
ext_
prefix.
- extensions
- 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:
- stripped
dict
-like Same class as header supplied to constructor, but with the headers used to calculate the generic information removed.
- stripped
- to_json() str ¶
Serialize the object to JSON string.
- Returns:
- j
str
The properties of the ObservationInfo in JSON string form.
- j
Notes
Round-tripping of extension properties requires that the
ObservationInfo
was created with the help of a registeredMetadataTranslator
(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
usingfrom_simple()
.Notes
Round-tripping of extension properties requires that the
ObservationInfo
was created with the help of a registeredMetadataTranslator
(which contains the extension property definitions).