Skip to content

Commit

Permalink
lint: resolve pre-commit errors, format
Browse files Browse the repository at this point in the history
  • Loading branch information
steinnhm committed Jan 10, 2025
1 parent fd9c41b commit 41559ff
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
22 changes: 11 additions & 11 deletions examples/preprocessing/esg_rm_heart_artefact_pcaobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

###############################################################################
# Download sample subject data from OpenNeuro if you haven't already
# This will download simultaneous EEG and ESG data from a single run of a single participant after
# median nerve stimulation of the left wrist
# This will download simultaneous EEG and ESG data from a single run of a
# single participant after median nerve stimulation of the left wrist
import openneuro
from matplotlib import pyplot as plt

Expand All @@ -40,7 +40,7 @@
from mne.io import read_raw_eeglab
from mne.preprocessing import find_ecg_events, fix_stim_artifact

# add the path where you want the OpenNeuro data downloaded. Each run is ~2GB of data to download.
# add the path where you want the OpenNeuro data downloaded. Each run is ~2GB of data
ds = "ds004388"
target_dir = mne.datasets.default_path() / ds
run_name = "sub-001/eeg/*median_run-03_eeg*.set"
Expand Down Expand Up @@ -101,9 +101,9 @@
iv_baseline = [-400e-3, -300e-3]
iv_epoch = [-400e-3, 600e-3]

###############################################################################
# Perform minimal preprocessing including removing the stimulation artefact, downsampling
# and filtering
######################################################
# Perform minimal preprocessing including removing the
# stimulation artefact, downsampling and filtering

raw = read_raw_eeglab(block_files[0], verbose="error")
raw.set_channel_types(dict(ECG="ecg"))
Expand All @@ -126,7 +126,7 @@
stim_channel=None,
)

###############################################################################
###################################################################
# Find ECG events and add to the raw structure as event annotations

ecg_events, ch_ecg, average_pulse = find_ecg_events(raw, ch_name="ECG")
Expand All @@ -144,9 +144,9 @@
qrs_event_time, duration, description, ch_names=[esg_chans] * len(qrs_event_time)
)

###############################################################################
# Create evoked response about the detected R-peaks before and after cardiac artefact
# correction
###################################################
# Create evoked response about the detected R-peaks
# before and after cardiac artefact correction

events, event_ids = events_from_annotations(raw)
event_id_dict = {key: value for key, value in event_ids.items() if key == "qrs"}
Expand Down Expand Up @@ -176,7 +176,7 @@
)
evoked_after = epochs.average()

###############################################################################
##################
# Comparison image

fig, axes = plt.subplots(1, 1, layout="constrained")
Expand Down
5 changes: 3 additions & 2 deletions mne/preprocessing/pca_obs.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def apply_pca_obs(
n_components: int = 4,
n_jobs: int | None = None,
copy: bool = True,
verbose : bool | str | int | None = None
verbose: bool | str | int | None = None,
) -> Raw | None:
"""
Apply the PCA-OBS algorithm to picks of a Raw object.
Expand All @@ -45,7 +45,7 @@ def apply_pca_obs(
n_components : int
Number of PCA components to use to form the OBS (default 4).
copy : bool
If False, modify the Raw instance in-place.
If False, modify the Raw instance in-place.
If True, return a copied, modified Raw instance. Defaults to True.
%(n_jobs)s
%(verbose)s
Expand Down Expand Up @@ -80,6 +80,7 @@ def apply_pca_obs(
if copy:
return raw


def _pca_obs(
data: np.ndarray,
qrs: np.ndarray,
Expand Down

0 comments on commit 41559ff

Please sign in to comment.