moabb
moabb copied to clipboard
Additional metadata from BIDS events.tsv
trafficstars
Hi,
here is an idea how we could fetch additional metadata columns from events.tsv files for BIDS datasets.
E.g. for the FakeData set with
FakeDataset( event_list=["fake1", "fake2"], n_sessions=2, n_subjects=2, n_runs=1)
the events.tsv files would have the following columns:
| onset | duration | trial_type | value | sample |
|---|---|---|---|---|
| 0.0078125 | 3.0 | fake1 | 1 | 1 |
| 1.984375 | 3.0 | fake2 | 2 | 254 |
| 3.96875 | 3.0 | fake1 | 1 | 508. |
While the onset and the trial_type are implicitly encoded in the epochs (by their names and how they are cut), the additional information, such as value or sample would not be part of the epoch/metadata as extracted with:
epo, labels, metadata = paradigm.get_data(
dataset=dataset,
subjects=["1"],
return_epochs=True,
)
This pull request adds a additional_metadata: Literal["default", "all"] | list[str] = "default" kwarg to the paradigm.get_data method, which allows to either fetch all "all" or a selected list of columns from the events.tsv and attach it to the metadata - also see the TestMetadata.