diff --git a/specparam/modes/__init__.py b/specparam/modes/__init__.py index e69de29b..03833572 100644 --- a/specparam/modes/__init__.py +++ b/specparam/modes/__init__.py @@ -0,0 +1 @@ +"""Functionality related to definining fit modes.""" diff --git a/specparam/modes/definitions.py b/specparam/modes/definitions.py index a230d46a..39bcf76a 100644 --- a/specparam/modes/definitions.py +++ b/specparam/modes/definitions.py @@ -148,3 +148,33 @@ 'skewed_gaussian' : pe_skewnorm, 'cauchy' : pe_cauchy, } + +################################################################################################### +## ALL MODES + +# Collect a store of all available modes +MODES = { + 'aperiodic' : AP_MODES, + 'periodic' : PE_MODES, +} + + +def check_modes(component, check_params=False): + """Check the set of modes that are available. + + Parameters + ---------- + component : {'aperiodic', 'periodic'} + Which component to check available modes for. + check_params : bool, optional, default: False + Whether to print out information on the parameters of each mode. + """ + + print('Available {:s} modes:'.format(component)) + for mode in MODES[component].values(): + if not check_params: + print(' {:10s} {:s}'.format(mode.name, mode.description)) + else: + print('\n{:s}'.format(mode.name)) + print(' {:s}'.format(mode.description)) + mode.check_params() diff --git a/specparam/modes/mode.py b/specparam/modes/mode.py index 596e6804..15ac972e 100644 --- a/specparam/modes/mode.py +++ b/specparam/modes/mode.py @@ -88,7 +88,6 @@ def n_params(self): def check_params(self): """Check the description of the parameters for the current mode.""" - print('Parameters for the {} component in {} mode:'.format(\ - self.component, self.name)) + print('Parameters for the {} mode:'.format(self.name)) for pkey, desc in self.params.descriptions.items(): - print('\t{:15s} {:s}'.format(pkey, desc)) + print(' {:15s} {:s}'.format(pkey, desc)) diff --git a/specparam/tests/modes/test_definitions.py b/specparam/tests/modes/test_definitions.py new file mode 100644 index 00000000..e2300a0d --- /dev/null +++ b/specparam/tests/modes/test_definitions.py @@ -0,0 +1,11 @@ +"""Tests for specparam.modes.definitions.""" + +from specparam.modes.definitions import * + +################################################################################################### +################################################################################################### + +def test_check_modes(): + + check_modes('aperiodic') + check_modes('periodic')