Datasets#
A dataset spec tells modewise where recordings are and how to read them. It is separate from the pipeline, so one pipeline runs on many datasets. It works for BIDS and for other layouts, and for any modality.
root = "/data/ds005237" # relative paths resolve against this file's folder
filter = { task = ["hammerAP"] } # optional: keep only these entity values
[[input]] # the first input decides which recordings exist
name = "bold" # must match a pipeline input
pattern = "sub-{subject}/func/sub-{subject}_task-{task}_run-{run}_bold.h5"
format = "hdf5"
dataset = "timeseries" # path of the 2D dataset inside the file
layout = "channels_by_time" # or "time_by_channels"
sidecar = "sub-{subject}/func/sub-{subject}_task-{task}_run-{run}_bold.json"
# sampling_rate_hz = 1.25 # instead of `sidecar`
# labels_file = "channels.txt" # one channel label per line
[[input]] # later inputs must exist for every recording
name = "trials"
pattern = "sub-{subject}/func/sub-{subject}_task-{task}_run-{run}_events.tsv"
format = "events_tsv"
# label_column = "trial_type" # default
Patterns#
Placeholders.
{name}stands for an entity value, and the same name must match the same value everywhere in the pattern.Recording IDs are made from the entities, for example
subject-01_task-rest_run-01.Labels. Use BIDS-style labels (letters and digits). On case-insensitive disks, the macOS default,
sub-Aandsub-aare the same folder.
Formats#
|
Gives |
Needs |
|---|---|---|
|
series |
|
|
series: one channel per atlas label, parcellated at load time ( |
|
|
events |
nothing else |
Sampling rate and events#
Sidecar:
SamplingFrequency(Hz) is read first, otherwiseRepetitionTime(s), so the same rule serves EEG, MEG, fNIRS and fMRI.events_tsvfollows BIDS.onsetanddurationare in seconds from the first stored sample. Rows withn/aonset or duration are rejected.
Channels#
A [channels] section says what each channel is, so pipelines can select and summarise regions (docs/regions.md):
[channels]
name = "channels" # pipeline input name (default)
tables = [ # in channel order; concatenated
{ path = "atlas/schaefer400_info.txt", format = "schaefer" },
{ path = "atlas/tian_s2.txt", format = "tian" },
]
names_for = ["bold"] # these inputs take the table's names
Paths: relative to the dataset spec’s folder, because atlases usually live outside the data.
Formats:
tsv(covers BIDSdseg.tsv),schaefer,tianandnames.Names: inputs in
names_forget the table’s names instead ofch0,ch1, …. The number of names must match the channels.Pipeline input: the table becomes one more input (
channels = "channels"in a pipeline’sinputs). Pipelines that do not use it are unaffected, because unused dataset inputs are left out.
Participants#
A [participants] section reads subject information for group statistics and machine learning (docs/features.md):
[participants]
entity = "subject" # the recording entity tables are keyed by (default)
tables = [
{ path = "participants.tsv", id_pattern = "sub-{subject}" },
{ path = "phenotype/shaps01.tsv", id_column = "subjectkey", id_pattern = "NDAR_{subject}",
columns = ["shaps_total"], missing = ["999"] },
]
Paths: relative to the dataset root, as BIDS places them.
Ids:
id_columndefaults toparticipant_id.id_patternsays how ids relate to the entity, in the same{entity}syntax as file patterns; by default the id is the entity value.Columns and missing values:
columnskeeps only the listed columns.missingadds codes meaning “no value”, besides empty cells,n/aandNA.Joins: tables are joined on the subject. A column name that appears in two tables is an error unless one table sets
prefix, for exampleprefix = "shaps.".
Checking a spec#
modewise inspect dataset.toml --load lists the entities found, and loads the first recording to show shapes, sampling rates and event counts.