Skip to content

Commit 6951711

Browse files
committed
fix up verboseness & warnings
1 parent 4383b1a commit 6951711

File tree

4 files changed

+25
-12
lines changed

4 files changed

+25
-12
lines changed

specparam/objs/event.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ def __init__(self, *args, **kwargs):
6868
BaseObject3D.__init__(self,
6969
aperiodic_mode=kwargs.pop('aperiodic_mode', 'fixed'),
7070
periodic_mode=kwargs.pop('periodic_mode', 'gaussian'),
71-
debug_mode=kwargs.pop('debug_mode', 'False'),
72-
verbose=kwargs.pop('verbose', 'True'))
71+
debug_mode=kwargs.pop('debug_mode', False),
72+
verbose=kwargs.pop('verbose', True))
7373

7474
SpectralFitAlgorithm.__init__(self, *args, **kwargs)
7575

@@ -222,8 +222,7 @@ def to_df(self, peak_org=None):
222222
def _check_width_limits(self):
223223
"""Check and warn about bandwidth limits / frequency resolution interaction."""
224224

225-
# Only check & warn on first spectrogram
225+
# Only check & warn on first spectrum
226226
# This is to avoid spamming standard output for every spectrogram in the set
227-
if np.all(self.spectrograms[0] == self.spectrogram):
228-
#if self.power_spectra[0, 0] == self.power_spectrum[0]:
227+
if np.all(self.power_spectrum == self.spectrograms[0, :, 0]):
229228
super()._check_width_limits()

specparam/objs/group.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ def __init__(self, *args, **kwargs):
7474
BaseObject2D.__init__(self,
7575
aperiodic_mode=kwargs.pop('aperiodic_mode', 'fixed'),
7676
periodic_mode=kwargs.pop('periodic_mode', 'gaussian'),
77-
debug_mode=kwargs.pop('debug_mode', 'False'),
78-
verbose=kwargs.pop('verbose', 'True'))
77+
debug_mode=kwargs.pop('debug_mode', False),
78+
verbose=kwargs.pop('verbose', True))
7979

8080
SpectralFitAlgorithm.__init__(self, *args, **kwargs)
8181

specparam/objs/results.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,8 @@ class BaseResults2D(BaseResults):
339339

340340
def __init__(self, aperiodic_mode, periodic_mode, debug_mode=False, verbose=True):
341341

342-
BaseResults.__init__(self, aperiodic_mode, periodic_mode, debug_mode=False, verbose=True)
342+
BaseResults.__init__(self, aperiodic_mode, periodic_mode,
343+
debug_mode=debug_mode, verbose=verbose)
343344

344345
self._reset_group_results()
345346

@@ -615,7 +616,8 @@ class BaseResults2DT(BaseResults2D):
615616

616617
def __init__(self, aperiodic_mode, periodic_mode, debug_mode=False, verbose=True):
617618

618-
BaseResults2D.__init__(self, aperiodic_mode, periodic_mode, debug_mode=False, verbose=True)
619+
BaseResults2D.__init__(self, aperiodic_mode, periodic_mode,
620+
debug_mode=debug_mode, verbose=verbose)
619621

620622
self._reset_time_results()
621623

@@ -756,7 +758,8 @@ class BaseResults3D(BaseResults2DT):
756758

757759
def __init__(self, aperiodic_mode, periodic_mode, debug_mode=False, verbose=True):
758760

759-
BaseResults2DT.__init__(self, aperiodic_mode, periodic_mode, debug_mode=False, verbose=True)
761+
BaseResults2DT.__init__(self, aperiodic_mode, periodic_mode,
762+
debug_mode=debug_mode, verbose=verbose)
760763

761764
self._reset_event_results()
762765

specparam/objs/time.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Time model object and associated code for fitting the model to spectrograms."""
22

3+
import numpy as np
4+
35
from specparam.objs import SpectralModel
46
from specparam.objs.base import BaseObject2DT
57
from specparam.objs.algorithm import SpectralFitAlgorithm
@@ -60,8 +62,8 @@ def __init__(self, *args, **kwargs):
6062
BaseObject2DT.__init__(self,
6163
aperiodic_mode=kwargs.pop('aperiodic_mode', 'fixed'),
6264
periodic_mode=kwargs.pop('periodic_mode', 'gaussian'),
63-
debug_mode=kwargs.pop('debug_mode', 'False'),
64-
verbose=kwargs.pop('verbose', 'True'))
65+
debug_mode=kwargs.pop('debug_mode', False),
66+
verbose=kwargs.pop('verbose', True))
6567

6668
SpectralFitAlgorithm.__init__(self, *args, **kwargs)
6769

@@ -156,3 +158,12 @@ def to_df(self, peak_org=None):
156158
df = dict_to_df(self.get_results())
157159

158160
return df
161+
162+
163+
def _check_width_limits(self):
164+
"""Check and warn about bandwidth limits / frequency resolution interaction."""
165+
166+
# Only check & warn on first power spectrum
167+
# This is to avoid spamming standard output for every spectrum in the group
168+
if np.all(self.power_spectrum == self.spectrogram[:, 0]):
169+
super()._check_width_limits()

0 commit comments

Comments
 (0)