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
version: 4.5.1.dev # BIDScoin version (should correspond with the version in pyproject.toml)
23
+
version: 4.5.2.dev # BIDScoin version (should correspond with the version in pyproject.toml)
24
24
subprefix: sub- # The subject prefix of the source data
25
25
sesprefix: ses- # The session prefix of the source data
26
26
bidsignore: [extra_data/, sub-*_ct.*] # List of entries that are added to the .bidsignore file (for more info, see BIDS specifications), e.g. [extra_data/, pet/, myfile.txt, yourfile.csv]
Copy file name to clipboardExpand all lines: bidscoin/heuristics/bidsmap_dccn.yaml
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ Options:
21
21
# General BIDScoin and plugin options
22
22
# -----------------------------------
23
23
bidscoin:
24
-
version: 4.5.1.dev # BIDScoin version (should correspond with the version in pyproject.toml)
24
+
version: 4.5.2.dev # BIDScoin version (should correspond with the version in pyproject.toml)
25
25
subprefix: sub- # The subject prefix of the source data
26
26
sesprefix: ses- # The session prefix of the source data
27
27
bidsignore: [extra_data/, sub-*_ct.*] # List of entries that are added to the .bidsignore file (for more info, see BIDS specifications), e.g. [extra_data/, pet/, myfile.txt, yourfile.csv]
@@ -1161,7 +1161,8 @@ Psychopy:
1161
1161
events: &psychopy_events
1162
1162
parsing: # The settings to parse the source table from the log file
1163
1163
table: [long-wide, pivot, 1] # The raw source table or a pivoted 'onset', 'duration', 'event_type' version
1164
-
expand: scannerPulse.rt # Expands lists into columns for each array item
1164
+
add_started: # Columns for which the .started time is added, i.e. that are converted to absolute timestamps (e.g. the .rt columns)
1165
+
expand: # Expands lists into columns for each array item
1165
1166
columns: # Columns that are included in the output table, i.e. {output column: input column}
1166
1167
- onset: onset # The mapping for the first required column 'onset'
1167
1168
- duration: duration # The mapping for the second required column 'duration'
Copy file name to clipboardExpand all lines: bidscoin/heuristics/bidsmap_sst.yaml
+5-2Lines changed: 5 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ Options:
20
20
# General BIDScoin and plugin options
21
21
# -----------------------------------
22
22
bidscoin:
23
-
version: 4.5.1.dev # BIDScoin version (should correspond with the version in pyproject.toml)
23
+
version: 4.5.2.dev # BIDScoin version (should correspond with the version in pyproject.toml)
24
24
subprefix: sub- # The subject prefix of the source data
25
25
sesprefix: ses- # The session prefix of the source data
26
26
bidsignore: [extra_data/, sub-*_ct.*] # List of entries that are added to the .bidsignore file (for more info, see BIDS specifications), e.g. [extra_data/, pet/, myfile.txt, yourfile.csv]
@@ -1163,7 +1163,8 @@ Psychopy:
1163
1163
events: &psychopy_events
1164
1164
parsing: # The settings to parse the source table from the log file
1165
1165
table: [long-wide, pivot, 1] # The raw source table or a pivoted 'onset', 'duration', 'event_type' version
1166
-
expand: scannerPulse.rt # Expands lists into columns for each array item
1166
+
add_started: # Columns for which the .started time is added, i.e. that are converted to absolute timestamps (e.g. the .rt columns)
1167
+
expand: # Expands lists into columns for each array item
1167
1168
columns: # Columns that are included in the output table, i.e. {output column: input column}
1168
1169
- onset: onset # The mapping for the first required column 'onset'
1169
1170
- duration: duration # The mapping for the second required column 'duration'
# Expand the array items in the source data, e.g. scannerPulse.rt = ["[493.15245039993897, 494.6524632999208, 496.15445999987423, 497.65245070005767, 499.1524501000531]"]
ds=df[expand].apply(lambdax: ast.literal_eval(x) ifisinstance(x,str) andx.startswith('[') else[])# Convert string representation of lists into actual Python lists
331
-
df_=ds.apply(pd.Series).add_prefix(f"{expand}{'.started'if'.'inexpandandtable=='pivot'else''}_") # Append `.started` to pivot the data into the onset column
344
+
ds=df[expand].apply(lambdax: ast.literal_eval(x) ifisinstance(x,str) andx.startswith('[') elsex) # Convert string representation of lists into actual Python lists
345
+
df_=ds.apply(pd.Series).add_prefix(f"{expand}{'.started'if'.'inexpandandtable=='pivot'else''}_") # Expand each item into its own column and append `.started` to pivot the data into the onset column
332
346
if'.'inexpand: # Time columns should have a `.` in their name
333
-
df_=df_.rename(columns=lambdacol: re.sub(r'(.*)\.(\w+)_(\d+)', r'\1_\3.\2', col)) # Put e.g. `.rt` or `.started` back at the end
347
+
df_=df_.rename(columns=lambdacol: re.sub(r'(.*)\.(\w+)_(\d+)', r'\1_\3.\2', col)) # Put e.g. `.rt` or `.started` back at the end of the column name
Copy file name to clipboardExpand all lines: docs/plugins.rst
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,10 +24,10 @@ Nibabel2bids: a generic plugin for imaging data
24
24
25
25
The nibabel2bids plugin wraps around the versatile `nibabel <https://nipy.org/nibabel>`__ tool to convert a wide variety of data formats into NIfTI-files. Currently, the default template bidsmap is tailored to NIfTI source data only (but this can readily be extended), and BIDS sidecar files are not automatically produced by nibabel (but see the note further below). Please cite: `DOI: 10.5281/zenodo.591597 <https://doi.org/10.5281/zenodo.591597>`__
26
26
27
-
Events2bids: a plugin for NeuroBS Presentation log data
The events2bids plugin parses `NeuroBS <https://www.neurobs.com/>`__ stimulus Presentation log files to BIDS task events files. See the `workflow page <./workflow.html#stimulus-events>`__ for usage.
30
+
The events2bids plugin parses `NeuroBS <https://www.neurobs.com/>`__ Presentation, `PsychoPy <https://psychopy.org/>`__, as well as generic behavioural log files to BIDS task events files. See the `workflow page <./workflow.html#stimulus-events>`__ for usage.
31
31
32
32
.. note::
33
33
Out of the box, BIDScoin plugins typically produce sidecar files that contain metadata from the source headers. However, when such metadata is missing (e.g. as for nibabel2bids), or when it needs to be appended or overruled, then users can add sidecar files to the source data (as explained `here <./bidsmap_indepth.html#run-items>`__) or add that metadata using the bidseditor (the latter takes precedence).
Copy file name to clipboardExpand all lines: docs/workflow.rst
+28-9Lines changed: 28 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -176,24 +176,43 @@ Finally, if all BIDS output names in the main window look correct, click the [Sa
176
176
177
177
Stimulus events
178
178
```````````````
179
-
If your dataset contain (stimulus) events logfiles and you are using e.g. the `events2bids <./plugins.html#events2bids-a-plugin-for-neurobs-presentation-log-data>`__ plugin to convert them to `BIDS events <https://bids-specification.readthedocs.io/en/stable/modality-specific-files/task-events.html>`__, you will get a ``Presentation``tab in the main window. The edit window for the run-items in therewill include an additional ``BIDS output data`` table, providing a preview of the output data. ``Edit`` the output data if needed.
179
+
If your dataset contain behavioural/stimulus presentation logfiles and you are using e.g. the `events2bids <./plugins.html#events2bids-a-plugin-for-stimulus-presentation-log-data>`__ plugin to convert them to `BIDS events <https://bids-specification.readthedocs.io/en/stable/modality-specific-files/task-events.html>`__, you will get a ``Presentation``, ``PsychoPy`` and/or a generic ``Logdata`` tab in the main window. If you open a run-items in there, you will get the same edit window as explained before, except that an extra ``BIDS output data`` table is appended on the right side. This table provides a preview of your log data after conversion to BIDS. Click on the ``Edit`` button next to the output table to adjust its content to your needs.
180
180
181
181
.. dropdown:: More details...
182
182
183
-
The edit window will then show the input data (left column), the mapping tables to convert the input data (middle column), and the preview of the converted output data. Tweak the mapping tables until the conversion is correct, and click on ``Done``. The mapping tables include tables for selecting the ``Columns`` and ``Rows``, along with a ``Timing`` table for calibration of the clock:
183
+
The edit window displays the parsed input data on the left, BIDS conversion settings in the center, and a preview of the BIDS output on the right.
184
184
185
-
* The **'Columns'** table specifies which input column names are included (left) and how they should be named in the output table (right). You can add, edit and remove column names as needed
186
-
* The **'Rows'** table specifies which input rows are included in the output table. A ``condition`` (left) is a dictionary with columns names as keys and regular expression patterns as values. Rows are included if the pattern matches with the column value, e.g. when an experimental condition is met. Note that the patterns within a condition act as AND operators, i.e. the more patterns you add, the less rows your include in the output table. The ``output column`` is optional and can be useful, e.g. to create a new output column or (contrast) regressor for your design matrix (see the screenshot below). Each row in the rows table defines a condition. Conditions acts as OR operators, i.e. the more conditions you add to the table, the more rows are included in the output table.
187
-
* The **'Timing'** table contains settings for converting input time values to BIDS compliant output values:
185
+
- **Left panel**: Configure how your raw log files are transformed into a tabular format, which is then processed using the settings from the center panel.
188
186
189
-
* **columns** -- A list of input column names that hold time values.
190
-
* **units/sec** -- The number of source data time units per second (e.g., 10000 for clock times with a precision of 0.1 milliseconds).
191
-
* **start** -- A dictionary with column names and event-codes that define the start of the run (time zero), e.g. the column name and event-code that log the scanner pulses.
187
+
- For **Presentation log files**, you can select from the drop-down menu which table within your log file to use.
188
+
- For **PsychoPy log files**, you can select from the drop-down menu whether to use the raw long-wide data, or to use a pivoted version in which all ``.started`` and ``.stopped`` timestamps are stored in the ``onset``, ``duration``, and ``event_type`` columns.
189
+
- Additionally, for **PsychoPy**, you can specify values for ``add_started`` and ``expand`` as regex patterns to select relevant input columns.
190
+
191
+
- **add_started** columns: The corresponding ``.started`` times will be added to these columns. This is useful for converting relative times (e.g., ``.rt`` reaction times) into absolute timestamps.
192
+
- **expand** columns: If a column contains list data (e.g., ``"['0', '2.1', '4.2']"``), it will be split into multiple new columns. These expanded columns are assumed to store time onsets and will be included when pivoting the data.
193
+
194
+
- **Center panel**: Define the mapping parameters that transform the input table (left panel) into the output table (right panel).
195
+
The mapping parameters are organized into three tables:
196
+
197
+
1. **'Columns' table** – Specifies which input column names are included (left) and how they should be named in the output table (right). You can add, edit, and remove column names as needed.
198
+
2. **'Rows' table** – Specifies which input rows are included in the output table. A **condition** (left) is a dictionary where column names serve as keys and values as regular expression patterns. Rows are included if the pattern matches a column value, i.e. when a specific experimental condition is met.
199
+
200
+
- Within a condition, patterns act as **AND** operators, meaning that the more patterns you add to the dictionary, the fewer rows are included in the output.
201
+
- Between conditions, they act as **OR** operators, meaning that adding more conditions increases the number of included rows.
202
+
- The **'output column'** is optional and can be used, for example, to create new output columns or contrast regressors for a design matrix (see the screenshot below).
203
+
204
+
3. **'Timing' table** – Contains settings for converting input time values to BIDS-compliant output values:
205
+
206
+
- **columns** – A list of input column names that contain time values.
207
+
- **units/sec** – The number of time units per second in the source data (e.g., 10000 for clock times with a precision of 0.1 milliseconds).
208
+
- **start** – A dictionary specifying column names and event codes that define the start of the run (time zero), such as the column name and event code that log scanner pulses.
192
209
193
210
.. figure:: ./_static/bidseditor_edit_events.png
194
211
:width:100%
195
212
196
-
*Edit window for conversion of Presentation log data to BIDS output data. Note that, since the first row condition has a non-selective matching pattern* ``.*``, *all input rows are included. Also note that, for selected rows, each of the two subsequent conditions add data ("go" and "stop") to the new* ``task`` *output column.*
213
+
*Edit window for converting Presentation log data to BIDS output. Note that, since the first row condition uses the non-selective matching pattern* ``.*``, *all input rows are included. Additionally, for selected rows, each of the two subsequent conditions adds data ("go" and "stop") to the new* ``task`` *output column.*
214
+
215
+
Adjust the mapping tables until the transformation is correct, then click on **"Done"**.
197
216
198
217
.. tip::
199
218
The BIDScoin GUI provides several tools to help you set the correct values:
0 commit comments