Skip to content

Commit

Permalink
fix up verboseness & warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
TomDonoghue committed Apr 10, 2024
1 parent 4383b1a commit 6951711
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
9 changes: 4 additions & 5 deletions specparam/objs/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def __init__(self, *args, **kwargs):
BaseObject3D.__init__(self,
aperiodic_mode=kwargs.pop('aperiodic_mode', 'fixed'),
periodic_mode=kwargs.pop('periodic_mode', 'gaussian'),
debug_mode=kwargs.pop('debug_mode', 'False'),
verbose=kwargs.pop('verbose', 'True'))
debug_mode=kwargs.pop('debug_mode', False),
verbose=kwargs.pop('verbose', True))

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

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

# Only check & warn on first spectrogram
# Only check & warn on first spectrum
# This is to avoid spamming standard output for every spectrogram in the set
if np.all(self.spectrograms[0] == self.spectrogram):
#if self.power_spectra[0, 0] == self.power_spectrum[0]:
if np.all(self.power_spectrum == self.spectrograms[0, :, 0]):
super()._check_width_limits()
4 changes: 2 additions & 2 deletions specparam/objs/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ def __init__(self, *args, **kwargs):
BaseObject2D.__init__(self,
aperiodic_mode=kwargs.pop('aperiodic_mode', 'fixed'),
periodic_mode=kwargs.pop('periodic_mode', 'gaussian'),
debug_mode=kwargs.pop('debug_mode', 'False'),
verbose=kwargs.pop('verbose', 'True'))
debug_mode=kwargs.pop('debug_mode', False),
verbose=kwargs.pop('verbose', True))

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

Expand Down
9 changes: 6 additions & 3 deletions specparam/objs/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,8 @@ class BaseResults2D(BaseResults):

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

BaseResults.__init__(self, aperiodic_mode, periodic_mode, debug_mode=False, verbose=True)
BaseResults.__init__(self, aperiodic_mode, periodic_mode,
debug_mode=debug_mode, verbose=verbose)

self._reset_group_results()

Expand Down Expand Up @@ -615,7 +616,8 @@ class BaseResults2DT(BaseResults2D):

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

BaseResults2D.__init__(self, aperiodic_mode, periodic_mode, debug_mode=False, verbose=True)
BaseResults2D.__init__(self, aperiodic_mode, periodic_mode,
debug_mode=debug_mode, verbose=verbose)

self._reset_time_results()

Expand Down Expand Up @@ -756,7 +758,8 @@ class BaseResults3D(BaseResults2DT):

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

BaseResults2DT.__init__(self, aperiodic_mode, periodic_mode, debug_mode=False, verbose=True)
BaseResults2DT.__init__(self, aperiodic_mode, periodic_mode,
debug_mode=debug_mode, verbose=verbose)

self._reset_event_results()

Expand Down
15 changes: 13 additions & 2 deletions specparam/objs/time.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Time model object and associated code for fitting the model to spectrograms."""

import numpy as np

from specparam.objs import SpectralModel
from specparam.objs.base import BaseObject2DT
from specparam.objs.algorithm import SpectralFitAlgorithm
Expand Down Expand Up @@ -60,8 +62,8 @@ def __init__(self, *args, **kwargs):
BaseObject2DT.__init__(self,
aperiodic_mode=kwargs.pop('aperiodic_mode', 'fixed'),
periodic_mode=kwargs.pop('periodic_mode', 'gaussian'),
debug_mode=kwargs.pop('debug_mode', 'False'),
verbose=kwargs.pop('verbose', 'True'))
debug_mode=kwargs.pop('debug_mode', False),
verbose=kwargs.pop('verbose', True))

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

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

return df


def _check_width_limits(self):
"""Check and warn about bandwidth limits / frequency resolution interaction."""

# Only check & warn on first power spectrum
# This is to avoid spamming standard output for every spectrum in the group
if np.all(self.power_spectrum == self.spectrogram[:, 0]):
super()._check_width_limits()

0 comments on commit 6951711

Please sign in to comment.