Skip to content
Snippets Groups Projects
Commit 77ffcd26 authored by Lloyd Carothers's avatar Lloyd Carothers
Browse files

print jerks untested mods.

parent 867548a8
No related branches found
No related tags found
No related merge requests found
......@@ -363,7 +363,7 @@ class Reftek(object):
return
def find_tears(self, start=None, end=None):
'''Finds all gaps and overlaps
'''Finds all gaps and overlaps ignoring mass positions
'''
dstreams = DataStreams()
# tears
......@@ -374,8 +374,9 @@ class Reftek(object):
if p.ptype == 'EH':
# add /replace stream
dstreams.addEH(p)
continue
# if dt
if p.ptype == 'DT':
if p.ptype == 'DT' and p.ds < 8:
first_samp_time = p.Ltime
should_start, last_packet = dstreams.addDT(p)
if not should_start:
......@@ -391,8 +392,11 @@ class Reftek(object):
def find_dsp_diffs(self, start=None, end=None):
'''Find all DSP diff lines in SOH'''
dsp_list = list()
for p in self.gen_packets(start=start, end=end, ds=0):
return p.DSPdiff()
if p.DSPdiff():
dsp_list.append(p.DSPdiff())
return dsp_list
def find_2016_leap_dsp(self):
'''Returns the time of the first dsp diff of -1s 0msec after 2017:001
......@@ -436,7 +440,7 @@ class Reftek(object):
dsptime = self.find_2016_leap_dsp()
print 'DAS corrected for leap at: ', dsptime
for cf in self.gen_cf_files(start=NEWYEAR, end=dsptime):
if 0 < cf.ds and cf.ds < 8: # 8 datastreams
if 0 < cf.ds and cf.ds < 8: # 8 datastreams, 0=ds, 9=M.P.
mistimed_files.append(cf)
return mistimed_files
......@@ -554,7 +558,7 @@ class Reftek(object):
if not data:
raise StopIteration
yield Packet(data)
def print_packets(self):
for p in self.gen_packets():
print p
......@@ -769,26 +773,38 @@ def find_rt_files(paths):
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.version = VERSION
parser.description = ('Program for finding, viewing, correcting Dec 2016 '
'leapsecond timing of RT-130 data.'
parser.description = ('Program for finding, viewing, and correcting '
'Dec 2016 leapsecond mistimed RT-130 data.'
)
parser.add_argument('paths',
nargs='*',
default=['./'],
help='Input CF dir',
help='Input CF dirs. The root dir of a CF card '
'recorded by and RT-130, containing YYYYDDD dirs.',
)
parser.add_argument('-p', dest='print_packets', action='store_true',
help='Print packets. Like refpacket',
help='Print all packets. Like refpacket.',
)
parser.add_argument('-t',
dest='find_tears',
action='store_true',
help='Print tears',
help='Print all tears. Does not include mass position '
'channels.',
)
parser.add_argument('-j',
dest='find_jerks',
action='store_true',
help='Print all jerks.',
)
parser.add_argument('-c',
dest='correct',
action='store_true',
help='Fix Dec 2016 leapsecond tears',
help='Fix Dec 2016 leapsecond tears. Files corrected '
'will first be backed up with .ORIG suffix, then '
'corrections will be applied to the original files '
'allowing most downstream processes (rt2ms) to work '
'on the corrected data. Does not alter mass position '
'or SOH channels.',
)
args = parser.parse_args()
......@@ -821,3 +837,10 @@ if __name__ == '__main__':
print '-' * 15, 'Finding tears: ', rt
print ref.find_tears()
print '-' * 60
if args.find_jerks:
for rt in refs:
print '-' * 15, 'Finding jerks: ', rt
print ref.find_dsp_diffs()
print '-' * 60
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment