coganlab / IEEG_Pipelines

A repo of current preprocessing methods for the Cogan Lab
https://ieeg-pipelines.readthedocs.io/en/latest/
MIT License
4 stars 2 forks source link

GlobalLocal BIDS data not being recognized by mne??? :( #108

Open jimzhang629 opened 7 months ago

jimzhang629 commented 7 months ago

This same code was working until last night so I wonder if there was a BIDS update or something that wants new metadata...


subjects = ['D0057', 'D0059', 'D0063', 'D0065', 'D0071', 'D0077', 'D0090']

for sub in subjects:
    task = 'GlobalLocal'
    output_name = "Stimulus_ir_fixationCrossBase_1sec_mirror"
    events = ["Stimulus/i25/r25", "Stimulus/i25/r75", "Stimulus/i75/r25", "Stimulus/i75/r75"]
    times = (-1,1.5)
    base_times = [-1,0]
    LAB_root = None
    channels = None
    full_trial_base = False

    if LAB_root is None:
        HOME = os.path.expanduser("~")
        if os.name == 'nt':  # windows
            LAB_root = os.path.join(HOME, "Box", "CoganLab")
        else:  # mac
            LAB_root = os.path.join(HOME, "Library", "CloudStorage", "Box-Box",
                                    "CoganLab")

    layout = get_data(task, root=LAB_root)
    filt = raw_from_layout(layout.derivatives['derivatives/clean'], subject=sub,
                        extension='.edf', desc='clean', preload=False)
    save_dir = os.path.join(layout.root, 'derivatives', 'freqFilt', 'figs', sub)
    if not os.path.exists(save_dir):
        os.makedirs(save_dir)

    good = crop_empty_data(filt)```

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[10], [line 66](vscode-notebook-cell:?execution_count=10&line=66)
     [62](vscode-notebook-cell:?execution_count=10&line=62)         LAB_root = os.path.join(HOME, "Library", "CloudStorage", "Box-Box",
     [63](vscode-notebook-cell:?execution_count=10&line=63)                                 "CoganLab")
     [65](vscode-notebook-cell:?execution_count=10&line=65) layout = get_data(task, root=LAB_root)
---> [66](vscode-notebook-cell:?execution_count=10&line=66) filt = raw_from_layout(layout.derivatives['derivatives/clean'], subject=sub,
     [67](vscode-notebook-cell:?execution_count=10&line=67)                     extension='.edf', desc='clean', preload=False)
     [68](vscode-notebook-cell:?execution_count=10&line=68) save_dir = os.path.join(layout.root, 'derivatives', 'freqFilt', 'figs', sub)
     [69](vscode-notebook-cell:?execution_count=10&line=69) if not os.path.exists(save_dir):

File [~\Desktop\GlobalLocal\IEEG_Pipelines\ieeg\io.py:113](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/jz421/Desktop/GlobalLocal/~/Desktop/GlobalLocal/IEEG_Pipelines/ieeg/io.py:113), in raw_from_layout(layout, preload, run, **kwargs)
    [111](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/jz421/Desktop/GlobalLocal/~/Desktop/GlobalLocal/IEEG_Pipelines/ieeg/io.py:111) for r in runs:
    [112](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/jz421/Desktop/GlobalLocal/~/Desktop/GlobalLocal/IEEG_Pipelines/ieeg/io.py:112)     BIDS_path = bidspath_from_layout(layout, run=r, **kwargs)
--> [113](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/jz421/Desktop/GlobalLocal/~/Desktop/GlobalLocal/IEEG_Pipelines/ieeg/io.py:113)     new_raw = read_raw_bids(bids_path=BIDS_path, verbose=verbose)
    [114](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/jz421/Desktop/GlobalLocal/~/Desktop/GlobalLocal/IEEG_Pipelines/ieeg/io.py:114)     raw.append(new_raw.copy())
    [115](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/jz421/Desktop/GlobalLocal/~/Desktop/GlobalLocal/IEEG_Pipelines/ieeg/io.py:115) whole_raw: mne.io.Raw = mne.concatenate_raws(raw)

File <decorator-gen-360>:10, in read_raw_bids(bids_path, extra_params, verbose)

File [c:\Users\jz421\AppData\Local\anaconda3\envs\ieeg\Lib\site-packages\mne_bids\read.py:828](file:///C:/Users/jz421/AppData/Local/anaconda3/envs/ieeg/Lib/site-packages/mne_bids/read.py:828), in read_raw_bids(bids_path, extra_params, verbose)
    [826](file:///C:/Users/jz421/AppData/Local/anaconda3/envs/ieeg/Lib/site-packages/mne_bids/read.py:826) if raw_path.suffix == ".fif" and "allow_maxshield" not in extra_params:
    [827](file:///C:/Users/jz421/AppData/Local/anaconda3/envs/ieeg/Lib/site-packages/mne_bids/read.py:827)     extra_params["allow_maxshield"] = True
--> [828](file:///C:/Users/jz421/AppData/Local/anaconda3/envs/ieeg/Lib/site-packages/mne_bids/read.py:828) raw = _read_raw(
    [829](file:///C:/Users/jz421/AppData/Local/anaconda3/envs/ieeg/Lib/site-packages/mne_bids/read.py:829)     raw_path,
...
--> [820](file:///C:/Users/jz421/AppData/Local/anaconda3/envs/ieeg/Lib/site-packages/mne/io/edf/edf.py:820)     patient[key] = int(value)
    [821](file:///C:/Users/jz421/AppData/Local/anaconda3/envs/ieeg/Lib/site-packages/mne/io/edf/edf.py:821) else:
    [822](file:///C:/Users/jz421/AppData/Local/anaconda3/envs/ieeg/Lib/site-packages/mne/io/edf/edf.py:822)     warn(f"Invalid patient information {key}")

ValueError: invalid literal for int() with base 10: 'None'