Skip to content

[ENH]: Show full PSD when plotting PSD+model using fm.plot() #245

Closed
@moritz-gerster

Description

@moritz-gerster

Enhancement to improve FOOOF's plotting function for better visual inspection

Current situation

The aperiodic component is often used in a narrow frequency range, for example, 30-50 Hz (Gao et al. 2017).

When calling fm.plot(), the PSD and the fitted model are only shown in the fitting range (e.g. 30-50 Hz). However, to evaluate the fit visually, I find it essential to view the full PSD (e.g. 1-100 Hz).

Why not ideal

I emphasize the importance of this with this code. For M/EEG researchers, the shown spectrum with the gigantic beta oscillation might look artificial. However, it actually perfectly resembles a true LFP signal obtained from a Parkinsonian subthalamic nucleus (Gerster et al. 2022). When applying FOOOF and evaluating the fits, I was fooled into believing, that 30-45 Hz might be a good fit range for the aperiodic component (see the first figure provided by FOOOF). It took me some time plotting the full spectrum (second figure) to realize that I was actually fitting the beta peak instead of the aperiodic component!

Suggestion

I would suggest adding another keyword argument freq_range to fm.plot(freq_range=None).

If freq_range=None, the plotted frequency range will be set to the fitting freq_range=fit_range, as currently. If freq_range="full", the entire spectrum is plotted, and if freq_range=(float1, float2) the frequency range from float1 to float2 Hz will be plotted.

It would be amazing to enable this keyword also in fm.save_report() as I usually check these reports to evaluate my fitting parameters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    idea / discussionA potential idea to consider / discuss.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions