mirror of
https://github.com/romanz/amodem.git
synced 2026-03-18 15:46:01 +08:00
remove unused arguments
This commit is contained in:
28
amodem-cli
28
amodem-cli
@@ -72,7 +72,12 @@ def main():
|
||||
'-c', '--calibrate', default=False, action='store_true')
|
||||
|
||||
sender.set_defaults(
|
||||
main=send.main, calibration=calib.send,
|
||||
main=lambda config, args: send.main(
|
||||
config, src=args.src, dst=args.dst
|
||||
),
|
||||
calib=lambda config, args: calib.send(
|
||||
config, dst=args.dst
|
||||
),
|
||||
input_type=FileType('rb'),
|
||||
output_type=FileType('wb', interface)
|
||||
)
|
||||
@@ -91,7 +96,12 @@ def main():
|
||||
'--plot', action='store_true', default=False,
|
||||
help='plot results using pylab module')
|
||||
receiver.set_defaults(
|
||||
main=recv.main, calibration=calib.recv,
|
||||
main=lambda config, args: recv.main(
|
||||
config, src=args.src, dst=args.dst, pylab=args.pylab
|
||||
),
|
||||
calib=lambda config, args: calib.recv(
|
||||
config, src=args.src, verbose=args.verbose
|
||||
),
|
||||
input_type=FileType('rb', interface),
|
||||
output_type=FileType('wb')
|
||||
)
|
||||
@@ -120,18 +130,18 @@ def main():
|
||||
|
||||
# Parsing and execution
|
||||
log.debug(description)
|
||||
|
||||
args.pylab = None
|
||||
if getattr(args, 'plot', False):
|
||||
import pylab
|
||||
else:
|
||||
pylab = None
|
||||
args.pylab = pylab
|
||||
|
||||
src = args.input_type(args.input)
|
||||
dst = args.output_type(args.output)
|
||||
args.src = args.input_type(args.input)
|
||||
args.dst = args.output_type(args.output)
|
||||
if args.calibrate:
|
||||
args.calibration(config=config, src=src, dst=dst,
|
||||
verbose=args.verbose)
|
||||
args.calib(config=config, args=args)
|
||||
else:
|
||||
return args.main(config=config, src=src, dst=dst, pylab=pylab)
|
||||
return args.main(config=config, args=args)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -9,7 +9,7 @@ from . import common
|
||||
ALLOWED_EXCEPTIONS = (IOError, KeyboardInterrupt)
|
||||
|
||||
|
||||
def send(config, dst, src=None, verbose=False):
|
||||
def send(config, dst):
|
||||
calibration_symbols = int(1.0 * config.Fs)
|
||||
t = np.arange(0, calibration_symbols) * config.Ts
|
||||
signals = [np.sin(2 * np.pi * f * t) for f in config.frequencies]
|
||||
@@ -73,7 +73,7 @@ fmt = '{freq:6.0f} Hz: {message:s}{extra:s}'
|
||||
fields = ['peak', 'total', 'rms', 'coherency']
|
||||
|
||||
|
||||
def recv(config, src, dst=None, verbose=False):
|
||||
def recv(config, src, verbose=False):
|
||||
extra = ''
|
||||
if verbose:
|
||||
extra = ''.join(', {0}={{{0}:.4f}}'.format(f) for f in fields)
|
||||
|
||||
@@ -52,7 +52,7 @@ class Sender(object):
|
||||
log.debug('Sent %8.1f kB', total_bits / 8e3)
|
||||
|
||||
|
||||
def main(config, src, dst, pylab=None):
|
||||
def main(config, src, dst):
|
||||
sender = Sender(dst, config=config)
|
||||
Fs = config.Fs
|
||||
|
||||
|
||||
Reference in New Issue
Block a user