Skip to content

Commit 026a5db

Browse files
committed
Start cleaning up
1 parent 2e6bb9c commit 026a5db

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

cheta/tests/test_time_offsets.py

+7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import numpy as np
2+
from cxotime import secs2date
23

34
from cheta import fetch
45
from cheta.time_offsets import MNF_TIME, adjust_time, get_hi_res_times
@@ -16,8 +17,14 @@ def test_time_adjust_get_hi_res_times():
1617
start = "2020:030:03:00:00"
1718
stop = "2020:030:05:00:00"
1819
dat = fetch.Msid("tephin", start, stop)
20+
with fetch.data_source("maude allow_subset=False"):
21+
dat_maude = fetch.Msid("tephin", start, stop)
1922

2023
dat_adj = adjust_time(dat, start, stop)
24+
dates_maude = secs2date(dat_maude.times)
25+
dates_adj = secs2date(dat_adj.times)
26+
assert np.all(dates_maude == dates_adj)
27+
2128
times_adj, fmt_intervals = get_hi_res_times(dat)
2229

2330
# Test re-using fmt_intervals

cheta/time_offsets.py

-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ def adjust_time(msid, start, stop):
4444
4545
:returns: fetch ``MSID`` or ``Msid`` object
4646
"""
47-
samp_rate = tables["tsmpl"][msid.msid]["SAMPLE_RATE"]
4847
str_num = tables["tsmpl"][msid.msid]["STREAM_NUMBER"]
4948
start_minor_frame = tables["tloc"][msid.msid]["START_MINOR_FRAME"]
5049
# stream# to FMT name converter. Unsure if FMT6/SHuttle data needs to be handled
@@ -60,7 +59,6 @@ def adjust_time(msid, start, stop):
6059
# for each format, generate time offset based on stream number, sample
6160
# rate and start minor frame...
6261
t_off = {}
63-
t_samp = {}
6462
str_num_2_idx = {}
6563
idx = 0
6664

@@ -81,7 +79,6 @@ def adjust_time(msid, start, stop):
8179
off_phase = MNF_TIME * start_minor_frame[str_num_2_idx[stream]]
8280
t_off[fmt] = off_phase
8381
# 128 -> 0.25625, 64 -> 0.51250 , &c.
84-
t_samp[fmt] = (128 / samp_rate[str_num_2_idx[stream]]) * 0.25625
8582

8683
# Get Telemetry format for the time interval in question. CCSDSTMF is
8784
# updated 128x per MjF, so it's at max time resolution

0 commit comments

Comments
 (0)