Skip to content

Commit dd621d7

Browse files
committed
update event reset data for consistency
1 parent 20b6dc2 commit dd621d7

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

specparam/objs/algorithm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def _reset_internal_settings(self):
194194
self._gauss_std_limits = None
195195

196196

197-
# Note: this currently overrides basefit - but once modes are used, this can be dropped (I think)
197+
# ToCheck: this currently overrides basefit - but once modes are used, this can be dropped (I think)
198198
def _reset_results(self, clear_results=False):
199199
"""Set, or reset, results attributes to empty.
200200

specparam/objs/base.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -425,9 +425,8 @@ def load(self, file_name, file_path=None, peak_org=None):
425425
self.convert_results(peak_org)
426426

427427

428-
# TO CHECK - DOES THIS GO HERE?
429-
def _reset_data_results(self, clear_freqs=False, clear_spectrum=False,
430-
clear_results=False, clear_spectra=False):
428+
def _reset_data_results(self, clear_freqs=False, clear_spectrum=False, clear_results=False,
429+
clear_spectra=False, clear_spectrograms=False):
431430
"""Set, or reset, data & results attributes to empty.
432431
433432
Parameters
@@ -440,6 +439,8 @@ def _reset_data_results(self, clear_freqs=False, clear_spectrum=False,
440439
Whether to clear model results attributes.
441440
clear_spectra : bool, optional, default: False
442441
Whether to clear power spectra attribute.
442+
clear_spectrograms : bool, optional, default: False
443+
Whether to clear spectrograms attribute.
443444
"""
444445

445446
self._reset_data(clear_freqs, clear_spectrum, clear_spectra)

specparam/objs/data.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def set_check_modes(self, check_freqs=None, check_data=None):
126126

127127

128128
def _reset_data(self, clear_freqs=False, clear_spectrum=False):
129-
"""Set, or reset, data & results attributes to empty.
129+
"""Set, or reset, data attributes to empty.
130130
131131
Parameters
132132
----------
@@ -301,7 +301,7 @@ def plot(self, plt_log=False, **plt_kwargs):
301301

302302

303303
def _reset_data(self, clear_freqs=False, clear_spectrum=False, clear_spectra=False):
304-
"""Set, or reset, data & results attributes to empty.
304+
"""Set, or reset, data attributes to empty.
305305
306306
Parameters
307307
----------
@@ -452,3 +452,24 @@ def plot(self, event_ind):
452452
"""Plot a selected spectrogram."""
453453

454454
plot_spectrogram(self.freqs, self.spectrograms[event_ind, :, :], **plot_kwargs)
455+
456+
457+
def _reset_data(self, clear_freqs=False, clear_spectrum=False,
458+
clear_spectra=False, clear_spectrograms=False):
459+
"""Set, or reset, data attributes to empty.
460+
461+
Parameters
462+
----------
463+
clear_freqs : bool, optional, default: False
464+
Whether to clear frequency attributes.
465+
clear_spectrum : bool, optional, default: False
466+
Whether to clear power spectrum attribute.
467+
clear_spectra : bool, optional, default: False
468+
Whether to clear power spectra attribute.
469+
clear_spectrograms : bool, optional, default: False
470+
Whether to clear spectrograms attribute.
471+
"""
472+
473+
super()._reset_data(clear_freqs, clear_spectrum, clear_spectra)
474+
if clear_spectrograms:
475+
self.spectrograms = None

0 commit comments

Comments
 (0)