### Install FOOOF (Editable Version) Source: https://github.com/fooof-tools/fooof/blob/main/doc/index.md Installs an editable version of FOOOF by cloning the repository and installing with the -e flag. ```shell git clone https://github.com/fooof-tools/fooof pip install -e . ``` -------------------------------- ### Install fooof (Development Version) Source: https://github.com/fooof-tools/fooof/blob/main/README.rst Install the current development version of fooof by cloning the repository and installing locally. This provides access to the latest features but may be less stable. ```shell git clone https://github.com/fooof-tools/fooof cd fooof pip install . ``` -------------------------------- ### Install fooof (Stable Version) Source: https://github.com/fooof-tools/fooof/blob/main/README.rst Install the latest stable release of the fooof package using pip. This is the recommended version for most users. ```shell pip install fooof ``` -------------------------------- ### Install fooof with Conda Source: https://github.com/fooof-tools/fooof/blob/main/README.rst Install the fooof package from the conda-forge channel using conda. This is an alternative installation method for users who prefer conda. ```shell conda install -c conda-forge fooof ``` -------------------------------- ### Install fooof (Editable Version) Source: https://github.com/fooof-tools/fooof/blob/main/README.rst Install an editable version of fooof for development purposes. This allows you to modify the code and see changes reflected immediately without reinstalling. ```shell git clone https://github.com/fooof-tools/fooof cd fooof pip install -e . ``` -------------------------------- ### Install specparam (Release Candidate) Source: https://github.com/fooof-tools/fooof/blob/main/README.rst Install the current release candidate version of specparam for the upcoming 2.0 release. Note that this version is not finalized and may undergo further changes. ```shell pip install specparam ``` -------------------------------- ### Check specparam version Source: https://github.com/fooof-tools/fooof/blob/main/doc/reference.md Retrieve the currently installed version of the specparam module. ```python # Check the version of the tool from specparam import __version__ as specparam_version print('Current specparam version:', specparam_version) ``` -------------------------------- ### FOOOF Class Documentation Source: https://github.com/fooof-tools/fooof/blob/main/doc/_templates/autosummary/class.rst Documentation for the main FOOOF class, including its initialization, methods, and attributes. ```APIDOC ## FOOOF Class ### Description Represents the main FOOOF class for fitting the power spectrum. ### Methods #### `__init__` Initializes the FOOOF object. #### Other Methods (List of other methods will be dynamically generated based on the FOOOF class definition) ### Attributes (List of attributes will be dynamically generated based on the FOOOF class definition) ### Examples (Examples will be dynamically generated based on the FOOOF class definition) ``` -------------------------------- ### Function Documentation Template Source: https://github.com/fooof-tools/fooof/blob/main/doc/_templates/autosummary/function.rst Standard documentation format for FOOOF library functions. ```APIDOC ## Function Reference ### Description This documentation covers the usage of the specified function within the FOOOF module. ### Usage - **Module**: {{ module }} - **Function**: {{ objname }} ### Examples Refer to the included examples file: {{fullname}}.examples ``` -------------------------------- ### Fit and Report a Single Power Spectrum Source: https://github.com/fooof-tools/fooof/blob/main/README.rst Initialize the SpectralModel, define the frequency range, and then parameterize the power spectrum. The report method fits the model, plots the results, and prints a summary. ```python from specparam import SpectralModel fm = SpectralModel() freq_range = [3, 40] fm.report(freqs, spectrum, freq_range) ``` -------------------------------- ### FOOOF Fitting Method Source: https://github.com/fooof-tools/fooof/blob/main/doc/_templates/data_object.rst Details on how to use the `fit` method of the FOOOF object to analyze power spectra. ```APIDOC ## fit Method ### Description Fits the FOOOF model to a given power spectrum. ### Method `fit(freqs, power_spectrum)` ### Endpoint N/A (Method of FOOOF class) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A (Parameters are passed directly to the method) - **freqs** (array-like) - Required - The frequency bins corresponding to the power spectrum. - **power_spectrum** (array-like) - Required - The power spectral density values. ### Request Example ```python import numpy as np from fooof import FOOOF # Example frequency bins and power spectrum data freqs = np.arange(1, 50, 0.5) # Simulate some power spectrum data (e.g., with a peak) simulated_power = 10**(-1.5) * (freqs**(-1.5)) + 2 * (1 / (1 + ((freqs - 10)/1)**2)) fooof_obj = FOOOF() fooof_obj.fit(freqs, simulated_power) ``` ### Response #### Success Response (fit) The FOOOF object is updated with the fitting results, including model parameters, goodness of fit, and error metrics. #### Response Example ```python # After fitting, you can access results like: print(f"Number of peaks found: {fooof_obj.n_peaks}") print(f"R-squared: {fooof_obj.r_squared:.2f}") # Example output: # Number of peaks found: 1 # R-squared: 0.95 ``` ``` -------------------------------- ### Utilities Source: https://github.com/fooof-tools/fooof/blob/main/doc/api.md General utilities for spectral analysis and array manipulation. ```APIDOC ## Utilities ### Spectral Utilities ### Array Utilities ``` -------------------------------- ### Extract methods reporting information Source: https://github.com/fooof-tools/fooof/blob/main/doc/reference.md Print the necessary configuration and metadata from a model object for inclusion in a methods section. ```python # Import the utility to print out information for reporting from specparam.utils.reports import methods_report_info # Print out all the methods information for reporting methods_report_info(model_obj) ``` -------------------------------- ### Fit a Group of Power Spectra Source: https://github.com/fooof-tools/fooof/blob/main/README.rst Initialize SpectralGroupModel with desired parameters and fit it to a matrix of power spectra. This allows for group-level analysis of spectral data. ```python from specparam import SpectralGroupModel fg = SpectralGroupModel(peak_width_limits=[1.0, 8.0], max_n_peaks=8) fg.fit(freqs, spectra) fg.save_report() fg.save(file_name='group_results', save_results=True) ``` -------------------------------- ### FOOOF Plotting Methods Source: https://github.com/fooof-tools/fooof/blob/main/doc/_templates/data_object.rst Documentation for methods used to visualize the FOOOF model fits and results. ```APIDOC ## Plotting Methods (e.g., `plot`, `plot_model`, `plot_components`) ### Description Provides methods to visualize the power spectrum, the fitted FOOOF model, and its components. ### Method - `plot(freqs, power_spectrum, **plot_kwargs)` - `plot_model(ax=None, **plot_kwargs)` - `plot_components(ax=None, **plot_kwargs)` ### Endpoint N/A (Methods of FOOOF class) ### Parameters - **freqs** (array-like) - Required for `plot` - The frequency bins. - **power_spectrum** (array-like) - Required for `plot` - The power spectral density values. - **ax** (matplotlib.axes.Axes, optional) - For `plot_model` and `plot_components`, allows plotting on a pre-existing axes. - **plot_kwargs** (dict, optional) - Additional keyword arguments passed to the plotting functions. ### Request Example ```python import matplotlib.pyplot as plt from fooof import FOOOF # Assuming fooof_obj is already fitted with freqs and power_spectrum # fooof_obj.fit(freqs, power_spectrum) # Plot the fit fooof_obj.plot() plt.show() # Plot only the model fig, ax = plt.subplots() fooof_obj.plot_model(ax=ax) plt.show() ``` ### Response #### Success Response (Plotting) Generates matplotlib plots visualizing the power spectrum and the FOOOF model fit. #### Response Example (Visual output, no direct code example for the plot itself, but the code above generates it.) ``` -------------------------------- ### FOOOF Class Documentation Source: https://github.com/fooof-tools/fooof/blob/main/doc/_templates/data_object.rst Documentation for the main FOOOF class, which is used to fit the power spectrum of neural data. ```APIDOC ## FOOOF Class ### Description Represents the core object for fitting the power spectrum of neural oscillations using the FOOOF model. ### Method N/A (Class definition) ### Endpoint N/A (Library class) ### Parameters This class takes various parameters during initialization to configure the fitting process. Refer to the FOOOF documentation for a detailed list of parameters such as `peak_width_limits`, `max_n_peaks`, `min_peak_height`, etc. ### Request Example ```python from fooof import FOOOF # Example initialization with custom parameters fooof_obj = FOOOF(peak_width_limits=[1, 8], max_n_peaks=3, min_peak_height=0.5) ``` ### Response #### Success Response (Initialization) An instance of the FOOOF class is created. #### Response Example ```python # fooof_obj is now an initialized FOOOF object print(type(fooof_obj)) # Output: ``` ``` -------------------------------- ### Define SpectralModel Settings Source: https://github.com/fooof-tools/fooof/blob/main/README.rst Initialize a SpectralModel object with custom settings for peak fitting and aperiodic parameterization. These settings control the fitting process and the resulting model. ```python fm = SpectralModel(peak_width_limits=[1.0, 8.0], max_n_peaks=6, min_peak_height=0.1, peak_threshold=2.0, aperiodic_mode='fixed') ``` -------------------------------- ### Input / Output (IO) Source: https://github.com/fooof-tools/fooof/blob/main/doc/api.md Functions related to input and output operations for power spectrum models. ```APIDOC ## Input / Output (IO) ``` -------------------------------- ### Plotting Functions Source: https://github.com/fooof-tools/fooof/blob/main/doc/api.md Visualizations for power spectra, model properties, objects, and annotated plots, along with utilities for plot styling. ```APIDOC ## Plotting Functions Visualizations. ### Plot Power Spectra Plots for visualizing power spectra and spectrograms. Plots for plotting power spectra with shaded regions. ### Plot Model Properties & Parameters ### Plot Model Objects ### Annotated Plots ### Plot Utilities & Styling ``` -------------------------------- ### Data Objects Source: https://github.com/fooof-tools/fooof/blob/main/doc/api.md Objects to manage model information, simulation parameters, periodic components, and frequency bands. ```APIDOC ## Data Objects Objects to manage model information, and simulation parameters. ### Model Information Objects to store settings, metadata and results for power spectrum models. ### Simulation Parameters Object to store information about simulated data. ### Periodic Components Functions for accessing the periodic components of model fits. **Object Inputs** The following functions take in model objects directly, which is the typical use case. **Array Inputs** The following functions operate on arrays of peak parameters, which may be useful for more custom work-flows. ### Bands An object for defining frequency band definitions. ``` -------------------------------- ### Generate automated methods report text Source: https://github.com/fooof-tools/fooof/blob/main/doc/reference.md Generate a pre-formatted methods report string using data from a model object. ```python # Import the utility to print out information for reporting from specparam.utils.reports import methods_report_text # Generate methods text, with methods information inserted methods_report_text(model_obj) ``` -------------------------------- ### Simulation Code Source: https://github.com/fooof-tools/fooof/blob/main/doc/api.md Code and utilities for simulating power spectra, including functions for generating, managing parameters for, and transforming power spectra. ```APIDOC ## Simulation Code Code & utilities for simulating power spectra. ### Generate Power Spectra Functions for simulating neural power spectra and spectrograms. ### Manage Parameters Functions and objects for managing parameters for simulated power spectra. ### Transform Power Spectra Functions for transforming power spectra. ### Simulation Utilities Utilities for simulating power spectra. ``` -------------------------------- ### Metrics Source: https://github.com/fooof-tools/fooof/blob/main/doc/api.md The Metric object and related utilities provide functionality for defining metrics to evaluate model fitting performance, including error and goodness-of-fit functions. ```APIDOC ## Metrics The Metric object & related utilties, providing functionality for definining metrics to evaluate model fitting performance. ### Metric Object ### Metric Functions (Error) ### Metric Functions (GoF) ``` -------------------------------- ### Model Objects Source: https://github.com/fooof-tools/fooof/blob/main/doc/api.md Objects that manage data and fit the model to parameterize neural power spectra. This includes the base SpectralModel object for individual spectra and SpectralGroupModel for groups of spectra. ```APIDOC ## Model Objects Objects that manage data and fit the model to parameterize neural power spectra. ### Model Object The SpectralModel object is the base object for the model, and can be used to fit individual power spectra. ### Group Object The SpectralGroupModel object allows for parameterizing groups of power spectra. ### Time & Event Objects The time & event objects allows for parameterizing power spectra organized across time and/or events. ### Object Utilities Functions to manipulate, examine, and analyze model objects. ``` -------------------------------- ### Model Definitions Source: https://github.com/fooof-tools/fooof/blob/main/doc/api.md Spectral models are defined by the defining fit Modes. This section covers the Mode object and related utilities, as well as Fit Functions for aperiodic and peak components. ```APIDOC ## Model Definitions Spectral models are defined by the defining fit Modes. This section ### Mode The Mode object & related utilties, providing functionality for defining fit modes. ### Fit Functions (Aperiodic) ### Fit Functions (Peaks) ``` -------------------------------- ### Reports Source: https://github.com/fooof-tools/fooof/blob/main/doc/api.md Functionality for generating reports related to model methods. ```APIDOC ## Reports ### Methods Reports ``` -------------------------------- ### Measures Source: https://github.com/fooof-tools/fooof/blob/main/doc/api.md Functionality to analyze power spectrum models and their results, including model errors, parameters, and related utilities. ```APIDOC ## Measures Functionality to analyze power spectrum models and the results parameters / components. ### Model Errors Functions for analyzing the error of model fits. **Object Inputs** The following functions take in model objects directly. **Array Inputs** The following functions operate on arrays of models and data, which may be useful for more custom work-flows. ### Parameters Measures & utilities for working with and converting parameters. ``` -------------------------------- ### Model Sub-Objects Source: https://github.com/fooof-tools/fooof/blob/main/doc/api.md The model object combines multiple sub-objects that define and store different elements of the model definition, data, and results. Key sub-objects include Algorithm, Modes, Data, and Results. ```APIDOC ## Model Sub-Objects The model object combines multiple sub-objects that define and store different elements of the model definition, data, and results. Here, the main sub-objects are listed. ### Algorithm ### Modes ### Data ### Results ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.