|
10 | 10 | from specparam.core.errors import DataError, InconsistentDataError |
11 | 11 | from specparam.data import SpectrumMetaData |
12 | 12 | from specparam.plts.settings import PLT_COLORS |
13 | | -from specparam.plts.spectra import plot_spectra |
| 13 | +from specparam.plts.spectra import plot_spectra, plot_spectrogram |
14 | 14 | from specparam.plts.utils import check_plot_kwargs |
15 | 15 |
|
16 | 16 | ################################################################################################### |
@@ -381,6 +381,12 @@ def add_data(self, freqs, spectrogram, freq_range=None): |
381 | 381 | super().add_data(freqs, spectrogram, freq_range) |
382 | 382 |
|
383 | 383 |
|
| 384 | + def plot(self, **plt_kwargs): |
| 385 | + """Plot the spectrogram.""" |
| 386 | + |
| 387 | + plot_spectrogram(self.freqs, self.spectrogram, **plot_kwargs) |
| 388 | + |
| 389 | + |
384 | 390 | class BaseData3D(BaseData2DT): |
385 | 391 | """Base object for managing data for spectral parameterization - for 3D data.""" |
386 | 392 |
|
@@ -440,3 +446,9 @@ def add_data(self, freqs, spectrograms, freq_range=None): |
440 | 446 | # Otherwise, pass through 2d array to underlying object method |
441 | 447 | else: |
442 | 448 | super().add_data(freqs, spectrograms, freq_range) |
| 449 | + |
| 450 | + |
| 451 | + def plot(self, event_ind): |
| 452 | + """Plot a selected spectrogram.""" |
| 453 | + |
| 454 | + plot_spectrogram(self.freqs, self.spectrograms[event_ind, :, :], **plot_kwargs) |
0 commit comments