trim mixer plot CPU usage and add plot command logfile
This commit is contained in:
parent
f974a32a19
commit
111b311d88
|
@ -55,7 +55,7 @@ def limit(a,lim):
|
||||||
return a
|
return a
|
||||||
|
|
||||||
class wrap_gp(object):
|
class wrap_gp(object):
|
||||||
def __init__(self, sps=_def_sps):
|
def __init__(self, sps=_def_sps, logfile=None):
|
||||||
self.sps = sps
|
self.sps = sps
|
||||||
self.center_freq = 0.0
|
self.center_freq = 0.0
|
||||||
self.relative_freq = 0.0
|
self.relative_freq = 0.0
|
||||||
|
@ -72,6 +72,7 @@ class wrap_gp(object):
|
||||||
self.sequence = 0
|
self.sequence = 0
|
||||||
self.output_dir = None
|
self.output_dir = None
|
||||||
self.filename = None
|
self.filename = None
|
||||||
|
self.logfile = logfile
|
||||||
|
|
||||||
self.attach_gp()
|
self.attach_gp()
|
||||||
|
|
||||||
|
@ -250,6 +251,9 @@ class wrap_gp(object):
|
||||||
h+= 'set yrange [-2:2]\n'
|
h+= 'set yrange [-2:2]\n'
|
||||||
h+= 'set title "Oscilloscope"\n'
|
h+= 'set title "Oscilloscope"\n'
|
||||||
dat = '%s%splot %s\n%s' % (h0, h, ','.join(plots), s)
|
dat = '%s%splot %s\n%s' % (h0, h, ','.join(plots), s)
|
||||||
|
if self.logfile is not None:
|
||||||
|
with open(self.logfile, 'a') as fd:
|
||||||
|
fd.write(dat)
|
||||||
self.gp.poll()
|
self.gp.poll()
|
||||||
if self.gp.returncode is None: # make sure gnuplot is still running
|
if self.gp.returncode is None: # make sure gnuplot is still running
|
||||||
try:
|
try:
|
||||||
|
@ -272,6 +276,9 @@ class wrap_gp(object):
|
||||||
def set_width(self, w):
|
def set_width(self, w):
|
||||||
self.width = w
|
self.width = w
|
||||||
|
|
||||||
|
def set_logfile(self, logfile=None):
|
||||||
|
self.logfile = logfile
|
||||||
|
|
||||||
class eye_sink_f(gr.sync_block):
|
class eye_sink_f(gr.sync_block):
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
|
@ -325,7 +332,7 @@ class fft_sink_c(gr.sync_block):
|
||||||
|
|
||||||
def work(self, input_items, output_items):
|
def work(self, input_items, output_items):
|
||||||
self.skip += 1
|
self.skip += 1
|
||||||
if self.skip == 50:
|
if self.skip >= 50:
|
||||||
self.skip = 0
|
self.skip = 0
|
||||||
in0 = input_items[0]
|
in0 = input_items[0]
|
||||||
self.gnuplot.plot(in0, FFT_BINS, mode='fft')
|
self.gnuplot.plot(in0, FFT_BINS, mode='fft')
|
||||||
|
@ -357,10 +364,14 @@ class mixer_sink_c(gr.sync_block):
|
||||||
out_sig=None)
|
out_sig=None)
|
||||||
self.debug = debug
|
self.debug = debug
|
||||||
self.gnuplot = wrap_gp()
|
self.gnuplot = wrap_gp()
|
||||||
|
self.skip = 0
|
||||||
|
|
||||||
def work(self, input_items, output_items):
|
def work(self, input_items, output_items):
|
||||||
in0 = input_items[0]
|
self.skip += 1
|
||||||
self.gnuplot.plot(in0, FFT_BINS, mode='mixer')
|
if self.skip >= 10:
|
||||||
|
self.skip = 0
|
||||||
|
in0 = input_items[0]
|
||||||
|
self.gnuplot.plot(in0, FFT_BINS, mode='mixer')
|
||||||
return len(input_items[0])
|
return len(input_items[0])
|
||||||
|
|
||||||
def kill(self):
|
def kill(self):
|
||||||
|
|
Loading…
Reference in New Issue