Skip to content

Commit

Permalink
Clean up style
Browse files Browse the repository at this point in the history
  • Loading branch information
caiw committed Jan 15, 2024
1 parent 8e311fc commit 0340f30
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
5 changes: 2 additions & 3 deletions kymata/gridsearch/plain.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from kymata.math.combinatorics import generate_derangement
from kymata.math.vector import normalize, get_stds
from kymata.entities.expression import ExpressionSet, SensorExpressionSet, HexelExpressionSet, p_to_logp, log_base
import matplotlib.pyplot as plt


def do_gridsearch(
Expand Down Expand Up @@ -95,8 +94,8 @@ def do_gridsearch(
)
elif channel_space == "source":
es = HexelExpressionSet(
functions=function.name + f"_mirrored_{handed}", # TODO: revert to just `function.name` when we
# have both hemispheres in place
functions=function.name + f"_mirrored-lh", # TODO: revert to just `function.name` when we
# have both hemispheres in place
latencies=latencies_ms / 1000, # seconds
hexels=channel_names,
data_lh=log_pvalues,
Expand Down
11 changes: 2 additions & 9 deletions kymata/io/mne.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
from pathlib import Path

from mne import read_evokeds, minimum_norm, set_eeg_reference
import numpy as np
from numpy.typing import NDArray
from os.path import isfile

from kymata.io.file import path_type


def load_single_emeg(emeg_path, need_names=False, inverse_operator=None, snr=4):
emeg_path_npy = f"{emeg_path}.npy"
Expand All @@ -18,16 +14,13 @@ def load_single_emeg(emeg_path, need_names=False, inverse_operator=None, snr=4):
evoked = read_evokeds(emeg_path_fif, verbose=False) # should be len 1 list
if inverse_operator is not None:
lh_emeg, rh_emeg, ch_names = inverse_operate(evoked[0], inverse_operator, snr)
# TODO: I think ch_names here is the wrong thing

emeg = None #np.concatenate((lh_emeg, rh_emeg), axis=0)
# TODO: I think ch_names here is the wrong thing

# TODO: currently this goes OOM (node-h04 atleast):
# looks like this will be faster when split up anyway
# note, don't run the inv_op twice for rh and lh!
# TODO: move inverse operator to run after EMEG channel combination

emeg = lh_emeg
emeg = lh_emeg #np.concatenate((lh_emeg, rh_emeg), axis=0)
del lh_emeg, rh_emeg
else:
emeg = evoked[0].get_data() # numpy array shape (sensor_num, N) = (370, 403_001)
Expand Down

0 comments on commit 0340f30

Please sign in to comment.