diff --git a/amodem/recv.py b/amodem/recv.py index 3af14a4..7e00794 100644 --- a/amodem/recv.py +++ b/amodem/recv.py @@ -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) diff --git a/scripts/amodem b/scripts/amodem index 9566538..0b87f37 100755 --- a/scripts/amodem +++ b/scripts/amodem @@ -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)