-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a docs page in the user guide about adding trials (#1002)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
f266297
commit d00f6d8
Showing
4 changed files
with
67 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
.. _adding_trials: | ||
|
||
Adding Trials to NWB Files | ||
========================== | ||
|
||
NWB allows you to store information about time intervals in a structured way. These structure are often used to store | ||
information about trials, epochs, or other time intervals in the data. | ||
You can add time intervals to an NWBFile object before writing it using PyNWB. | ||
Here is an example of how to add trials to an NWBFile object. | ||
Here is how you would add trials to an NWB file: | ||
|
||
.. code-block:: python | ||
# you can add custom columns to the trials table | ||
nwbfile.add_trials_column(name="trial_type", description="the type of trial") | ||
nwbfile.add_trial(start_time=0.0, stop_time=1.0, trial_type="go") | ||
nwbfile.add_trial(start_time=1.0, stop_time=2.0, trial_type="nogo") | ||
You can also add epochs or other types of time intervals to an NWB File. See | ||
`PyNWB Annotating Time Intervals <https://pynwb.readthedocs.io/en/stable/tutorials/general/plot_timeintervals.html>`_ | ||
for more information. | ||
|
||
Once this information is added, you can write the NWB file to disk. | ||
|
||
.. code-block:: python | ||
from neuroconv.tools.nwb_helpers import configure_and_write_nwbfile | ||
configure_and_write_nwbfile(nwbfile, save_path="path/to/destination.nwb", backend="hdf5") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters