diff options
| author | Martin Braun <martin.braun@ettus.com> | 2021-09-23 10:03:17 +0200 | 
|---|---|---|
| committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2021-10-06 11:57:25 -0700 | 
| commit | 4e1068671f2b4521e5b0533d35b5fcb66ca5d8a4 (patch) | |
| tree | 4d661edc3110b74ce0e314b2457cd0be6091357d /host/examples | |
| parent | 9650342c12f95811f670a179494f43717788e6ed (diff) | |
| download | uhd-4e1068671f2b4521e5b0533d35b5fcb66ca5d8a4.tar.gz uhd-4e1068671f2b4521e5b0533d35b5fcb66ca5d8a4.tar.bz2 uhd-4e1068671f2b4521e5b0533d35b5fcb66ca5d8a4.zip | |
python: multi_usrp: Fix issues in send_waveform()
- Like with RX, this now allows passing in stream time and existing
  streamer
- There was no EOB being sent at the end (now there is)
- Fixed some linter issues
Diffstat (limited to 'host/examples')
| -rwxr-xr-x | host/examples/python/tx_waveforms.py | 14 | 
1 files changed, 7 insertions, 7 deletions
| diff --git a/host/examples/python/tx_waveforms.py b/host/examples/python/tx_waveforms.py index 58b6472f7..2e6f5ecde 100755 --- a/host/examples/python/tx_waveforms.py +++ b/host/examples/python/tx_waveforms.py @@ -12,9 +12,9 @@ import argparse  import numpy as np  import uhd -waveforms = { +WAVEFORMS = {      "sine": lambda n, tone_offset, rate: np.exp(n * 2j * np.pi * tone_offset / rate), -    "square": lambda n, tone_offset, rate: np.sign(waveforms["sine"](n, tone_offset, rate)), +    "square": lambda n, tone_offset, rate: np.sign(WAVEFORMS["sine"](n, tone_offset, rate)),      "const": lambda n, tone_offset, rate: 1 + 1j,      "ramp": lambda n, tone_offset, rate:              2*(n*(tone_offset/rate) - np.floor(float(0.5 + n*(tone_offset/rate)))) @@ -26,7 +26,7 @@ def parse_args():      parser = argparse.ArgumentParser()      parser.add_argument("-a", "--args", default="", type=str)      parser.add_argument( -        "-w", "--waveform", default="sine", choices=waveforms.keys(), type=str) +        "-w", "--waveform", default="sine", choices=WAVEFORMS.keys(), type=str)      parser.add_argument("-f", "--freq", type=float, required=True)      parser.add_argument("-r", "--rate", default=1e6, type=float)      parser.add_argument("-d", "--duration", default=5.0, type=float) @@ -44,10 +44,10 @@ def main():      if not isinstance(args.channels, list):          args.channels = [args.channels]      data = np.array( -        list(map(lambda n: args.wave_ampl * waveforms[args.waveform](n, args.wave_freq, args.rate), -            np.arange( -                int(10 * np.floor(args.rate / args.wave_freq)), -                dtype=np.complex64))), +        list(map(lambda n: args.wave_ampl * WAVEFORMS[args.waveform](n, args.wave_freq, args.rate), +                 np.arange( +                     int(10 * np.floor(args.rate / args.wave_freq)), +                     dtype=np.complex64))),          dtype=np.complex64)  # One period      usrp.send_waveform(data, args.duration, args.freq, args.rate, | 
