amodem: fix --plot switch

This commit is contained in:
Roman Zeyde
2014-09-10 09:20:07 +03:00
parent c229675895
commit f836918d3c
2 changed files with 7 additions and 4 deletions

View File

@@ -86,9 +86,9 @@ def find_start(buf, length):
class Receiver(object):
def __init__(self, pylab=None):
def __init__(self, plt=None):
self.stats = {}
self.plt = pylab or common.Dummy()
self.plt = plt or common.Dummy()
def _prefix(self, sampler, freq, gain=1.0, skip=5):
symbols = dsp.Demux(sampler, [freq])
@@ -273,7 +273,7 @@ def main(args):
reader.check = common.check_saturation
receiver = Receiver(args.plt)
receiver = Receiver(plt=args.plot)
success = False
try:
log.info('Waiting for carrier tone: %.1f kHz', config.Fc / 1e3)

View File

@@ -98,7 +98,7 @@ def main():
'--skip', type=int, default=128,
help='skip initial N samples, due to spurious spikes')
receiver.add_argument(
'--plot', dest='plt', action='store_true', default=False,
'--plot', action='store_true', default=False,
help='plot results using pylab module')
receiver.set_defaults(
main=run_recv,
@@ -120,6 +120,9 @@ def main():
# Parsing and execution
log.debug('MODEM settings: %r', config.settings)
if args.plot:
import pylab
args.plot = pylab
args.main(args)