You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Go to the cloned directory and install the package using pip.
23
24
```
25
+
cd LSLAutoBIDS
24
26
pip3 install lslautobids
25
27
```
26
28
It is advised to install the package in a separate environment (e.g. using `conda` or `virtualenv`).
@@ -39,13 +41,13 @@ The package requires the recorded XDF data to be organized in a specific directo
39
41
40
42
41
43
- The `projects` root location is the root directory where all the eeg raw recordings (say `.xdf` files) are stored e.g. `projects/sub-A/ses-001/eeg/sub-A_ses-001_task-foo.xdf`.
42
-
- The (optional) `project_stimulus` root location is the directory where the experiments (e.g `.py`, `.oxexp`) and behavioral files (e.g. eye-tracking recordings, labnotebook, participant forms, etc ) are stored.
44
+
- The (optional) `project_other` root location is the directory where the experiments (e.g `.py`, `.oxexp`) and behavioral files (e.g. eye-tracking recordings, labnotebook, participant forms, etc ) are stored.
43
45
- The `bids` root location is the directory where the converted BIDS data is stored, along with source data and code files which we want to version control using `Datalad`.
44
46
45
47
> [!IMPORTANT]
46
48
> Please follow the BIDS data organization guidelines for storing the neuroimaging data for running this package. The BIDS conversion guidelines are based on the recommended directory/files structure. You only can change the location of the root directories according to your preference. You must also strictly follow the naming convention for the project and subject subdirectories.
47
49
48
-
Here you will find the recommended directory structure for storing the project data (recorded, stimulus and converted data) in the [data_organization](docs/data_organization.md) file.
50
+
Here you will find the recommended directory structure for storing the project data (recorded, other and converted data) in the [data_organization](docs/data_organization.md) file.
Copy file name to clipboardExpand all lines: docs/data_organization.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,22 @@
1
1
# How the data is organized
2
2
3
-
In this project, we are using a sample xdf file along with the corresponding stimulus files to demonstrate how the data inside the `projectname` folder is organized. This data should be organized in a specific way:
3
+
In this project, we are using a sample xdf file along with the corresponding other files to demonstrate how the data inside the `projectname` folder is organized. This data should be organized in a specific way:
4
4
5
5
### Recommended Project Organization Structure
6
6
7
7
For convenience, we have provided a recommended project organization structure for the root directories to organize the data better.
8
8
9
9
10
10
> [!IMPORTANT]
11
-
> The recommended directory structure is not self generated. The user needs to create the directories and store the recorded and stimulus data in them before running the conversion.
11
+
> The recommended directory structure is not self generated. The user needs to create the directories and store the recorded and others data in them before running the conversion.
12
12
13
13
The dataset (both recorded and converted) is stored in the parent `data` directory. The `data` directory has three subdirectories under which the entire project is stored. The recommended directory structure is as follows:
Here `./data/projects/`, `./data/project_stimulus/`, `./data/bids/` are the root project directories. Each of this root directories will have a project name directory inside it and each project directory will have a subdirectory for each subject.
29
+
Here `./data/projects/`, `./data/project_other/`, `./data/bids/` are the root project directories. Each of this root directories will have a project name directory inside it and each project directory will have a subdirectory for each subject.
30
30
31
31
32
32
## Projects Folder
@@ -52,7 +52,7 @@ Filename Convention for the raw data files :
52
52
-**tasklabel** - `duration, mscoco, ...`
53
53
-**runlabel** - `001, 002, 003, ...` (need to be an integer)
54
54
55
-
## Project Stimulus Folder
55
+
## Project Other Folder
56
56
57
57
This folder contains the experimental and behavioral files which we also store in the dataverse. The folder structure is should as follows:
58
58
@@ -66,15 +66,15 @@ This folder contains the experimental and behavioral files which we also store i
-**projectname** - any descriptive name for the project
69
-
-**experiment** - contains the experimental files for the project. Eg: showStimulus.m, showStimulus.py
69
+
-**experiment** - contains the experimental files for the project. Eg: showOther.m, showOther.py
70
70
-**data** - contains the behavioral files for the corresponding subject. Eg: experimentalParameters.csv, eyetrackingdata.edf, results.tsv.
71
71
72
72
73
73
You can get the filename convention for the data files [here](https://bids-standard.github.io/bids-starter-kit/folders_and_files/files.html#modalities).
74
74
75
75
## BIDS Folder
76
76
77
-
This folder contains the converted BIDS data files and other files we want to version control using `Datalad`. Since we are storing the entire dataset in the dataverse, we also store the raw xdf files and the associated stimulus/behavioral files in the dataverse. The folder structure is as follows:
77
+
This folder contains the converted BIDS data files and other files we want to version control using `Datalad`. Since we are storing the entire dataset in the dataverse, we also store the raw xdf files and the associated other/behavioral files in the dataverse. The folder structure is as follows:
78
78
```
79
79
└── bids
80
80
└──projectname/
@@ -90,7 +90,7 @@ This folder contains the converted BIDS data files and other files we want to ve
90
90
├── sub-001_ses-001_task-Duration_run-001_eeg.eeg
91
91
.........
92
92
└── beh
93
-
└──behavioral files
93
+
└──behavioral files (other files)
94
94
└── misc
95
95
└── experimental files (This needs to stored in zip format)
@@ -84,7 +87,7 @@ The configuration system manages dataversse and project-specific settings using
84
87
#### 1. Dataverse and Project Root Configuration (`gen_dv_config.py`)
85
88
86
89
This module generates a global configuration file for Dataverse and project root directories. This is a one-time setup per system. This file is stored in `~/.config/lslautobids/autobids_config.yaml` and contains:
87
-
- Paths for BIDS, projects, and stimulus directories : This allows users to specify where their eeg data, stimulus data, and converted BIDS data are stored on their system. This paths should be relative to the home/users directory of your system and string format.
90
+
- Paths for BIDS, projects, and project_other directories : This allows users to specify where their eeg data, behavioral data, and converted BIDS data are stored on their system. This paths should be relative to the home/users directory of your system and string format.
88
91
89
92
- Dataverse connection details: Base URL, API key, and parent dataverse name for uploading datasets. Base URL is the URL of the dataverse server (e.g. https://darus.uni-stuttgart.de), API key is your personal API token for authentication (found in your dataverse account settings), and parent dataverse name is the name of the dataverse under which datasets will be created (this can be found in the URL when you are in the dataverses page just after 'dataverse/'). For example, if the URL is `https://darus.uni-stuttgart.de/dataverse/simtech_pn7_computational_cognitive_science`, then the parent dataverse name is `simtech_pn7_computational_cognitive_science`.
90
93
@@ -189,15 +192,15 @@ The pipeline is designed to ensure:
189
192
190
193
2. EEG recordings are converted to BIDS format using MNE and validated against the BIDS standard.
191
194
192
-
3. Behavioral and experimental metadata (also called stimulus files in general) are included and checked against project expectations.
195
+
3. Behavioral and experimental metadata (also called other files in general in context on this project) are included and checked against project expectations.
193
196
194
197
4. Project metadata is populated (dataset_description.json). This is required as a part of BIDS standard.
195
198
196
199
5. The dataset is registered in Dataverse and optionally pushed/uploaded automatically.
197
200
198
201
#### 1. Entry Point (`bids_process_and_upload()`)
199
202
200
-
- Reads project configuration (<project_name>_config.toml) to check if a stimulus computer was used. (stimulusComputerUsed: true)
203
+
- Reads project configuration (<project_name>_config.toml) to check if a other computer (non eeg files) was used. (otherFilesUsed: true)
201
204
202
205
- Iterates over each processed file and extracts identifiers. For example, for a file named `sub-001_ses-001_task-Default_run-001_eeg.xdf`, it extracts:
203
206
@@ -246,7 +249,7 @@ This function handles the core conversion of a XDF files to BIDS format and cons
246
249
247
250
- Load `.xdf` with `create_raw_xdf()`. (See section).
248
251
249
-
- Apply anonymization (daysback_min + anonymization_number from project TOML config).
252
+
- Apply anonymization (daysback_min + anonymizationNumber from project TOML config).
250
253
251
254
- Write EEG data into BIDS folder via `write_raw_bids().`
252
255
@@ -261,7 +264,7 @@ This function handles the core conversion of a XDF files to BIDS format and cons
This function ensures that the original source files (EEG and stimulus/behavioral files) are also a part our dataset. These files can't be directly converted to BIDS format but we give the user the option to include them in the BIDS directory structure in a pseudo-BIDS format for completeness.
267
+
This function ensures that the original source files (EEG and other/behavioral files) are also a part our dataset. These files can't be directly converted to BIDS format but we give the user the option to include them in the BIDS directory structure in a pseudo-BIDS format for completeness.
@@ -270,13 +273,13 @@ This function ensures that the original source files (EEG and stimulus/behaviora
270
273
271
274
- If a file already exists, logs a message and skips copying.
272
275
273
-
If stimulusComputerUsed=True in project config file:
276
+
If otherFilesUsed=True in project config file:
274
277
275
278
1. Behavioral files are copied via `_copy_behavioral_files()`.
276
279
277
-
- Validates required files against TOML config (`ExpectedStimulusFiles`). In this config we add the the extensions of the expected stimulus files. For example, in our testproject we use EyeList 1000 Plus eye tracker which generates .edf and .csv files. So we add these extensions as required stimulus files. We also have mandatory labnotebook and participant info files in .tsv format.
280
+
- Validates required files against TOML config (`OtherFilesInfo`). In this config we add the the extensions of the expected other files. For example, in our testproject we use EyeList 1000 Plus eye tracker which generates .edf and .csv files. So we add these extensions as required other files. We also have mandatory labnotebook and participant info files in .tsv format.
278
281
- Renames files to include sub-XXX_ses-YYY_ prefix if missing.
279
-
- Deletes the other files in the stimulus directory that are not listed in `ExpectedStimulusFiles` in the project config file. It doesn"t delete from the source directory, only from out BIDS dataset.
282
+
- Deletes the other files in the project_other directory that are not listed in `OtherFilesInfo` in the project config file. It doesn"t delete from the source directory, only from out BIDS dataset.
280
283
281
284
2. Experimental files are copied via `_copy_experiment_files().`
282
285
@@ -285,7 +288,7 @@ If stimulusComputerUsed=True in project config file:
285
288
- Compresses into experiment.tar.gz.
286
289
- Removes the uncompressed folder.
287
290
288
-
There is a flag in the `lslautobids run` command called `--redo_stim_pc` which when specified, forces overwriting of existing stimulus and experiment files in the BIDS dataset. This is useful if there are updates or corrections to the stimulus/behavioral data that need to be reflected in the BIDS dataset.
291
+
There is a flag in the `lslautobids run` command called `--redo_other_pc` which when specified, forces overwriting of existing other and experiment files in the BIDS dataset. This is useful if there are updates or corrections to the other/behavioral data that need to be reflected in the BIDS dataset.
289
292
290
293
#### 4. Create Raw XDF (`create_raw_xdf()`)
291
294
This function reads the XDF file and creates an MNE Raw object. It performs the following steps:
@@ -364,7 +367,7 @@ This module handles the creation of a new dataset in Dataverse using the `pyData
364
367
#### 2. Linking DataLad to Dataverse (`link_datalad_dataverse.py`)
365
368
This module links the local DataLad dataset to the remote Dataverse dataset as a sibling. The function performs the following steps:
366
369
1. It first checks if the Dataverse is already created in the previous runs or it is just created in the current run (flag==0). If flag==0, it proceeds to link the DataLad dataset to Dataverse.
367
-
2. It runs the command `datalad add-sibling-dataverse dataverse_base_url doi_id`. This command adds the Dataverse as a sibling to the local DataLad dataset, allowing for synchronization and data management between the two. For lslautobids, we currently only allow to deposit data to Dataverse. In future version, we shall also add user controlled options for adding other siblings like github, gitlab, etc.
370
+
2. It runs the command `datalad add-sibling-dataverse dataverse_base_url doi_id`. This command adds the Dataverse as a sibling to the local DataLad dataset, allowing for synchronization and data management between the two. For lslautobids, we currently only allow to deposit data to Dataverse. In future version, we shall also add user controlled options for adding other siblings like github, gitlab, OpenNeuro, AWS etc.
368
371
369
372
We chose Dataverse as it serves as both a repository and a data sharing platform, making it suitable for our needs. It also integrates well with DataLad and allows sharing datasets with collaborators or the public.
370
373
@@ -402,3 +405,27 @@ This module contains various utility functions used across the application.
402
405
3.`write_toml_file` : Writes a dictionary to a TOML file.
403
406
404
407
408
+
## Testing
409
+
410
+
The testing framework uses `pytest` to validate the functionality of the core components.
411
+
412
+
- The tests are located in the `tests/` directory and cover various modules including configuration generation, file processing, BIDS conversion, DataLad integration, and Dataverse interaction. (Work in progress)
413
+
414
+
- The test directory contains :
415
+
-`test_utils` : Directory containing utility functions needed across multiple test files.
416
+
-`testcases` : Directory containing all the tests in a in a directory structure - `test_<test_name>`.
417
+
- Each `test_<test_name>` directory contains a `data` folder with sample data for that test and a `test_<test_name>.py` file with the actual test cases.
418
+
-`run_all_tests.py` : A script to run all the tests in the `testcases` directory sequentially.
419
+
420
+
Tests will be added continuously as new features are added and existing features are updated.
421
+
422
+
### Running Tests
423
+
424
+
To run the tests, navigate to the `tests/` directory and execute:
425
+
`python tests/run_all_tests.py`
426
+
427
+
These tests ensure that each component functions as expected and that the overall pipeline works seamlessly. This tests will also be triggered automatically on each push or PR to the main repository using GitHub Actions.
428
+
429
+
## Miscellianeous Points
430
+
- To the current date, only EEG data is supported for BIDS conversion. Support for other modalities like Eye-tracking, etc,. in the BIDS format is not yet supported. Hence, LSLAutoBIDS relies on semi-BIDS data structures for those data and use user-definable regular expressions to match expected data-files. A future planned feature is to provide users more flexibility, especially in naming / sorting non-standard files. Currently, the user can only specify the expected file extensions for other/behavioral data and is automatically renamed to include sub-XXX_ses-YYY_ prefix if missing and also copied to pseudo-BIDS folder structure like `<BIDS_ROOT>/sourcedata/sub-XXX/ses-YYY/`, `<BIDS_ROOT>/misc/experiment.tar.gz` etc,.
0 commit comments