Plotting
IQ(signal, title='', alpha=1.0, label=False)
Generate I/Q plot
Parameters:
Name | Type | Description | Default |
---|---|---|---|
signal
|
ndarray
|
Complex sample data vector |
required |
title
|
str
|
Plot title |
''
|
alpha
|
float
|
Value < 1.0 allows opaque dot points, useful for high sample count clustering visualization |
1.0
|
labels
|
When True, label each point based on sample/point index |
required |
Source code in rfproto/plot.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
|
IQ_animated(signal, num_points_per_frame, title='IQ Plot', file='', fps=10)
Generate animated I/Q plot (shows I/Q over time)
NOTE: can be used in notebook with %matplotlib widget
macro at top of notebook
Parameters:
Name | Type | Description | Default |
---|---|---|---|
signal
|
ndarray
|
Complex I/Q sample data vector |
required |
num_points_per_frame
|
int
|
How many points per frame to plot |
required |
title
|
str
|
Plot title |
'IQ Plot'
|
file
|
str
|
GIF file to save to when non-empty |
''
|
fps
|
int
|
Frames per second to render animated I/Q plit |
10
|
Source code in rfproto/plot.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
|
eye(signal, SPS, num_disp_sym=2, num_sweeps=-1)
Generate eye diagram of time domain input signal
Parameters:
Name | Type | Description | Default |
---|---|---|---|
signal
|
ndarray
|
Complex I/Q sample data vector |
required |
SPS
|
int
|
Samples/Symbol ratio (NOTE: must be an integer oversampling ration (OSR) to properly render time-sliced eye |
required |
num_disp_sym
|
int
|
Number of symbols to display in eye diagram |
2
|
num_sweeps
|
int
|
Number of eye sweeps to plot, defaults to entire length of input signal |
-1
|
Source code in rfproto/plot.py
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 |
|
fft_intensity_plot(samples, fft_len=256, fft_div=2, mag_steps=100, cmap='plasma')
Real-Time Spectrum Analyzer like FFT persistence plot Based on tdsepsilon's post and notebook code
Source code in rfproto/plot.py
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 |
|
filter_coefficients(filter_coef, title='')
Plot filter coefficients
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filter_coef
|
ndarray
|
filter weights (impulse response) |
required |
title
|
str
|
Plot title |
''
|
Source code in rfproto/plot.py
57 58 59 60 61 62 63 64 65 66 67 68 |
|
filter_response(filter_coef, title='')
Plot filter frequency response
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filter_coef
|
ndarray
|
filter weights (impulse response) |
required |
title
|
str
|
Plot title |
''
|
Source code in rfproto/plot.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
|
freq_sig(freq, y, title='', scale_noise=False, y_unit='dBFS')
Plot frequency-domain input signal
Parameters:
Name | Type | Description | Default |
---|---|---|---|
freq
|
frequency bins |
required | |
y
|
frequency-domain data (same length as number of frequency bins) |
required | |
title
|
str
|
Plot title |
''
|
scale_noise
|
bool
|
don't show full noise floor extent when True |
False
|
y_unit
|
str
|
Unit for frequency bin data |
'dBFS'
|
Source code in rfproto/plot.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
|
samples(y, title='')
Plot samples (no time-base)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y
|
time-series data |
required | |
title
|
str
|
Plot title |
''
|
Source code in rfproto/plot.py
28 29 30 31 32 33 34 35 36 37 38 39 |
|
spec_an(x, fs, title='', scale_noise=False, y_unit='dBFS', norm=False, ignore_percent=0.1, fft_shift=False, show_SFDR=True)
Take PSD of time-domain input signal and plot in frequency-domain. Optionally calculate SFDR and show in plot.
Source code in rfproto/plot.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
|
time_sig(t, y, title='')
Plot samples over a given time-base
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y
|
time-series data |
required | |
t
|
time vector (same length of |
required | |
title
|
str
|
Plot title |
''
|
Source code in rfproto/plot.py
42 43 44 45 46 47 48 49 50 51 52 53 54 |
|
waterfall(x, w, fft_len, stride_len, num_rows, cmap='viridis', anim_interval=10)
Creates animated waterfall spectrogram using Short Time FFTs (STFTs). For static image generation of spectrograms, see SciPy Signal ShortTimeFFT or matplotlib specgram.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
ndarray
|
input time-domain signal |
required |
w
|
ndarray
|
array of values to use as a window for each sliding window before taking the FFT |
required |
fft_len
|
int
|
length of FFT for each step of the STFT. When > window length, the FFT is zero-padded |
required |
stride_len
|
int
|
same as hop length, how many samples to stride after each step. |
required |
num_rows
|
int
|
number of output rows in plot (e.g. number of history time steps) |
required |
cmap
|
str
|
matplotlib colormap |
'viridis'
|
Source code in rfproto/plot.py
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 |
|