Plots a signal decibel magnitude in frequency domain. Parameters (default), (type): ----------------------------- * sigObjs (), (list): a list with SignalObjs. * smooth (False), (bool): option for curve smoothing. Uses scipy.signal.savgol_filter
(sigObjs, smooth, xLabel, yLabel, yLim, xLim, title, decimalSep)
| 340 | |
| 341 | |
| 342 | def freq(sigObjs, smooth, xLabel, yLabel, yLim, xLim, title, decimalSep): |
| 343 | """ |
| 344 | Plots a signal decibel magnitude in frequency domain. |
| 345 | |
| 346 | Parameters (default), (type): |
| 347 | ----------------------------- |
| 348 | |
| 349 | * sigObjs (), (list): |
| 350 | a list with SignalObjs. |
| 351 | |
| 352 | * smooth (False), (bool): |
| 353 | option for curve smoothing. Uses scipy.signal.savgol_filter. |
| 354 | Preliminar implementation. Needs review. |
| 355 | |
| 356 | * xLabel ('Time [s]'), (str): |
| 357 | x axis label. |
| 358 | |
| 359 | * yLabel ('Amplitude'), (str): |
| 360 | y axis label. |
| 361 | |
| 362 | * yLim (), (list): |
| 363 | inferior and superior limits. |
| 364 | |
| 365 | >>> yLim = [-100, 100] |
| 366 | |
| 367 | * xLim (), (list): |
| 368 | left and right limits |
| 369 | |
| 370 | >>> xLim = [15, 21000] |
| 371 | |
| 372 | * title (), (str): |
| 373 | plot title |
| 374 | |
| 375 | * decimalSep (','), (str): |
| 376 | may be dot or comma. |
| 377 | |
| 378 | >>> decimalSep = ',' # in Brazil |
| 379 | |
| 380 | Return: |
| 381 | -------- |
| 382 | |
| 383 | matplotlib.figure.Figure object. |
| 384 | """ |
| 385 | if decimalSep == ',': |
| 386 | locale.setlocale(locale.LC_NUMERIC, 'pt_BR.UTF-8') |
| 387 | plt.rcParams['axes.formatter.use_locale'] = True |
| 388 | elif decimalSep =='.': |
| 389 | locale.setlocale(locale.LC_NUMERIC, 'C') |
| 390 | plt.rcParams['axes.formatter.use_locale'] = False |
| 391 | else: |
| 392 | raise ValueError("'decimalSep' must be the string '.' or ','.") |
| 393 | |
| 394 | if xLabel is None: |
| 395 | xLabel = 'Frequency [Hz]' |
| 396 | if yLabel is None: |
| 397 | yLabel = 'Magnitude [dB]' |
| 398 | if title is None: |
| 399 | title = '' |
nothing calls this directly
no test coverage detected