coganlab / BIDS_coding

A conversion script designed to enable fast conversion of large neuro data sets
https://bids-coding.readthedocs.io/en/latest/
MIT License
2 stars 2 forks source link

config.json missing information #59

Open jimzhang629 opened 5 months ago

jimzhang629 commented 5 months ago

Several functions in utils.organize.py and data2bids.py use a "type" variable from the config.json, but the config.json does not have this.

For example, the below function from organize.py calls ieeg_config["type"] but this doesn't exist.

def prep_tsv(file_path: PathLike, task: str, pmatchz: str, ieeg_config: dict,
             bids_dir: PathLike) -> (str, pd.DataFrame):
    df = None
    for name, var in ieeg_config["headerData"]["channels"].items():
        if name in file_path:
            df = mat2df(file_path, var)
            if "highpass_cutoff" in df.columns.to_list():
                df = df.rename(columns={"highpass_cutoff": "high_cutoff"})
            if "lowpass_cutoff" in df.columns.to_list():
                df = df.rename(columns={"lowpass_cutoff": "low_cutoff"})
    df["type"] = ieeg_config["type"] #uhhhh wtf is this???
    df["units"] = ieeg_config["headerData"]["units"]
    new_row = pd.DataFrame(
        {"name": ["Trigger"], "high_cutoff": [1], "low_cutoff": [1000],
         "type": ["TRIG"], "units": ["uV"]})
    df = pd.concat([df, new_row], ignore_index=True)
    df = pd.concat([df["name"], df["type"], df["units"], df["low_cutoff"],
                    df["high_cutoff"]], axis=1)
    filename = op.join(bids_dir, "sub-{}".format(pmatchz),
                       "sub-" + pmatchz + "_task-{}".format(
                           task) + "_channels.tsv")
    return filename, df