Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion cheta/tests/test_fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from Chandra.Time import DateTime
from cxotime import CxoTime

from .. import fetch, fetch_eng
from .. import fetch, fetch_eng, fetch_sci

print(fetch.__file__)

Expand Down Expand Up @@ -542,6 +542,38 @@ def test_interpolate_time_precision():
assert abs(dt_frac) < 0.001


@pytest.mark.skipif(not HAS_MAUDE, reason="MAUDE server not available")
def test_2tlev2rt_units_maude():
msid = "2TLEV2RT"
start = "2026:065:13:39:10"
stop = "2026:065:13:40:30"

with fetch.data_source("MAUDE"):
dat_cxc = fetch.Msid(msid, start, stop)
assert dat_cxc.unit == "count"

dat_eng = fetch_eng.Msid(msid, start, stop)
assert dat_eng.unit == "HZ"

dat_sci = fetch_sci.Msid(msid, start, stop)
assert dat_sci.unit == "count"


def test_2tlev2rt_units():
msid = "2TLEV2RT"
start = "2026:065:13:39:10"
stop = "2026:065:13:40:30"

dat_cxc = fetch.Msid(msid, start, stop)
assert dat_cxc.unit == "count"

dat_eng = fetch_eng.Msid(msid, start, stop)
assert dat_eng.unit == "HZ"

dat_sci = fetch_sci.Msid(msid, start, stop)
assert dat_sci.unit == "count"


def _assert_msid_equal(msid1, msid2):
for attr in ("tstart", "tstop", "datestart", "datestop", "units", "unit", "stat"):
assert getattr(msid1, attr) == getattr(msid2, attr)
Expand Down
5 changes: 3 additions & 2 deletions cheta/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def emit(self, record):
("ASEC", "arcsec"),
("DEG", "deg"),
("DEGPS", "deg/s"),
("HZ", "count"), # Strange equivalence but e.g. 2TLEV2RT
("KHZ", "kHz"),
("KM", "km"),
("KMPS", "km/s"),
Expand Down Expand Up @@ -314,7 +315,7 @@ def convert(self, msid, vals, delta_val=False, from_system="cxc"):
MSID, conversion[0], conversion[1]
)
)

vals = converters[conversion](vals, delta_val)
else:
vals = converters[conversion](vals, delta_val)

return vals
Loading