[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r10962 - gnuradio/branches/features/experimental-gui
From: |
jblum |
Subject: |
[Commit-gnuradio] r10962 - gnuradio/branches/features/experimental-gui |
Date: |
Tue, 5 May 2009 15:12:42 -0600 (MDT) |
Author: jblum
Date: 2009-05-05 15:12:42 -0600 (Tue, 05 May 2009)
New Revision: 10962
Modified:
gnuradio/branches/features/experimental-gui/generic_usrp.py
gnuradio/branches/features/experimental-gui/usrp_siggen.py
gnuradio/branches/features/experimental-gui/usrp_siggen_gui.py
Log:
unit amplitude for generic usrp, uses mult const to scale for usrp1 case
Modified: gnuradio/branches/features/experimental-gui/generic_usrp.py
===================================================================
--- gnuradio/branches/features/experimental-gui/generic_usrp.py 2009-05-05
20:21:36 UTC (rev 10961)
+++ gnuradio/branches/features/experimental-gui/generic_usrp.py 2009-05-05
21:12:42 UTC (rev 10962)
@@ -19,7 +19,7 @@
# Boston, MA 02110-1301, USA.
#
-USRP_TYPE = 'usrp'
+USRP1_TYPE = 'usrp1'
USRP2_TYPE = 'usrp2'
from gnuradio import gr, usrp, usrp2
@@ -43,7 +43,7 @@
self._fusb_nblocks = fusb_nblocks
def __str__(self):
- if self._type == USRP_TYPE: return self._subdev.side_and_name()
+ if self._type == USRP1_TYPE: return self._subdev.side_and_name()
elif self._type == USRP2_TYPE:
return 'Interface: %s MAC Address: %s D-Board ID: 0x%.2x\n'%(
self._u.interface_name(), self._u.mac_addr(),
self._u.daughterboard_id())
@@ -55,29 +55,29 @@
r = self.gain_range()
gain = (r[0] + r[1])/2 # set gain to midpoint
self._gain = gain
- if self._type == USRP_TYPE: return self._subdev.set_gain(gain)
+ if self._type == USRP1_TYPE: return self._subdev.set_gain(gain)
elif self._type == USRP2_TYPE: return self._u.set_gain(gain)
def gain_range(self):
- if self._type == USRP_TYPE: return self._subdev.gain_range()
+ if self._type == USRP1_TYPE: return self._subdev.gain_range()
elif self._type == USRP2_TYPE: return self._u.gain_range()
def set_center_freq(self, target_freq):
- if self._type == USRP_TYPE:
+ if self._type == USRP1_TYPE:
return self._u.tune(self._dxc, self._subdev, target_freq)
elif self._type == USRP2_TYPE:
return self._u.set_center_freq(target_freq)
def freq_range(self):
- if self._type == USRP_TYPE: return self._subdev.freq_range()
+ if self._type == USRP1_TYPE: return self._subdev.freq_range()
elif self._type == USRP2_TYPE: return self._u.freq_range()
def set_auto_tr(self, enable):
- if self._type == USRP_TYPE: return self._subdev.set_auto_tr(enable)
+ if self._type == USRP1_TYPE: return self._subdev.set_auto_tr(enable)
def __del__(self):
# Avoid weak reference error
- if self._type == USRP_TYPE: del self._subdev
+ if self._type == USRP1_TYPE: del self._subdev
########################################################################
# generic usrp source
@@ -96,12 +96,12 @@
gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
#pick usrp or usrp2
if self._usrpx == '1' or self._subdev_spec:
- self._setup_usrp_source()
+ self._setup_usrp1()
elif self._usrpx == '2' or self._mac_addr:
- self._setup_usrp2_source()
+ self._setup_usrp2()
else: #automatic
- try: self._setup_usrp2_source()
- except: self._setup_usrp_source()
+ try: self._setup_usrp2()
+ except: self._setup_usrp1()
self.connect(self._u, self)
self.set_auto_tr(True)
@@ -109,7 +109,7 @@
# generic access methods
####################################################################
def set_decim(self, decim):
- if self._type == USRP_TYPE: return self._u.set_decim_rate(decim)
+ if self._type == USRP1_TYPE: return self._u.set_decim_rate(decim)
elif self._type == USRP2_TYPE: return self._u.set_decim(decim)
def adc_rate(self): return self._u.adc_rate()
@@ -117,8 +117,8 @@
####################################################################
# setup usrp methods
####################################################################
- def _setup_usrp_source(self):
- self._type = USRP_TYPE
+ def _setup_usrp1(self):
+ self._type = USRP1_TYPE
self._u = usrp.source_c (self._which,
fusb_block_size=self._fusb_block_size,
fusb_nblocks=self._fusb_nblocks)
@@ -129,7 +129,7 @@
self._u.set_mux(usrp.determine_rx_mux_value(self._u,
self._subdev_spec))
self._dxc = 0
- def _setup_usrp2_source(self):
+ def _setup_usrp2(self):
self._type = USRP2_TYPE
self._u = usrp2.source_32fc(self._interface, self._mac_addr)
@@ -151,33 +151,31 @@
#pick usrp or usrp2
if self._usrpx == '1' or self._subdev_spec:
- self._setup_usrp_source()
+ self._setup_usrp1()
elif self._usrpx == '2' or self._mac_addr:
- self._setup_usrp2_source()
+ self._setup_usrp2()
else: #automatic
- try: self._setup_usrp2_source()
- except: self._setup_usrp_source()
- self.connect(self, self._u)
+ try: self._setup_usrp2()
+ except: self._setup_usrp1()
+ if self._type == USRP1_TYPE: #scale 0.0 to 1.0 input for usrp1
+ self.connect(self, gr.multiply_const_cc((2**15)-1), self._u)
+ elif self._type == USRP2_TYPE: self.connect(self, self._u)
self.set_auto_tr(True)
####################################################################
# generic access methods
####################################################################
def set_interp(self, interp):
- if self._type == USRP_TYPE: return self._u.set_interp_rate(interp)
+ if self._type == USRP1_TYPE: return self._u.set_interp_rate(interp)
elif self._type == USRP2_TYPE: return self._u.set_interp(interp)
def dac_rate(self): return self._u.dac_rate()
- def ampl_range(self):
- if self._type == USRP_TYPE: return (0.0, 2.**15-1)
- elif self._type == USRP2_TYPE: return (0.0, 1.0)
-
####################################################################
# setup usrp methods
####################################################################
- def _setup_usrp_source(self):
- self._type = USRP_TYPE
+ def _setup_usrp1(self):
+ self._type = USRP1_TYPE
self._u = usrp.sink_c (self._which,
fusb_block_size=self._fusb_block_size,
fusb_nblocks=self._fusb_nblocks)
@@ -188,6 +186,6 @@
self._u.set_mux(usrp.determine_tx_mux_value(self._u,
self._subdev_spec))
self._dxc = self._subdev.which()
- def _setup_usrp2_source(self):
+ def _setup_usrp2(self):
self._type = USRP2_TYPE
self._u = usrp2.sink_32fc(self._interface, self._mac_addr)
Modified: gnuradio/branches/features/experimental-gui/usrp_siggen.py
===================================================================
--- gnuradio/branches/features/experimental-gui/usrp_siggen.py 2009-05-05
20:21:36 UTC (rev 10961)
+++ gnuradio/branches/features/experimental-gui/usrp_siggen.py 2009-05-05
21:12:42 UTC (rev 10962)
@@ -76,7 +76,7 @@
self[GAIN_KEY] = options.tx_gain
self[TX_FREQ_KEY] = options.tx_freq
self[LO_OFFSET_KEY] = options.lo_offset
- self._set_tx_amplitude(options.amplitude)
+ self[AMPLITUDE_KEY] = options.amplitude
self[WAVEFORM_FREQ_KEY] = options.waveform_freq
self[WAVEFORM_OFFSET_KEY] = options.offset
self[WAVEFORM2_FREQ_KEY] = options.waveform2_freq
@@ -103,7 +103,6 @@
self.publish(DAC_RATE_KEY, self._u.dac_rate)
self.publish(FREQ_RANGE_KEY, self._u.freq_range)
self.publish(GAIN_RANGE_KEY, self._u.gain_range)
- self.publish(AMPL_RANGE_KEY, self._u.ampl_range)
if self._verbose: print str(self._u)
def _set_tx_amplitude(self, ampl):
@@ -268,7 +267,7 @@
def set_amplitude(self, amplitude):
- if amplitude < self[AMPL_RANGE_KEY][0] or amplitude >
self[AMPL_RANGE_KEY][1]:
+ if amplitude < 0.0 or amplitude > 1.0:
if self._verbose: print "Amplitude out of range:", amplitude
return False
@@ -312,8 +311,8 @@
help="Generate Two Tone signal for IMD testing")
parser.add_option("--sweep", dest="type", action="store_const",
const="sweep",
help="Generate a swept sine wave")
- parser.add_option("-a", "--amplitude", type="eng_float", default=None,
- help="Set output amplitude to AMPL [default=auto]",
metavar="AMPL")
+ parser.add_option("-a", "--amplitude", type="eng_float", default=0.15,
+ help="Set output amplitude to AMPL [default=%default]",
metavar="AMPL")
parser.add_option("-v", "--verbose", action="store_true", default=False,
help="Use verbose console output [default=%default]")
Modified: gnuradio/branches/features/experimental-gui/usrp_siggen_gui.py
===================================================================
--- gnuradio/branches/features/experimental-gui/usrp_siggen_gui.py
2009-05-05 20:21:36 UTC (rev 10961)
+++ gnuradio/branches/features/experimental-gui/usrp_siggen_gui.py
2009-05-05 21:12:42 UTC (rev 10962)
@@ -195,14 +195,13 @@
self.vbox.AddSpacer(10)
self.vbox.AddStretchSpacer()
lvl_hbox.AddSpacer(5)
- ampl_range = self.tb[usrp_siggen.AMPL_RANGE_KEY]
forms.text_box(
parent=self.panel, sizer=lvl_hbox,
proportion=1,
converter=forms.float_converter(),
ps=self.tb,
key=usrp_siggen.AMPLITUDE_KEY,
- label="Level",
+ label="Level (0.0-1.0)",
)
lvl_hbox.AddSpacer(10)
forms.log_slider(
@@ -211,7 +210,7 @@
ps=self.tb,
key=usrp_siggen.AMPLITUDE_KEY,
min_exp=-5,
- max_exp=math.log(ampl_range[1], 10),
+ max_exp=0,
base=10,
step_size=1,
)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r10962 - gnuradio/branches/features/experimental-gui,
jblum <=