8000 Fix undefined plotting arguments in Data2DT and Data3D by evadiva3 · Pull Request #414 · fooof-tools/fooof · GitHub
[go: up one dir, main page]

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions specpa 8000 ram/data/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ def add_data(self, freqs, spectrogram, freq_range=None):
def plot(self, **plt_kwargs):
"""Plot the spectrogram."""

plot_spectrogram(self.freqs, self.spectrogram, **plot_kwargs)
plot_spectrogram(self.freqs, self.spectrogram, **plt_kwargs)


@replace_docstring_sections([docs_get_section(Data.__doc__, 'Parameters'),
Expand Down Expand Up @@ -644,10 +644,10 @@ def add_data(self, freqs, spectrograms, freq_range=None):
super().add_data(freqs, spectrograms, freq_range)


def plot(self, event_ind):
def plot(self, event_ind, **plt_kwargs):
"""Plot a selected spectrogram."""

plot_spectrogram(self.freqs, self.spectrograms[event_ind, :, :], **plot_kwargs)
plot_spectrogram(self.freqs, self.spectrograms[event_ind, :, :], **plt_kwargs)


def _reset_data(self, clear_freqs=False, clear_spectrum=False,
Expand Down
10 changes: 10 additions & 0 deletions specparam/tests/data/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ def test_data2dt_add_data():
assert np.all(tdata2dt.spectrogram)
assert tdata2dt.n_spectra == tdata2dt.n_time_windows == len(pows.T)

@plot_test
def test_data2dt_plot(tdata2dt, skip_if_no_mpl):

tdata2dt.plot(cmap="viridis", aspect="auto")

## 3D Data Object

def test_data3d():
Expand All @@ -127,3 +132,8 @@ def test_data3d_add_data():
assert np.all(tdata3d.spectrograms)
assert tdata3d.n_events
assert tdata3d.n_spectra == 2 * len(pows.T)

@plot_test
def test_data3d_plot(tdata3d, skip_if_no_mpl):

tdata3d.plot(0, cmap="viridis", aspect="auto")
0