Skip to content

Commit

Permalink
Merge pull request #114 from kymata-atlas/big-preprocessing-refactor-…
Browse files Browse the repository at this point in the history
…simplify

Big preprocessing refactor simplify
  • Loading branch information
neukym authored Jan 8, 2024
2 parents 3e5b193 + 3106932 commit e171a43
Show file tree
Hide file tree
Showing 4 changed files with 297 additions and 242 deletions.
2 changes: 1 addition & 1 deletion kymata/config/dataset4.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mri_structurals_directory: "raw_mri_structurals"

# General information related to the dataset
list_of_participants: [
"participant_08"
"participant_17"
]
input_streams: [
"auditory"
Expand Down
28 changes: 24 additions & 4 deletions kymata/preproc/data_cleansing.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,15 @@ def run_second_pass_cleansing_and_EOG_removal(list_of_participants: list[str],

ica.exclude = []

if remove_ecg:
_remove_ecg(filt_raw, ica)
if supress_excessive_plots_and_prompts:
_remove_ecg_eog(filt_raw, ica)

if remove_veoh_and_heog:
_remove_veoh_and_heog(filt_raw, ica)
else:
if remove_ecg:
_remove_ecg(filt_raw, ica)

if remove_veoh_and_heog:
_remove_veoh_and_heog(filt_raw, ica)

ica.apply(raw_fif_data_sss_movecomp_tr)

Expand Down Expand Up @@ -280,6 +284,22 @@ def _remove_ecg(filt_raw, ica):
ica.plot_overlay(filt_raw, exclude=ica.exclude, picks='mag')


def _remove_ecg_eog(filt_raw, ica):
"""
Note: mutates `ica`.
"""
print_with_color(f" Starting ECG and EOG removal...", Fore.GREEN)
ecg_indices, ecg_scores = ica.find_bads_ecg(filt_raw)
eog_indices, eog_scores = ica.find_bads_eog(filt_raw)
ica.exclude = ecg_indices
ica.exclude += eog_indices
eog_scores.append(ecg_scores)
ica.plot_sources(filt_raw, show_scrollbars=True)
ica.plot_scores(eog_scores)




def create_trials(dataset_directory_name: str,
list_of_participants: list[str],
repetitions_per_runs: int,
Expand Down
Loading

0 comments on commit e171a43

Please sign in to comment.