|
@@ -15,12 +15,6 @@ BIDS-folder
|
|
|
For software dependencies see the environment.yml file for use with the
|
|
|
conda package manager.
|
|
|
|
|
|
-To Do
|
|
|
------
|
|
|
-- fill missing info dataset_description.json: insert preprint DOI, insert dataset DOI
|
|
|
-- fill missing info datacite.yml: insert preprint DOI
|
|
|
-- reference the dataset in sp_experiment code archive on zenodo (not in this script)
|
|
|
-
|
|
|
"""
|
|
|
# %% Imports and constants
|
|
|
import glob
|
|
@@ -206,9 +200,9 @@ funding:
|
|
|
# In the citation field, please provide the full reference, including title, authors, journal etc.
|
|
|
references:
|
|
|
-
|
|
|
- id: "doi:paper-doi"
|
|
|
+ id: "doi:10.1101/2021.06.03.446960"
|
|
|
reftype: "IsSupplementTo"
|
|
|
- citation: "paper-doi-citation"
|
|
|
+ citation: "Control over sampling boosts numerical evidence processing in human decisions from experience Stefan Appelhoff, Ralph Hertwig, Bernhard Spitzer bioRxiv 2021.06.03.446960"
|
|
|
-
|
|
|
id: "doi:10.5281/zenodo.3361717"
|
|
|
reftype: "IsReferencedBy"
|
|
@@ -264,7 +258,7 @@ def make_bids_validator_config(bids_root, overwrite):
|
|
|
|
|
|
|
|
|
# %% Copying EEG files
|
|
|
-def copy_eeg_and_events_files(bids_root, task_map, sub, overwrite):
|
|
|
+def copy_eeg_and_events_files(bids_root, task_map, sub, just_json, overwrite):
|
|
|
"""Copy and rename the EEG and events files per subject.
|
|
|
|
|
|
Parameters
|
|
@@ -276,6 +270,8 @@ def copy_eeg_and_events_files(bids_root, task_map, sub, overwrite):
|
|
|
task_map : dict
|
|
|
A mapping between old task names, and templates for the
|
|
|
new task names.
|
|
|
+ just_json : bool
|
|
|
+ Whether or not to only touch the json files.
|
|
|
overwrite : bool
|
|
|
If True, overwrite existing files.
|
|
|
"""
|
|
@@ -293,8 +289,9 @@ def copy_eeg_and_events_files(bids_root, task_map, sub, overwrite):
|
|
|
dest = op.join(dest_dir, fname_new)
|
|
|
|
|
|
# Copy EEG data
|
|
|
- if op.exists(src) and (not op.exists(dest) or overwrite):
|
|
|
- copyfile_brainvision(src, dest)
|
|
|
+ if not just_json:
|
|
|
+ if op.exists(src) and (not op.exists(dest) or overwrite):
|
|
|
+ copyfile_brainvision(src, dest)
|
|
|
|
|
|
# Copy and rename events.tsv
|
|
|
src = src.replace("_eeg.vhdr", "_events.tsv")
|
|
@@ -319,12 +316,12 @@ def make_README(bids_root, overwrite):
|
|
|
This is the readme of the `mpib_sp_eeg` dataset. The short dataset name results from these three facts:
|
|
|
|
|
|
- the data was collected at the Max Planck Institute for Human Development (MPIB)
|
|
|
-- the behavioral task was the Sampling Paradigm (SP)
|
|
|
+- the behavioral task was the "Sampling Paradigm" (SP)
|
|
|
- the dataset's main neuroimaging modality is electroencephalography data (EEG)
|
|
|
|
|
|
The data was collected in 2019 at the MPIB in Berlin by Stefan Appelhoff and colleagues.
|
|
|
|
|
|
-All important details are reported in the original paper for the project: https://to.be.done/paper-doi
|
|
|
+All important details are reported in the original paper for the project: https://doi.org/10.1101/2021.06.03.446960
|
|
|
|
|
|
The data is organized according to the Brain Imaging Data Structure, see: https://bids.neuroimaging.io
|
|
|
|
|
@@ -399,16 +396,16 @@ def make_dataset_description(bids_root, overwrite):
|
|
|
"Ralph Hertwig",
|
|
|
"Bernhard Spitzer",
|
|
|
],
|
|
|
- "Acknowledgements": "We thank Agnessa Karapetian, Clara Wicharz, Jann Wäscher, Yoonsang Lee, and Zhiqi Kang for help with data collection, and Dirk Ostwald for helpful discussions. We are grateful to Casper Kerrén for feedback on a draft of this manuscript and to Susannah Goss for editorial assistance.",
|
|
|
- "HowToAcknowledge": "to be done, please cite https://to.be.done/paper-doi",
|
|
|
+ "Acknowledgements": "We thank Agnessa Karapetian, Clara Wicharz, Jann Wäscher, Yoonsang Lee, and Zhiqi Kang for help with data collection, Dirk Ostwald and Casper Kerrén for helpful discussions and feedback, and Susannah Goss for editorial assistance.",
|
|
|
+ "HowToAcknowledge": "Please cite https://doi.org/10.1101/2021.06.03.446960",
|
|
|
"EthicsApprovals": [
|
|
|
"The study was approved by the ethics committee of the Max Planck Institute for Human Development, Berlin, Germany."
|
|
|
],
|
|
|
"ReferencesAndLinks": [
|
|
|
- "https://to.be.done/paper-doi",
|
|
|
+ "https://doi.org/10.1101/2021.06.03.446960",
|
|
|
"https://doi.org/10.5281/zenodo.3354368",
|
|
|
],
|
|
|
- "DatasetDOI": "https://to.be.done/dataset-doi",
|
|
|
+ "DatasetDOI": "https://gin.g-node.org/sappelhoff/mpib_sp_eeg/",
|
|
|
}
|
|
|
|
|
|
fname = op.join(bids_root, "dataset_description.json")
|
|
@@ -437,6 +434,12 @@ def make_CHANGES(bids_root, overwrite):
|
|
|
"""Make CHANGES file."""
|
|
|
txt = """1.0.0 2021-05-25
|
|
|
- Initial release
|
|
|
+
|
|
|
+1.0.1 2021-06-04
|
|
|
+ - Updated link to preprint in dataset_description.json and datacite.yml
|
|
|
+ - Added Manufacturer and ManufacturersModelName to physio.json (Tobii 4C eyetracker)
|
|
|
+ - Rephrased acknowledgements in dataset_description.json
|
|
|
+ - Updated code/environment.yml
|
|
|
"""
|
|
|
|
|
|
fname = op.join(bids_root, "CHANGES")
|
|
@@ -888,7 +891,7 @@ def make_participants(bids_root, overwrite):
|
|
|
|
|
|
|
|
|
# %% Preparing and copying the eyetracking files
|
|
|
-def copy_eyetracking_files(bids_root, task_map, sub, overwrite):
|
|
|
+def copy_eyetracking_files(bids_root, task_map, sub, just_json, overwrite):
|
|
|
"""Format eyetracking files.
|
|
|
|
|
|
Parameters
|
|
@@ -900,6 +903,8 @@ def copy_eyetracking_files(bids_root, task_map, sub, overwrite):
|
|
|
task_map : dict
|
|
|
A mapping between old task names, and templates for the
|
|
|
new task names.
|
|
|
+ just_json : bool
|
|
|
+ Whether or not to only touch the json files.
|
|
|
overwrite : bool
|
|
|
If True, overwrite existing files.
|
|
|
"""
|
|
@@ -927,6 +932,8 @@ def copy_eyetracking_files(bids_root, task_map, sub, overwrite):
|
|
|
"SamplingFrequency": 90, # Tobii 4C eyetracker is not "research grade", so this sfreq is not guaranteed to be stable apparently.
|
|
|
"StartTime": "n/a",
|
|
|
"Columns": cols,
|
|
|
+ "Manufacturer": "Tobii Technology, Sweden",
|
|
|
+ "ManfacturersModelName": "4C",
|
|
|
"device_time_stamp": {
|
|
|
"Description": "time stamp according to the eyetracker's internal clock",
|
|
|
"Units": "µs",
|
|
@@ -1020,9 +1027,11 @@ def copy_eyetracking_files(bids_root, task_map, sub, overwrite):
|
|
|
|
|
|
# Select only relevant columns and write
|
|
|
df = df[cols]
|
|
|
- df.to_csv(
|
|
|
- dest, sep="\t", header=False, na_rep="n/a", index=False, compression="gzip"
|
|
|
- )
|
|
|
+ if not just_json:
|
|
|
+ # skip writing if we only write (update) JSONs
|
|
|
+ df.to_csv(
|
|
|
+ dest, sep="\t", header=False, na_rep="n/a", index=False, compression="gzip"
|
|
|
+ )
|
|
|
|
|
|
# Write one physio.json per task - needed because each has a different StartTime
|
|
|
# First, try to get StartTime
|
|
@@ -1072,7 +1081,7 @@ def copy_eyetracking_files(bids_root, task_map, sub, overwrite):
|
|
|
|
|
|
|
|
|
# %% Coordsystem, electrodes, channels, eeg sidecar, and scans files
|
|
|
-def coord_elec_chan_eegjson_scans(bids_root, task_map, sub, overwrite):
|
|
|
+def coord_elec_chan_eegjson_scans(bids_root, task_map, sub, just_json, overwrite):
|
|
|
"""Write/Convert several files to BIDS.
|
|
|
|
|
|
Convert the following files:
|
|
@@ -1091,6 +1100,8 @@ def coord_elec_chan_eegjson_scans(bids_root, task_map, sub, overwrite):
|
|
|
task_map : dict
|
|
|
A mapping between old task names, and templates for the
|
|
|
new task names.
|
|
|
+ just_json : bool
|
|
|
+ This parameter is currently not implemented and passing it has no effect.
|
|
|
overwrite : bool
|
|
|
If True, overwrite existing files.
|
|
|
"""
|
|
@@ -1367,20 +1378,22 @@ def enrich_eeg_json(bids_root, overwrite):
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
make_datacite_yml(BIDS_ROOT, OVERWRITE)
|
|
|
- make_bids_validator_config(BIDS_ROOT, OVERWRITE)
|
|
|
- make_bidsignore(BIDS_ROOT, OVERWRITE)
|
|
|
+ # make_bids_validator_config(BIDS_ROOT, OVERWRITE)
|
|
|
+ # make_bidsignore(BIDS_ROOT, OVERWRITE)
|
|
|
make_README(BIDS_ROOT, OVERWRITE)
|
|
|
- make_LICENSE(BIDS_ROOT, OVERWRITE)
|
|
|
+ # make_LICENSE(BIDS_ROOT, OVERWRITE)
|
|
|
make_CHANGES(BIDS_ROOT, OVERWRITE)
|
|
|
make_dataset_description(BIDS_ROOT, OVERWRITE)
|
|
|
- make_phenotype(BIDS_ROOT, OVERWRITE)
|
|
|
- make_participants(BIDS_ROOT, OVERWRITE)
|
|
|
- make_events_json(BIDS_ROOT, OVERWRITE)
|
|
|
+ # make_phenotype(BIDS_ROOT, OVERWRITE)
|
|
|
+ # make_participants(BIDS_ROOT, OVERWRITE)
|
|
|
+ # make_events_json(BIDS_ROOT, OVERWRITE)
|
|
|
|
|
|
- inputs = [(BIDS_ROOT, TASK_MAP, f"sub-{sub:02}", OVERWRITE) for sub in SUBJECTS]
|
|
|
+ just_json = True
|
|
|
+ inputs = [(BIDS_ROOT, TASK_MAP, f"sub-{sub:02}", just_json, OVERWRITE) for sub in SUBJECTS]
|
|
|
with multiprocessing.Pool(NJOBS) as pool:
|
|
|
- pool.starmap(copy_eeg_and_events_files, inputs)
|
|
|
+ # pool.starmap(copy_eeg_and_events_files, inputs)
|
|
|
pool.starmap(copy_eyetracking_files, inputs)
|
|
|
- pool.starmap(coord_elec_chan_eegjson_scans, inputs)
|
|
|
+ # pool.starmap(coord_elec_chan_eegjson_scans, inputs)
|
|
|
+
|
|
|
+ # enrich_eeg_json(BIDS_ROOT, OVERWRITE)
|
|
|
|
|
|
- enrich_eeg_json(BIDS_ROOT, OVERWRITE)
|