@@ -52,8 +52,8 @@ class spectrogram_plot_c(plot_base.plot_base):
52
52
self .dsize = gr .sizeof_gr_complex
53
53
self .src_type = blocks .vector_source_c
54
54
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" ,
57
57
self ._nsigs )
58
58
self .setup ()
59
59
@@ -66,10 +66,10 @@ class spectrogram_plot_f(plot_base.plot_base):
66
66
self .read_samples = plot_base .read_samples_f
67
67
self .dsize = gr .sizeof_float
68
68
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 ,
71
71
self ._samp_rate ,
72
- "GNU Radio Spectrogram Plot (float)" ,
72
+ "Float" ,
73
73
self ._nsigs )
74
74
self .setup ()
75
75
@@ -82,9 +82,9 @@ class spectrogram_plot_b(plot_base.plot_base):
82
82
self .read_samples = plot_base .read_samples_b
83
83
self .dsize = gr .sizeof_float
84
84
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" ,
88
88
self ._nsigs )
89
89
self .setup ()
90
90
@@ -94,12 +94,29 @@ class spectrogram_plot_i(plot_base.plot_base):
94
94
plot_base .plot_base .__init__ (self , filelist , fc , samp_rate ,
95
95
psdsize , start , nsamples ,
96
96
max_nsamples , avg )
97
+ self .read_samples = plot_base .read_samples_i
97
98
self .dsize = gr .sizeof_float
98
99
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 ,
100
101
filter .firdes .WIN_BLACKMAN_hARRIS ,
101
102
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" ,
103
120
self ._nsigs )
104
121
self .setup ()
105
122
@@ -108,7 +125,7 @@ def read_header(filelist):
108
125
try :
109
126
handle = open (filename ,"rb" )
110
127
except IOError :
111
- return
128
+ return
112
129
hdr_start = handle .tell ()
113
130
header_str = handle .read (parse_file_metadata .HEADER_LENGTH )
114
131
if ( len (header_str ) == 0 ):
@@ -121,9 +138,9 @@ def read_header(filelist):
121
138
sys .exit (1 )
122
139
info = parse_file_metadata .parse_header (header ,False )
123
140
return info
124
-
141
+
125
142
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.'
127
144
description += ' Assumes header is <input_filename>.hdr'
128
145
(options , args ) = plot_base .setup_options (description )
129
146
filelist = list (args )
@@ -133,7 +150,7 @@ def main():
133
150
if not info :
134
151
sys .stderr .write ('Header not found\n ' )
135
152
sys .exit (1 )
136
-
153
+
137
154
max_nsamples = plot_base .find_max_nsamples (filelist )
138
155
srate = info ["rx_rate" ]
139
156
@@ -187,4 +204,3 @@ if __name__ == "__main__":
187
204
main ()
188
205
except KeyboardInterrupt :
189
206
pass
190
-
0 commit comments