Skip to content

Commit

Permalink
complete merge
Browse files Browse the repository at this point in the history
  • Loading branch information
SophieHerbst committed May 15, 2024
2 parents 8732634 + c161189 commit 814239d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
1 change: 0 additions & 1 deletion .git_archival.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
ref-names: $Format:%D$
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ files: ^(.*\.(py|yaml))$
exclude: ^(\.[^/]*cache/.*|.*/freesurfer/contrib/.*)$
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.3
rev: v0.4.4
hooks:
- id: ruff
args: ["--fix"]
Expand Down
16 changes: 7 additions & 9 deletions mne_bids_pipeline/steps/sensor/_05_decoding_csp.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
import mne
import numpy as np
import pandas as pd
from mne.decoding import CSP, LinearModel
from mne.decoding import CSP
from mne_bids import BIDSPath
from sklearn.model_selection import StratifiedKFold, cross_val_score
from sklearn.pipeline import make_pipeline
from sklearn.linear_model import LogisticRegression

from ..._config_utils import (
_bids_kwargs,
Expand Down Expand Up @@ -257,7 +256,7 @@ def _fmt_contrast(cond1, cond2, fmin, fmax, freq_range_name, tmin=None, tmax=Non

# COEFS
clf.fit(X, y)
weights_csp = mne.decoding.get_coef(clf, 'patterns_', inverse_transform=True)
weights_csp = mne.decoding.get_coef(clf, "patterns_", inverse_transform=True)

# PATTERNS
csp.fit_transform(X, y)
Expand All @@ -267,9 +266,8 @@ def _fmt_contrast(cond1, cond2, fmin, fmax, freq_range_name, tmin=None, tmax=Non
# XXX right now this saves in working directory
csp_fname = cond1 + cond2 + str(fmin) + str(fmax)

np.save(csp_fname + '_patterns', sensor_pattern_csp)
np.save(csp_fname + '_weights', weights_csp)

np.save(csp_fname + "_patterns", sensor_pattern_csp)
np.save(csp_fname + "_weights", weights_csp)

# Loop over times x frequencies
#
Expand Down Expand Up @@ -344,7 +342,7 @@ def _fmt_contrast(cond1, cond2, fmin, fmax, freq_range_name, tmin=None, tmax=Non

# COEFS
clf.fit(X, y)
weights_csp = mne.decoding.get_coef(clf, 'patterns_', inverse_transform=True)
weights_csp = mne.decoding.get_coef(clf, "patterns_", inverse_transform=True)

# PATTERNS
csp.fit_transform(X, y)
Expand All @@ -354,8 +352,8 @@ def _fmt_contrast(cond1, cond2, fmin, fmax, freq_range_name, tmin=None, tmax=Non
# XXX right now this saves in working directory
csp_fname = cond1 + cond2 + str(fmin) + str(fmax) + str(tmin) + str(tmax)

np.save(csp_fname + '_patterns', sensor_pattern_csp)
np.save(csp_fname + '_weights', weights_csp)
np.save(csp_fname + "_patterns", sensor_pattern_csp)
np.save(csp_fname + "_weights", weights_csp)

# Write each DataFrame to a different Excel worksheet.
a_vs_b = f"{condition1}+{condition2}".replace(op.sep, "")
Expand Down

0 comments on commit 814239d

Please sign in to comment.