Skip to content

Commit

Permalink
Merge pull request #518 from happycube/chad071920
Browse files Browse the repository at this point in the history
Fix repeat-on-skipping issue seen on one cap
  • Loading branch information
happycube committed Jul 20, 2020
2 parents 356fd83 + 33e1247 commit 6a91342
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
19 changes: 16 additions & 3 deletions lddecode/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1660,6 +1660,8 @@ def getLine0(self, validpulses):
isFirstField_prev = not self.prevfield.isFirstField
conf_prev = self.prevfield.sync_confidence

#print(line0loc_local, line0loc_prev, line0loc_next)

# Best case - all three line detectors returned something - perform TOOT using median
if line0loc_local is not None and line0loc_next is not None and line0loc_prev is not None:
isFirstField_all = (isFirstField_local + isFirstField_prev + isFirstField_next) >= 2
Expand Down Expand Up @@ -1741,6 +1743,7 @@ def compute_linelocs(self):
self.rawpulses = self.getpulses()
if self.rawpulses is None or len(self.rawpulses) == 0:
logging.error("Unable to find any sync pulses, jumping one second")
print('x1')
return None, None, int(self.rf.freq_hz)

self.validpulses = validpulses = self.refinepulses()
Expand Down Expand Up @@ -1781,7 +1784,7 @@ def compute_linelocs(self):
rlineloc_end = np.round(lineloc_end)
lineloc_end_distance = np.abs(lineloc_end - rlineloc_end)

if p[0] == 0 and lineloc_end_distance < lineloc_distance:
if p[0] == 0 and rlineloc > 23 and lineloc_end_distance < lineloc_distance:
skip_reached = True

if skip_reached:
Expand All @@ -1800,8 +1803,6 @@ def compute_linelocs(self):
if p[0] > 0 or (p[0] == 0 and rlineloc < 10):
continue

#print(p, lineloc, rlineloc)

linelocs_dict[np.round(lineloc)] = p[1].start
linelocs_dist[np.round(lineloc)] = lineloc_distance

Expand Down Expand Up @@ -2660,6 +2661,8 @@ def __init__(self, fname_in, fname_out, freader, analog_audio = 0, digital_audio

self.doDOD = doDOD

self.badfields = None

self.fieldinfo = []

self.leadIn = False
Expand Down Expand Up @@ -2799,6 +2802,10 @@ def readfield(self, initphase = False):
redo = False

while done == False:
if redo:
# Only allow one redo, no matter what
done = True

self.fieldloc = self.fdoffset
f, offset = self.decodefield(initphase = initphase)

Expand Down Expand Up @@ -2846,6 +2853,12 @@ def readfield(self, initphase = False):
self.fdoffset -= offset
else:
done = True
else:
# Probably jumping ahead - delete the previous field so
# TBC computations aren't thrown off
if self.curfield is not None and self.badfields is None:
self.badfields = (self.curfield, f)
self.curfield = None

self.curfield = f

Expand Down
7 changes: 7 additions & 0 deletions lddecode/plot_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,13 @@ def draw_raw_field(self, channel = 'demod'):

return draw_raw_bwimage(cooked, self.inlinelen, len(self.linelocs)-2, vscale=4)

def draw_really_raw_field(self, channel = 'demod'):
# Draws the pre-TBC field. Useful for determining if there's a skip (i.e. issue #509)
cooked = self.hz_to_output(self.data['video'][channel])
cooked = cooked[:(len(cooked)//self.inlinelen)*self.inlinelen]

return draw_raw_bwimage(cooked, self.inlinelen, (len(cooked)//self.inlinelen), vscale=4)

def plotline(field, line, usecs = 63.5, linelocs = None):
ls = field.lineslice(line, 0, usecs, linelocs)
plt.plot(field.data['video']['demod'][ls])
Expand Down

0 comments on commit 6a91342

Please sign in to comment.