Skip to content

Commit

Permalink
Fix descriptions and docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
xmival00 committed Jul 5, 2024
1 parent 7cc6fdc commit 1de9305
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 19 deletions.
55 changes: 38 additions & 17 deletions best/feature_extraction/WaveDetector.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,23 +425,44 @@ def slow_wave_detect(data, fs, max_distance, min_distance, amplitude_threshold,
The code is based on the following publication and extends and improves the features and methods of original
wave detections from the paper:
- Riedner, B. a., Vyazovskiy, V. V., Huber, R., Massimini, M., Esser, S., Murphy, M., & Tononi, G. (2007).
Sleep homeostasis and cortical synchronization: III. A high-density EEG study of sleep slow waves in humans. Sleep, 30(12), 1643–1657.
Parameters:
data (array-like): Input EEG data.
fs (float): Sampling frequency of the data.
max_distance (float): Maximum distance between zero crossings for a valid slow wave.
min_distance (float): Minimum distance between zero crossings for a valid slow wave.
amplitude_threshold (float): Minimum amplitude for a valid slow wave.
pdf_path (str): Path to save the plot as a PDF.
sleep_state (str): Current sleep state.
epoch_number (int): Current epoch number.
slow_waves_to_remove (list, optional): List of slow waves to remove.
time_threshold (float, optional): Time threshold for removing slow waves.
verbose (bool, optional): If True, plot the results. Default is True.
Returns:
- Riedner, B. a., Vyazovskiy, V. V., Huber, R., Massimini, M., Esser, S., Murphy, M., & Tononi, G. (2007). Sleep homeostasis and cortical synchronization: III. A high-density EEG study of sleep slow waves in humans. Sleep, 30(12), 1643–1657.
fs: float
Sampling frequency
cutoff_low: float
The lowest frequency of the wave detects
cutoff_high : float
The highest frequency of the wave detects
Parameters
-------------
data: array
Input EEG data.
fs: float
Sampling frequency of the data.
max_distance: float
Maximum distance between zero crossings for a valid slow wave.
min_distance: float
Minimum distance between zero crossings for a valid slow wave.
amplitude_threshold: float
Minimum amplitude for a valid slow wave.
pdf_path: str
Path to save the plot as a PDF.
sleep_state: str
Current sleep state.
epoch_number: int
Current epoch number.
slow_waves_to_remove: list
Optional list of slow waves to remove.
time_threshold: float
Optional time threshold for removing slow waves.
verbose: bool
Optional - If True, plot the results. Default is True.
Returns
-------
tuple: Tuple containing the detected slow waves, their amplitudes and slopes, the mean and standard deviation of the amplitudes and slopes, and the number of detected waves.
"""
# Filter the signal by 50 msec moving average filter
Expand Down
4 changes: 2 additions & 2 deletions projects/slow_wave_detection/readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ EEG Slow Wave Detection and Analysis
Here we conveniently provide a standalone fully functional code example for analysis related to this project - `One file example <./example_one_file.py>`_.

This enables trialing this code without installing the whole Best Toolbox library.
The codes were also embedded in the BEST Toolbox so they can be freely available upon installing the whole `BEST Toolbox <https://github.com/bnelair/best-toolbox>`_ library.
The codes were also embedded in the BEST Toolbox so they can be freely available upon installing the whole `BEST Toolbox <https://best-toolbox.readthedocs.io/en/latest/>`_ library.

The documentation to the toolbox is available at

For more information on this specific project, see the page describing `Wave Detection <https://best-toolbox.readthedocs.io/en/latest/>`_.
For more information on this specific project, see the page describing `Wave Detection <https://best-toolbox.readthedocs.io/en/latest/feature_extraction.WaveDetector.html>`_.


Acknowledgement
Expand Down

0 comments on commit 1de9305

Please sign in to comment.