Commit 4f367c1c authored by Jenda's avatar Jenda

fix uninitialized elements in structures

parent fa3202cd
......@@ -97,7 +97,6 @@ def pixel2frame(pixpos):
Y position in waterfall to corresponding frame number
"""
if not pixpos in fftframes:
print("not in")
return min(fftframes.values())
return fftframes[pixpos]
......
......@@ -270,7 +270,7 @@ class KukurukuScanner():
if frame.stickactivity:
acc = self.compute_spectrum(buf)
for peak in peaks:
if self.check_activity(acc, peak, floor):
if self.check_activity(acc, peak, floor, frame.sql):
lastact = time.time()
self.l.l("%f has activity, continuing"%peak.freq, "INFO")
......@@ -299,23 +299,20 @@ class KukurukuScanner():
if ch.fd_r:
os.close(ch.fd_r)
def check_activity(self, acc, peak, q):
def check_activity(self, acc, peak, q, sql):
""" Check if a given peak is active
acc - computed spectrum
q - relevant percentile
"""
floor = sorted(acc)[int(q * self.conf.fftw)]
floor = sorted(acc)[int(q * self.conf.fftw)] + sql
binhz = self.conf.rate/self.conf.fftw
startbin = int(peak.freq/binhz - peak.bw/(2*binhz)) + self.conf.fftw/2
stopbin = int(peak.freq/binhz + peak.bw/(2*binhz)) + self.conf.fftw/2
print(acc)
for i in range(startbin, stopbin):
if acc[i] > floor:
print("acc %i lvl %f floor %f"%(i,acc[i], floor))
return True
return False
......
......@@ -14,16 +14,16 @@ from libutil import Struct
"""
def scanframe():
ScanframeT = Struct("scanframe", "freq, floor, stickactivity, stick, silencegap, sql, gain, channels")
return ScanframeT()
ScanframeT = Struct("scanframe", "freq floor stickactivity stick silencegap sql gain channels")
return ScanframeT(0, 0, False, 0, 0, 0, 0, [])
def cronframe():
CronframeT = Struct("cronframe", "freq, floor, stickactivity, stick, silencegap, sql, gain, channels cron")
return CronframeT()
CronframeT = Struct("cronframe", "freq floor stickactivity stick silencegap sql gain channels cron")
return CronframeT(0, 0, False, 0, 0, 0, 0, [], "")
def channel():
""" Definition of one channel generated from the [ChannelName] section in .conf file """
ChannelT = Struct("channel", "freq bw taps pipe")
return ChannelT()
return ChannelT(0, 0, [], None)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment