Skip to content

Commit c029510

Browse files
committed
interim updates data & results docs
1 parent 8497ec1 commit c029510

File tree

2 files changed

+86
-7
lines changed

2 files changed

+86
-7
lines changed

specparam/objs/data.py

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@ class Data():
3535
If True, checks the power values and raises an error for any NaN / Inf values.
3636
format : {'power'}
3737
The representation format of the data.
38+
39+
Attributes
40+
----------
41+
freqs : 1d array
42+
Frequency values for the power spectrum.
43+
power_spectrum : 1d array
44+
Power values, stored internally in log10 scale.
45+
freq_range : list of [float, float]
46+
Frequency range of the power spectrum, as [lowest_freq, highest_freq].
47+
freq_res : float
48+
Frequency resolution of the power spectrum.
3849
"""
3950

4051
def __init__(self, check_freqs=True, check_data=True, format='power'):
@@ -278,7 +289,20 @@ def _prepare_data(self, freqs, powers, freq_range, spectra_dim=1):
278289

279290

280291
class Data2D(Data):
281-
"""Base object for managing data for spectral parameterization - for 2D data."""
292+
"""Base object for managing data for spectral parameterization - for 2D data.
293+
294+
Attributes
295+
----------
296+
freqs : 1d array
297+
Frequency values for the power spectra.
298+
power_spectra : 2d array
299+
Power values for the group of power spectra, as [n_power_spectra, n_freqs].
300+
Power values are stored internally in log10 scale.
301+
freq_range : list of [float, float]
302+
Frequency range of the power spectra, as [lowest_freq, highest_freq].
303+
freq_res : float
304+
Frequency resolution of the power spectra.
305+
"""
282306

283307
def __init__(self):
284308
"""Initialize Data2D object."""
@@ -362,7 +386,20 @@ def decorated(*args, **kwargs):
362386

363387

364388
class Data2DT(Data2D):
365-
"""Base object for managing data for spectral parameterization - for 2D transposed data."""
389+
"""Base object for managing data for spectral parameterization - for 2D transposed data.
390+
391+
Attributes
392+
----------
393+
freqs : 1d array
394+
Frequency values for the spectrogram.
395+
spectrogram : 2d array
396+
Power values for the spectrogram, as [n_freqs, n_time_windows].
397+
Power values are stored internally in log10 scale.
398+
freq_range : list of [float, float]
399+
Frequency range of the spectrogram, as [lowest_freq, highest_freq].
400+
freq_res : float
401+
Frequency resolution of the spectrogram.
402+
"""
366403

367404
def __init__(self):
368405
"""Initialize Data2DT object."""
@@ -415,7 +452,20 @@ def plot(self, **plt_kwargs):
415452

416453

417454
class Data3D(Data2DT):
418-
"""Base object for managing data for spectral parameterization - for 3D data."""
455+
"""Base object for managing data for spectral parameterization - for 3D data.
456+
457+
Attributes
458+
----------
459+
freqs : 1d array
460+
Frequency values for the power spectra.
461+
spectrograms : 3d array
462+
Power values for the spectrograms, organized as [n_events, n_freqs, n_time_windows].
463+
Power values are stored internally in log10 scale.
464+
freq_range : list of [float, float]
465+
Frequency range of the power spectra, as [lowest_freq, highest_freq].
466+
freq_res : float
467+
Frequency resolution of the power spectra.
468+
"""
419469

420470
def __init__(self):
421471
"""Initialize Data3D object."""

specparam/objs/results.py

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from specparam.utils.array import unlog
1212
from specparam.utils.checks import check_inds, check_array_dim
1313
from specparam.modutils.errors import NoModelError
14+
from specparam.modutils.docs import docs_get_section, replace_docstring_sections
1415
from specparam.data.data import FitResults
1516
from specparam.data.conversions import group_to_dict, event_group_to_dict
1617
from specparam.data.utils import (get_model_params, get_group_params,
@@ -26,7 +27,17 @@
2627

2728

2829
class Results():
29-
"""Object for managing results - base / 1D version."""
30+
"""Object for managing results - base / 1D version.
31+
32+
Parameters
33+
----------
34+
modes : Modes
35+
Modes object with fit mode definitions.
36+
metrics : Metrics
37+
Metrics object with metric definitions.
38+
bands : bands
39+
Bands object with band definitions.
40+
"""
3041
# pylint: disable=attribute-defined-outside-init, arguments-differ
3142

3243
def __init__(self, modes=None, metrics=None, bands=None):
@@ -294,8 +305,14 @@ def _regenerate_model(self, freqs):
294305
return_components=True)
295306

296307

308+
@replace_docstring_sections([docs_get_section(Results.__doc__, 'Parameters')])
297309
class Results2D(Results):
298-
"""Object for managing results - 2D version."""
310+
"""Object for managing results - 2D version.
311+
312+
Parameters
313+
----------
314+
% copied in from Results
315+
"""
299316

300317
def __init__(self, modes=None, metrics=None, bands=None):
301318
"""Initialize Results2D object."""
@@ -457,8 +474,14 @@ def get_params(self, name, field=None):
457474
return get_group_params(self.group_results, self.modes, name, field)
458475

459476

477+
@replace_docstring_sections([docs_get_section(Results.__doc__, 'Parameters')])
460478
class Results2DT(Results2D):
461-
"""Object for managing results - 2D transpose version."""
479+
"""Object for managing results - 2D transpose version.
480+
481+
Parameters
482+
----------
483+
% copied in from Results
484+
"""
462485

463486
def __init__(self, modes=None, metrics=None, bands=None):
464487
"""Initialize Results2DT object."""
@@ -510,8 +533,14 @@ def convert_results(self):
510533
self.time_results = group_to_dict(self.group_results, self.modes, self.bands)
511534

512535

536+
@replace_docstring_sections([docs_get_section(Results.__doc__, 'Parameters')])
513537
class Results3D(Results2DT):
514-
"""Object for managing results - 3D version."""
538+
"""Object for managing results - 3D version.
539+
540+
Parameters
541+
----------
542+
% copied in from Results
543+
"""
515544

516545
def __init__(self, modes=None, metrics=None, bands=None):
517546
"""Initialize Results3D object."""

0 commit comments

Comments
 (0)