Skip to content

Commit

Permalink
Add observation date to table output
Browse files Browse the repository at this point in the history
  • Loading branch information
timj committed Dec 5, 2024
1 parent 7012e8d commit 1616c8f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python/astro_metadata_translator.dist-info/METADATA
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Metadata-Version: 1.0
Name: astro_metadata_translator
Version: w.2024.48-5-gb0fd641-dirty
Version: w.2024.48-5-g7012e8d-dirty
5 changes: 5 additions & 0 deletions python/astro_metadata_translator/bin/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from collections.abc import Sequence
from typing import IO, Any

import astropy.time
import astropy.units as u
import yaml
from astropy.table import Column, MaskedColumn, QTable
Expand Down Expand Up @@ -64,6 +65,7 @@
"label": "ExpTime",
"bad": math.nan * u.s,
},
{"attr": "datetime_begin", "label": "Observation Date", "bad": astropy.time.Time(0.0, format="jd")},
)


Expand Down Expand Up @@ -261,6 +263,9 @@ def _masked(value: Any, fillvalue: Any) -> Any:
# in a column.
if issubclass(PROPERTIES[c["attr"]].py_type, u.Quantity):
data = u.Quantity(data)
elif issubclass(PROPERTIES[c["attr"]].py_type, astropy.time.Time):
# Force to ISO string.
data = astropy.time.Time(data).isot

if need_mask:
data = MaskedColumn(name=c["label"], data=data, mask=mask, format=col_format)
Expand Down

0 comments on commit 1616c8f

Please sign in to comment.