Skip to content

Commit

Permalink
Merge pull request #122 from coganlab/indexing
Browse files Browse the repository at this point in the history
Indexing
  • Loading branch information
Aaronearlerichardson authored Jun 17, 2024
2 parents 9793335 + fdee81c commit 75a6b70
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion envs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
bids>=0.0
mne
mne-bids
mne-bids<=0.14
numpy
matplotlib
scipy
Expand Down
9 changes: 7 additions & 2 deletions ieeg/viz/ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,13 @@ def figure_compare(raw: list[Raw], labels: list[str], avg: bool = True,
for title, data in zip(labels, raw):
title: str
data: Raw
psd = data.compute_psd(n_jobs=n_jobs, **kwargs,
n_fft=int(data.info['sfreq']))
kwargs['method'] = kwargs.get('method', 'welch')
if kwargs['method'] == 'multitaper':
kwargs['adaptive'] = kwargs.get('adaptive', True)
kwargs['bandwidth'] = kwargs.get('bandwidth', 10)
elif kwargs['method'] == 'welch':
kwargs['n_fft'] = kwargs.get('n_fft', int(data.info['sfreq']))
psd = data.compute_psd(n_jobs=n_jobs, **kwargs)
fig = psd.plot(average=avg, spatial_colors=avg)
fig.subplots_adjust(top=0.85)
fig.suptitle('{}filtered'.format(title), size='xx-large',
Expand Down
16 changes: 10 additions & 6 deletions ieeg/viz/mri.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ def plot_on_average(sigs: Signal | str | mne.Info | list[Signal | str, ...],

if rm_wm:
these_picks = pick_no_wm(these_picks, gen_labels(
new, subj, subj_dir, new.ch_names))
new, subj, subj_dir, picks=new.ch_names))

if len(these_picks) == 0:
continue
Expand Down Expand Up @@ -764,8 +764,8 @@ def gen_labels(info: mne.Info, sub: str = None, subj_dir: str = None,
new_labels[p] = label[0]
continue
while not ((not any(w in label[i] for w in bad_words)) and
label[i + 1] > 0.05):
if (i + 2) <= len(label.T): # end of labels
float(label[i + 1]) > 0.05):
if (i + 2) >= len(label.T): # end of labels
i = 0
break
elif label[i + 2].isspace(): # empty label
Expand All @@ -791,10 +791,14 @@ def gen_labels(info: mne.Info, sub: str = None, subj_dir: str = None,
overwrite=True)
mne.set_log_level("INFO")
TASK = "SentenceRep"
sub_num = 22
sub_num = 29
layout = get_data(TASK, root=LAB_root)
subj_dir = op.join(LAB_root, "ECoG_Recon_Full")
subj_dir = op.join(LAB_root, "..", "ECoG_Recon")
sub_pad = "D" + str(sub_num).zfill(4)
info = subject_to_info(f"D{sub_num}", subj_dir)
labels = gen_labels(info, sub=f"D{sub_num}", subj_dir=subj_dir,
atlas=".BN_atlas")

# sub = "D{}".format(sub_num)

# filt = raw_from_layout(layout.derivatives['clean'], subject=sub_pad,
Expand All @@ -804,7 +808,7 @@ def gen_labels(info: mne.Info, sub: str = None, subj_dir: str = None,
# sample_path = mne.datasets.sample.data_path()
# subjects_dir = sample_path / "subjects"

brain = plot_subj("D5")
# brain = plot_subj("D5")
# fig = plot_on_average(["D24", "D81"], rm_wm=False, hemi='both',
# transparency=0.4,
# picks=list(range(28)) + list(range(52, 176)),
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def get_file_list(path, ext):

setup(
name='ieeg',
version='0.5.1',
version='0.5.2',
packages=find_packages(
where='.',
include=['ieeg*'],
Expand Down

0 comments on commit 75a6b70

Please sign in to comment.