Skip to content

Commit da122a9

Browse files
committedJan 4, 2015
qtgui: spectrogram offline plotter: changed title to just the data type read from the header. Also fixes issues with short and int support.
1 parent 028db97 commit da122a9

File tree

1 file changed

+31
-15
lines changed

1 file changed

+31
-15
lines changed
 

‎gr-qtgui/apps/gr_spectrogram_plot

+31-15
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ class spectrogram_plot_c(plot_base.plot_base):
5252
self.dsize = gr.sizeof_gr_complex
5353
self.src_type = blocks.vector_source_c
5454
self.gui_snk = qtgui.waterfall_sink_c(self._psd_size,
55-
filter.firdes.WIN_BLACKMAN_hARRIS,self._center_freq,
56-
self._samp_rate,"GNU Radio Spectrogram Plot (CPX Float)",
55+
filter.firdes.WIN_BLACKMAN_hARRIS,self._center_freq,
56+
self._samp_rate,"Complex Float",
5757
self._nsigs)
5858
self.setup()
5959

@@ -66,10 +66,10 @@ class spectrogram_plot_f(plot_base.plot_base):
6666
self.read_samples = plot_base.read_samples_f
6767
self.dsize = gr.sizeof_float
6868
self.src_type = blocks.vector_source_f
69-
self.gui_snk = qtgui.waterfall_sink_f(self._psd_size,
70-
filter.firdes.WIN_BLACKMAN_hARRIS,self._center_freq,
69+
self.gui_snk = qtgui.waterfall_sink_f(self._psd_size,
70+
filter.firdes.WIN_BLACKMAN_hARRIS,self._center_freq,
7171
self._samp_rate,
72-
"GNU Radio Spectrogram Plot (float)",
72+
"Float",
7373
self._nsigs)
7474
self.setup()
7575

@@ -82,9 +82,9 @@ class spectrogram_plot_b(plot_base.plot_base):
8282
self.read_samples = plot_base.read_samples_b
8383
self.dsize = gr.sizeof_float
8484
self.src_type = plot_base.source_chars_to_float
85-
self.gui_snk = qtgui.waterfall_sink_f(self._psd_size,
86-
filter.firdes.WIN_BLACKMAN_hARRIS,self._center_freq,
87-
self._samp_rate, "GNU Radio Spectrogram Plot (bin)",
85+
self.gui_snk = qtgui.waterfall_sink_f(self._psd_size,
86+
filter.firdes.WIN_BLACKMAN_hARRIS,self._center_freq,
87+
self._samp_rate, "Bytes",
8888
self._nsigs)
8989
self.setup()
9090

@@ -94,12 +94,29 @@ class spectrogram_plot_i(plot_base.plot_base):
9494
plot_base.plot_base.__init__(self, filelist, fc, samp_rate,
9595
psdsize, start, nsamples,
9696
max_nsamples, avg)
97+
self.read_samples = plot_base.read_samples_i
9798
self.dsize = gr.sizeof_float
9899
self.src_type = plot_base.source_ints_to_float
99-
self.gui_snk = qtgui.waterfall_sink_f(self._psd_size,
100+
self.gui_snk = qtgui.waterfall_sink_f(self._psd_size,
100101
filter.firdes.WIN_BLACKMAN_hARRIS,
101102
self._center_freq, self._samp_rate,
102-
"GNU Radio Spectrogram Plot (int)",
103+
"Integers",
104+
self._nsigs)
105+
self.setup()
106+
107+
class spectrogram_plot_s(plot_base.plot_base):
108+
def __init__(self, filelist, fc, samp_rate, psdsize, start,
109+
nsamples, max_nsamples, avg=1.0):
110+
plot_base.plot_base.__init__(self, filelist, fc, samp_rate,
111+
psdsize, start, nsamples,
112+
max_nsamples, avg)
113+
self.read_samples = plot_base.read_samples_s
114+
self.dsize = gr.sizeof_float
115+
self.src_type = plot_base.source_shorts_to_float
116+
self.gui_snk = qtgui.waterfall_sink_f(self._psd_size,
117+
filter.firdes.WIN_BLACKMAN_hARRIS,
118+
self._center_freq, self._samp_rate,
119+
"Shorts",
103120
self._nsigs)
104121
self.setup()
105122

@@ -108,7 +125,7 @@ def read_header(filelist):
108125
try:
109126
handle = open(filename,"rb")
110127
except IOError:
111-
return
128+
return
112129
hdr_start = handle.tell()
113130
header_str = handle.read(parse_file_metadata.HEADER_LENGTH)
114131
if( len(header_str) == 0 ):
@@ -121,9 +138,9 @@ def read_header(filelist):
121138
sys.exit(1)
122139
info = parse_file_metadata.parse_header(header,False)
123140
return info
124-
141+
125142
def main():
126-
description = 'Plots the spectrogram (waterfall) of a file with detached header.'
143+
description = 'Plots the spectrogram (waterfall) of a file with detached header.'
127144
description += ' Assumes header is <input_filename>.hdr'
128145
(options, args) = plot_base.setup_options(description)
129146
filelist = list(args)
@@ -133,7 +150,7 @@ def main():
133150
if not info:
134151
sys.stderr.write('Header not found\n')
135152
sys.exit(1)
136-
153+
137154
max_nsamples = plot_base.find_max_nsamples(filelist)
138155
srate = info["rx_rate"]
139156

@@ -187,4 +204,3 @@ if __name__ == "__main__":
187204
main()
188205
except KeyboardInterrupt:
189206
pass
190-

0 commit comments

Comments
 (0)
Please sign in to comment.