Achilleas A. wrote:
Hi,
it would be very useful to have a
wx sink that displays the value of its input.
This way we can check in real time values
that change slowly (eg, snr, bit error rate, etc.)
Your widh is my command:
Attached is a patch which adds a number_sink_f and number_sink_c to
gr-wxgui.
You must apply it in the root of your gnuradio tree.
patch -p0 <numbersink.patch
You can also find it in gr-wxgui in my work-in-progress development tree
in svn:
gnuradio/branches/developers/nldudok1/general-wip
You use it in the following way:
from gnuradio.wxgui import numbersink
numsink = numbersink.number_sink_f (self, panel,
unit=‘volts’,label=“input level”, avg_alpha=1.0e-5,average=True,
sample_rate=input_rate/sw_decim,
factor=1.0,base_value=0,
minval=-100.0, maxval=100.0,
ref_level=0, decimal_places=5,number_rate=15)
vbox.Add (numsink.win, 1, wx.EXPAND)
self.connect(some_float_source,numsink)
You can set several options by right-mouse-click.
(Show gauge, number of digits, avaraging)
You use it just like an oscope or fft sink.
the parameters:
fg flowgraph, the flowgraph (use self if you work with a
stdgui.gui_flow_graph)
parent wxguipanel, The wxgui parent (use panel if you work with a
stdgui.gui_flow_graph)
unit string, the unit you want to display, for example ‘volt’ or
‘Watt’, free text.
base_value float, an offset which is added to the value
minval float, min value for the gauge
maxval float, max value for the gauge
factor float, scaling factor, value is multiplied by this (sort of
gain)
decimal_places int, the number of decimal places shown
ref_level ignored (API compatibility with scope and fft-sink)
sample_rate float, samplerate of input
number_rate float or int, rate at which values are displayed
(framerate, default is 15)
average bool, use averaging or not
avg_alpha float, average alpha, determines the speed of averaging
label string, the label which goes with this value (for example
‘frequency’ or ‘input power’)
size default=(640,240), the graphical size of this numbersink
peak_hold bool, hold at peak or not.
Unfortunately there is no how_to_write_a_wx_block
so I have no idea how to go about it.
If someone can help me by providing a stripped down
version of one of the wx sinks (*eg, the oscope, or fft)
then I can take a crack at it.
Even better if one can implement this
I hope you like it.
Eric, is this maybe something for trunk.
I don’t know if the code is clean enough.
Greetings,
Martin