Skip to content

Commit

Permalink
Allow translator subclass to specify list of on-sky observation types
Browse files Browse the repository at this point in the history
  • Loading branch information
timj committed Mar 21, 2024
1 parent d4bf551 commit 95cda85
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 12 additions & 2 deletions python/astro_metadata_translator/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,16 @@ class MetadataTranslator:
`PropertyDefinition`.
"""

_sky_observation_types: tuple[str, ...] = ("science", "object")
"""Observation types that correspond to an observation where the detector
can see sky photons. This is used by the default implementation of
``can_see_sky`` determination."""

_non_sky_observation_types: tuple[str, ...] = ("bias", "dark")
"""Observation types that correspond to an observation where the detector
can not see sky photons. This is used by the default implementation of
``can_see_sky`` determination."""

# Static typing requires that we define the standard dynamic properties
# statically.
if TYPE_CHECKING:
Expand Down Expand Up @@ -1245,9 +1255,9 @@ def to_can_see_sky(self) -> bool | None:
if obs_type is not None:
obs_type = obs_type.lower()

if obs_type in ("science", "object"):
if obs_type in self._sky_observation_types:
return True
if obs_type in ("bias", "dark"):
if obs_type in self._non_sky_observation_types:
return False
return None

Expand Down
4 changes: 4 additions & 0 deletions python/astro_metadata_translator/translators/decam.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ class DecamTranslator(FitsTranslator):
# the same offset used by the Vera Rubin Observatory of 12 hours.
_observing_day_offset = astropy.time.TimeDelta(12 * 3600, format="sec", scale="tai")

# List from Frank Valdes (2024-03-21).
_sky_observation_types: tuple[str, ...] = ("science", "object", "standard", "sky flat")
_non_sky_observation_types: tuple[str, ...] = ("zero", "dark", "dome flat")

# Unique detector names are currently not used but are read directly from
# header.
# The detector_group could be N or S with detector_name corresponding
Expand Down

0 comments on commit 95cda85

Please sign in to comment.