Skip to content

Commit

Permalink
Add example in which fitting failes to aperiodic tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
TomDonoghue committed Feb 7, 2019
1 parent 0aaadfc commit a4634f6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
2 changes: 0 additions & 2 deletions doc/conf.py
Expand Up @@ -126,8 +126,6 @@
'source_link_position': False
}

# Nice other theme options: sandstone

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
Expand Down
30 changes: 29 additions & 1 deletion tutorials/plot_05-AperiodicFitting.py
Expand Up @@ -62,7 +62,7 @@

# Fit FOOOF model
# Note that this time we're specifying an optional parameter to plot in log-log
fm.report(freqs, spectrum, [2, 60], plt_log=True)
fm.report(freqs, spectrum, [2, 70], plt_log=True)

###################################################################################################
# A note on interpreting the "knee" parameter
Expand All @@ -89,6 +89,34 @@
# knee & exponent values should be considered together.
#

###################################################################################################
# Example: Aperiodic Fitting Gone Wrong
# -------------------------------------
#
# In the example above, we jumped directly to fitting with a knee.
#
# Here we will explore what it looks like if we don't use the appropriate
# background fitting - fitting a 'fixed' background when we should use 'knee'
#

###################################################################################################

# Create and fit a FOOOF model in fixed mode to the same data as above
fm = FOOOF(peak_width_limits=[2, 8], aperiodic_mode='fixed')
fm.report(freqs, spectrum, [2, 70], plt_log=True)

###################################################################################################
#
# In this case, we see that the 'fixed' aperiodic component (equivalent to a line
# in log-log space) is not able to capture the data, which has a curve.
#
# To compensate, the model adds extra peaks, but these are also not a good
# characterization of the data.
#
# In this exampe, the data, over this frequency range, needs to be fit in
# 'knee' mode to be able to appropriately characterize the data.
#

###################################################################################################
# Choosing an Aperiodic Fitting Procedure
# ---------------------------------------
Expand Down

0 comments on commit a4634f6

Please sign in to comment.