summaryrefslogtreecommitdiff
path: root/gr-sounder/src/python/usrp_sounder.py
diff options
context:
space:
mode:
authorjcorgan2007-06-05 04:21:29 +0000
committerjcorgan2007-06-05 04:21:29 +0000
commite283fe844c88aa33b6bde4a7cb74f0d1c2ddbbc5 (patch)
tree0081a8487d3a4bb7a65404c2662d0a7480f50421 /gr-sounder/src/python/usrp_sounder.py
parent389906ea28957c6d7a08b5cd43a4ac2ab0c9d24d (diff)
downloadgnuradio-e283fe844c88aa33b6bde4a7cb74f0d1c2ddbbc5.tar.gz
gnuradio-e283fe844c88aa33b6bde4a7cb74f0d1c2ddbbc5.tar.bz2
gnuradio-e283fe844c88aa33b6bde4a7cb74f0d1c2ddbbc5.zip
Merged r5566:5676 from jcorgan/snd into trunk, with minor changes. Component gr-sounder is now complete for recording impulse responses to a file.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@5679 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-sounder/src/python/usrp_sounder.py')
-rwxr-xr-xgr-sounder/src/python/usrp_sounder.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/gr-sounder/src/python/usrp_sounder.py b/gr-sounder/src/python/usrp_sounder.py
index 4aada45d6..20f187114 100755
--- a/gr-sounder/src/python/usrp_sounder.py
+++ b/gr-sounder/src/python/usrp_sounder.py
@@ -25,6 +25,7 @@ from gnuradio.sounder import sounder
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser
+import numpy
import sys
n2s = eng_notation.num_to_str
@@ -33,10 +34,14 @@ def main():
parser = OptionParser(option_class=eng_option)
parser.add_option("-R", "--rx-subdev-spec", type="subdev", default=(0, 0),
help="select USRP Rx side A or B")
+ parser.add_option("-g", "--gain", type="eng_float", default=None,
+ help="set gain in dB (default is midpoint)")
parser.add_option("-f", "--frequency", type="eng_float", default=0.0,
help="set frequency to FREQ in Hz, default is %default", metavar="FREQ")
parser.add_option("-d", "--degree", type="int", default=12,
help="set sounding sequence degree (2-12), default is %default,")
+ parser.add_option("-a", "--amplitude", type="int", default=4096,
+ help="set waveform amplitude, default is %default,")
parser.add_option("-t", "--transmit", action="store_true", default=False,
help="enable sounding transmitter")
parser.add_option("-r", "--receive", action="store_true", default=False,
@@ -74,8 +79,9 @@ def main():
msgq = gr.msg_queue()
s = sounder(transmit=options.transmit,receive=options.receive,loopback=options.loopback,
- rx_subdev_spec=options.rx_subdev_spec,frequency=options.frequency,degree=options.degree,
- length=length,msgq=msgq,verbose=options.verbose,debug=options.debug)
+ rx_subdev_spec=options.rx_subdev_spec,frequency=options.frequency,rx_gain=options.gain,
+ degree=options.degree,length=length,msgq=msgq,verbose=options.verbose,ampl=options.amplitude,
+ debug=options.debug)
s.start()
if options.receive:
@@ -89,7 +95,10 @@ def main():
rec = msg.to_string()[:length*gr.sizeof_gr_complex]
if options.debug:
print "Received impulse vector of length", len(rec)
- f.write(rec)
+ recarray = numpy.fromstring(rec, dtype=numpy.complex64)
+ imparray = recarray[::-1]
+ data = imparray.tostring()
+ f.write(data)
except KeyboardInterrupt:
pass