Skip to content

Commit d581ae0

Browse files
authored
Merge pull request #370 from fooof-tools/ntuts
[DOC] - Update / extend documentation
2 parents 9b39897 + 3706cf2 commit d581ae0

File tree

10 files changed

+920
-57
lines changed

10 files changed

+920
-57
lines changed

doc/api.rst

Lines changed: 100 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,18 @@ Functions to manipulate, examine, and analyze model objects.
6767
average_reconstructions
6868
fit_models_3d
6969

70+
Component Objects
71+
-----------------
7072

71-
Data Objects
72-
------------
73+
The model object combines multiple sub-objects that define and store different
74+
elements of the model definition, data, and results.
7375

74-
Objects to manage frequency bands, model information, and simulation parameters.
76+
Here, the main sub-objects are listed, some of which can also be used independently.
7577

76-
Bands Object
77-
~~~~~~~~~~~~
78+
Bands
79+
~~~~~
7880

79-
An object to handle frequency band definitions.
81+
An object for defining frequency band definitions.
8082

8183
.. currentmodule:: specparam
8284

@@ -85,6 +87,98 @@ An object to handle frequency band definitions.
8587

8688
Bands
8789

90+
Algorithm
91+
~~~~~~~~~
92+
93+
An object for defining fit algorithms.
94+
95+
.. currentmodule:: specparam.algorithms.algorithm
96+
97+
.. autosummary::
98+
:toctree: generated/
99+
100+
Algorithm
101+
102+
Modes
103+
~~~~~
104+
105+
An object for defining fit modes.
106+
107+
.. currentmodule:: specparam.modes.mode
108+
109+
.. autosummary::
110+
:toctree: generated/
111+
112+
Mode
113+
114+
Associated objects allow for defining mode parameters.
115+
116+
.. currentmodule:: specparam.modes.params
117+
118+
.. autosummary::
119+
:toctree: generated/
120+
121+
ParamDefinition
122+
123+
Utility to check for available fit modes.
124+
125+
.. currentmodule:: specparam.modes.definitions
126+
127+
.. autosummary::
128+
:toctree: generated/
129+
130+
check_modes
131+
132+
Metrics
133+
~~~~~~~
134+
135+
An object for defining metrics.
136+
137+
.. currentmodule:: specparam.metrics.metric
138+
139+
.. autosummary::
140+
:toctree: generated/
141+
142+
Metric
143+
144+
Utility to check for available metrics.
145+
146+
.. currentmodule:: specparam.metrics.definitions
147+
148+
.. autosummary::
149+
:toctree: generated/
150+
151+
check_metrics
152+
153+
Data
154+
~~~~
155+
156+
An object for managing data to be modeled.
157+
158+
.. currentmodule:: specparam.data.data
159+
160+
.. autosummary::
161+
:toctree: generated/
162+
163+
Data
164+
165+
Results
166+
~~~~~~~
167+
168+
An object for managing model results.
169+
170+
.. currentmodule:: specparam.results.results
171+
172+
.. autosummary::
173+
:toctree: generated/
174+
175+
Results
176+
177+
Data Objects
178+
------------
179+
180+
Objects to manage model information, and simulation parameters.
181+
88182
Model Information
89183
~~~~~~~~~~~~~~~~~
90184

doc/conf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#
55
# For a full list of documentation options, see:
66
# https://www.sphinx-doc.org/en/master/usage/configuration.html
7+
#
78

89

910
# ----------------------------------------------------------------------------
@@ -80,6 +81,7 @@
8081
# Settings for sphinx_copybutton
8182
copybutton_prompt_text = "$ "
8283

84+
8385
# -- Options for HTML output -------------------------------------------------
8486

8587
# The theme to use for HTML and HTML Help pages.
@@ -126,6 +128,7 @@
126128
def setup(app):
127129
app.add_css_file("my-styles.css")
128130

131+
129132
# -- Extension configuration -------------------------------------------------
130133

131134
# Configurations for sphinx gallery
@@ -136,6 +139,7 @@ def setup(app):
136139
'../examples/manage',
137140
'../examples/models',
138141
'../examples/plots',
142+
'../examples/customize',
139143
'../examples/sims',
140144
'../examples/analyses',
141145
'../motivations/concepts',

doc/faq.rst

Lines changed: 96 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ Frequently Asked Questions
33

44
The following is a collection of frequently asked questions and answers about spectral parameterization.
55

6-
These answers focus on the ideas and concepts relating to parameterizing neural power spectra.
7-
8-
For code related questions, check out the API listing, tutorials, and examples.
6+
The questions and answers here focus on the key ideas and concept relating to the approach.
7+
For code related questions and examples, check out the API listing and tutorials.
98

109
Table of Contents
1110
-----------------
@@ -16,23 +15,46 @@ Table of Contents
1615
What is spectral parameterization?
1716
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1817

19-
Spectral parameterization means fitting a model to describe power spectra.
20-
A particular algorithm and implementation for doing this is available in `specparam`,
21-
an open-source Python module for parameterizing neural power spectra.
18+
Spectral parameterization means fitting a model to describe a power spectrum.
19+
The `specparam` module implements a framework for fitting models to power spectra,
20+
available in an open-source Python module.
2221

23-
Spectral parameterization uses a model-driven approach that assumes that neurophysiological time
24-
series are comprised of two separable components, reflecting periodic (or oscillatory) and
25-
aperiodic activity. This approach relies on the assumption that these two components are indeed separable
26-
components of the underlying data, though it is agnostic to their physiological origin and
27-
putative functional roles.
22+
How does spectral parameterization work?
23+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2824

29-
Spectral parameterization operates on frequency representations of neurophysiological times
30-
series (power spectra). At it's core, the module contains an algorithm to measure these two
31-
components - the periodic and aperiodic components - in power spectra. The final model
32-
of the neural power spectrum consists of quantifications of each of the two components, as well as
33-
a combined model fit of the whole power spectrum.
25+
Spectral parameterization operates on frequency representations (power spectra) of digital
26+
signals (time series). Broadly speaking, the module contains model definitions for how to
27+
characterize each component (periodic and aperiodic) and algorithms to fit these definitions
28+
to power spectra. The resulting model of the power spectrum consists of quantifications of
29+
each of the two components, as well as a combined model fit of the whole power spectrum.
30+
For more information on the approach, including descriptions of the model definitions
31+
and algorithms, see the Tutorials.
32+
33+
What was spectral parameterization originally designed for?
34+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35+
36+
The original use case of spectral parameterization was for analyzing
37+
neuro-electrophysiological data. Due to this, across the documentation,
38+
the vast majority of the discussion of the use of spectral parameterization
39+
refers to the use case of neuro-electrophysiological data.
40+
41+
What data can this be applied to? Can it be used on non-neural data?
42+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43+
44+
Spectral parameterization can, in theory, be applied to any power spectra,
45+
including non-neural power spectra. Following developments and generalizations of the module,
46+
starting with the specparam 2.0 release version, the module should now be more easily
47+
customizable and applicable to other data types. In practice, any application of spectral
48+
parameterization needs to evaluate if the model fitting procedures are well posed
49+
for the specific use case (see Tutorials for more details).
50+
51+
What is needed to parameterize a power spectrum?
52+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3453

35-
The full mathematical description of the model is described in the tutorials.
54+
In order for spectral parameterization to work for a given application, the chosen
55+
model definition has to be appropriate for the data under study, and the chosen fitting
56+
algorithm has to be appropriate for fitting this model to the data. See discussions throughout
57+
the tutorials on choosing model forms and fit algorithms.
3658

3759
What is meant by 'aperiodic' activity?
3860
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -58,12 +80,26 @@ and detectable by the fitting algorithm if they exhibit as band-limited power ov
5880
the aperiodic component in the power spectrum. This 'peak' of power over the aperiodic is taken as
5981
evidence of frequency specific power, distinct from the aperiodic component.
6082

61-
Note that this periodic activity need not be continuous, as oscillatory activity often
62-
exhibits as 'bursts' in the time series, nor sinusoidal, as rhythmic neural activity is
63-
often non-sinusoidal.
83+
Note that, in the time domain, this periodic activity need not strictly be continuous nor
84+
completely sinusoidal, as variability in oscillatory activity is still typically reflected
85+
as peaks of power in the spectral domain.
6486

65-
Why should I parameterize power spectra?
66-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
87+
For example, in neural data, oscillatory activity often exhibits as 'bursts' in the time series,
88+
which are often at least somewhat non-sinusoidal, which can still be seen as peaks in the power
89+
spectrum (though see notes on interpreting peaks of power).
90+
91+
What are the assumptions of spectral parameterization?
92+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
93+
94+
Spectral parameterization uses a model-driven approach that assumes that the data under study
95+
are comprised of two separately measure-able components, reflecting periodic (or oscillatory)
96+
and aperiodic activity. This approach therefore relies on the assumption that these two components
97+
are indeed separable components of the power spectrum as observed by the model. The model is
98+
broadly agnostic to the relationship(s) between the components, their origin(s) in the generative
99+
process that created the data, and their putative functional roles.
100+
101+
Why should I parameterize neural power spectra?
102+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
67103

68104
Though research often focuses on periodic (rhythmic or oscillatory) components, neurophysiological
69105
recordings of electrophysiological neural activity contain not only periodic, but also aperiodic
@@ -90,8 +126,8 @@ For more discussion and examples of the conceptual and methodological factors th
90126
motivate parameterizing neural power spectra, see the
91127
`motivations page <https://fooof-tools.github.io/fooof/auto_motivations/index.html>`_
92128

93-
Why is it important to measure aperiodic activity?
94-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
129+
Why is it important to measure aperiodic neural activity?
130+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
95131

96132
Aperiodic activity has long known to be present in neural data, but has been less of a
97133
research focus (as compared to periodic activity). Recent work has demonstrated
@@ -207,20 +243,22 @@ is a Python tool for analyzing neural oscillations and their waveform shape prop
207243
Why is parameterizing neural power spectra different from other methods?
208244
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
209245

210-
There are many existing methods for analyzing periodic activity, and also other methods for
211-
analyzing aperiodic activity. Most existing methods are designed to measure one or the other
212-
signal component. Few methods attempt to explicitly separate and quantify both the periodic
213-
and aperiodic components of the signal. This combined approach is a key factor that we
214-
consider to be important for getting the measurements to work well. By jointly measuring
215-
both components, the method is more capable of quantifying which aspects of the data
216-
are changing and in what ways.
246+
Within neuroscience, there are many existing methods for analyzing periodic activity,
247+
and also other methods for analyzing aperiodic activity. Historically, fewer methods have
248+
been developed that attempt to explicitly separate and quantify both the periodic and
249+
aperiodic components of the signal. As such, at the time of the original development of specparam,
250+
most existing methods were designed to measure one pre-specified signal component
251+
(periodic or aperiodic). Using the combined approach of spectral parameterization (considering
252+
and measuring both components together) is therefore a key factor that is different from
253+
many other approaches. The goal is that by jointly measuring both components, the method should be
254+
more capable of quantifying which aspects of the data are changing and in what ways.
217255

218-
More in depth analyses of the properties of the fitting algorithm, and systematic comparisons
219-
with other methods (through simulations) are are also ongoing, to clarify when and how
220-
this approach compares to different methods.
256+
Since the original development of the method, there has been significant development of other
257+
methods (partially summarized here: [7_]) and work comparing between different methods.
258+
Check the current literature for more discussion of these topics.
221259

222-
What data modalities can be used for parameterizing neural power spectra?
223-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
260+
What neuroscience modalities can be analyzed with spectral parameterization?
261+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
224262

225263
The power spectrum model can theoretically be applied to power spectra derived from any
226264
electrophysiological or magnetophysiological signal of neural origin. In practice, this
@@ -369,15 +407,18 @@ one or the other might be more appropriate.
369407
Is there a time resolved version?
370408
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
371409

372-
Since it operates on frequency representations (power spectra) the power spectrum model is not,
373-
by construction, a time resolved method.
410+
Yes, as of the specparam 2.0 version, the module includes functionality to fit models across
411+
time (across spectrograms).
374412

375-
However, similar to other frequency estimation approaches that are used in a time-resolved manner,
376-
it can, in theory, be applied in a sliding window fashion. This approach could be used to estimate
377-
spectral features across time, somewhat analogous to a spectrogram.
413+
Note that as it operates in the frequency domain, in order to be able to analyze data over time,
414+
the model is applied to individual windows over data, whereby each window reflects a time-segment
415+
of data. By fitting models across a series of windows, spectral parameterization results
416+
can be examined across time (across windows). In doing so, it is therefore important to
417+
consider the spectral estimation, in terms of key details such as window size, method of
418+
estimation, window overlap, etc, in order to make sure the models are well fit and to
419+
appropriately interpret the results.
378420

379-
This functionality is not currently available or described in the current module, but is a focus
380-
off current work. We hope to add information, guidelines, and tooling to do this once this soon.
421+
See more information on this functionality in the tutorials.
381422

382423
What is the 'FOOOF' name?
383424
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -389,6 +430,13 @@ we have moved away from using these terms in the module and algorithm, now prefe
389430
as 'periodic' and 'aperiodic' activity, the module has been renamed to the more general name
390431
of 'spectral parameterization'.
391432

433+
In addition, the generalizability of the approach has changed with the different versions of the
434+
code. The `fooof` versions of the module can be though of as implementing a particular model
435+
definition and specific algorithm for parameterizing neural power spectra. By comparison, the
436+
`specparam` versions of the module are designed to enable flexible model definition and application
437+
to power spectra across different contexts (while still also including the original
438+
specific functionality from fooof).
439+
392440
How do I cite this method?
393441
~~~~~~~~~~~~~~~~~~~~~~~~~~
394442

@@ -424,3 +472,8 @@ References
424472
- [6_] He (2014). Scale-free Brain Activity: Past, Present and Future. DOI: 10.1016/j.tics.2014.04.003
425473

426474
.. _6 : https://doi.org/10.1016/j.tics.2014.04.003
475+
476+
- [7_] Donoghue & Watrous (2023). How Can We Differentiate Narrow-Band Oscillations from Aperiodic Activity?
477+
DOI: 10.1007/978-3-031-20910-9_22
478+
479+
.. _7 : https://doi.org/10.1007/978-3-031-20910-9_22

examples/customize/README.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Customize
2+
---------
3+
4+
Examples of customizing the fitting processes.

0 commit comments

Comments
 (0)