Skip to content

Commit

Permalink
Add DECAM focus_z translator.
Browse files Browse the repository at this point in the history
  • Loading branch information
jbkalmbach committed Jun 14, 2022
1 parent 3e10423 commit e3c9b77
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions python/astro_metadata_translator/translators/decam.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,12 @@ def to_detector_name(self) -> str:
name = self.to_detector_unique_name()
return name[1:]

@cache_translation
def to_focus_z(self) -> u.Quantity:
# Docstring will be inherited. Property defined in properties.py
tel_focus_list = self._header["TELFOCUS"].split(",")
return float(tel_focus_list[2]) * u.um

@classmethod
def fix_header(
cls, header: MutableMapping[str, Any], instrument: str, obsid: str, filename: Optional[str] = None
Expand Down
4 changes: 4 additions & 0 deletions tests/test_decam.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def test_decam_translator(self):
exposure_id=229388,
exposure_group="229388",
exposure_time=200.0 * u.s,
focus_z=2497.32 * u.um,
group_counter_end=229388,
group_counter_start=229388,
has_simulated_content=False,
Expand Down Expand Up @@ -75,6 +76,7 @@ def test_decam_translator(self):
exposure_id=160496,
exposure_group="160496",
exposure_time=0.0 * u.s,
focus_z=0.0 * u.um,
group_counter_end=160496,
group_counter_start=160496,
has_simulated_content=False,
Expand Down Expand Up @@ -110,6 +112,7 @@ def test_decam_translator(self):
exposure_id=412037,
exposure_group="412037",
exposure_time=86.0 * u.s,
focus_z=2828.00 * u.um,
group_counter_end=412037,
group_counter_start=412037,
has_simulated_content=False,
Expand Down Expand Up @@ -145,6 +148,7 @@ def test_decam_translator(self):
exposure_id=845291,
exposure_group="845291",
exposure_time=120.0 * u.s,
focus_z=2174.28 * u.um,
group_counter_end=845291,
group_counter_start=845291,
has_simulated_content=False,
Expand Down

0 comments on commit e3c9b77

Please sign in to comment.