Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed conversion factor and reordered builder #530

Open
wants to merge 237 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
237 commits
Select commit Hold shift + click to select a range
89e8d73
changes to remove converstion factor mulitplication from mda data
lfrank Aug 28, 2020
ec519b0
fixed converstion factor for mda and reordered builder components to …
lfrank Aug 28, 2020
326ba79
fixes to __get_camer_ids to allow more flexible naming
lfrank Aug 28, 2020
2d5f871
removed header validation
lfrank Oct 9, 2020
ccbfa4f
moved video_files_originator below camera_device_originator to fix bug
lfrank Nov 3, 2020
0c07ebe
Merge branch 'master' of https://github.com/LorenFrankLab/rec_to_nwb
lfrank Nov 3, 2020
63c98d2
fixed ElectricalSeriesCreator
lfrank Nov 4, 2020
b6068dd
Updated to fully working environment with newer pynwb and hdmf versions
lfrank Nov 4, 2020
f9556ab
remove duplicate calls to originators
jihyunbak Nov 4, 2020
d0f2495
put back mda_originator
jihyunbak Nov 4, 2020
b57cd21
Merge pull request #1 from jihyunbak/fix-originator-errors
lfrank Nov 5, 2020
ce07d85
fix code to apply default header
jihyunbak Nov 6, 2020
51f3d6d
make sure output directories exist
jihyunbak Nov 6, 2020
1cbdcee
Added requirement for numpy >= 1.19.4 so that mountainsort will work.
lfrank Nov 10, 2020
655eab4
Merge branch 'master' of https://github.com/LorenFrankLab/rec_to_nwb
lfrank Nov 10, 2020
d3550b4
fixed error in environment.yml
lfrank Nov 10, 2020
bd03efa
Merge pull request #3 from jihyunbak/fix-default-header-comparison
jihyunbak Nov 13, 2020
e04e681
try to process kf2
WojciechMerynda Nov 16, 2020
5169bc6
Merge remote-tracking branch 'novela/master'
jihyunbak Nov 24, 2020
a78d615
Add preprocessing options (#2)
jihyunbak Nov 24, 2020
ea6f230
Merge remote-tracking branch 'novela/user/wmerynda/Try_to_process_kf2…
jihyunbak Nov 25, 2020
98e1b3b
refactor RawToNWBBuilder intermediate steps
jihyunbak Nov 25, 2020
b6f9e92
propagate recent NWBFileBuilder changes to OldNWBFileBuilder
jihyunbak Nov 25, 2020
7a910fb
update RawToNWBBuilder to have access to OldNWBFileBuilder
jihyunbak Nov 26, 2020
ae89291
fix name typo in OldVideoFilesOriginator
jihyunbak Nov 26, 2020
1f79fa6
fix type for null timestamps field
jihyunbak Nov 26, 2020
13db272
read from cameraHWFrameCount when cameraHWSync is not available
jihyunbak Nov 26, 2020
3893f28
fix key error in OldFlAnalogExtractor
jihyunbak Nov 26, 2020
6dae09b
fix missing kwarg error in OldFlMdaExtractor
jihyunbak Nov 26, 2020
5b9b761
provide dummy timestamps
jihyunbak Nov 26, 2020
5d3752b
handle files with different numbers of rows
jihyunbak Nov 26, 2020
03d204e
auto-detect old dataset in RawToNWBBuilder
jihyunbak Nov 26, 2020
46a1c99
add timezone to default session start time
jihyunbak Dec 1, 2020
b661858
skip append_to_nwb for old datasets
jihyunbak Dec 1, 2020
2309513
Merge pull request #6 from LorenFrankLab/process-kf2-no-timestamps
lfrank Dec 3, 2020
8709e96
Changes to now convert raw data to uV
lfrank Jan 28, 2021
33f260b
first efforts to make the time processing more efficient. Not tested …
lfrank Jan 29, 2021
b20fa24
updates to use numpy for continuous time processing
lfrank Jan 29, 2021
498d837
propagate uV unit change to old mda processing
jihyunbak Feb 11, 2021
abc469c
Update README.md
lfrank Feb 12, 2021
eee53fd
Updated filesorter to correct incorrect mda sorting
lfrank Feb 12, 2021
a71ade5
Merge branch 'master' of https://github.com/LorenFrankLab/rec_to_nwb
lfrank Feb 12, 2021
ee76343
Fixes to installation instructions.
lfrank Feb 12, 2021
0c822cd
fixed bug in FileSorter
lfrank Feb 12, 2021
3295b57
Updated environment.yml to use latest version of rec_to_binaries
lfrank Feb 12, 2021
11bdc58
add run_preprocessing option
jihyunbak Feb 11, 2021
3949b6f
propagate changes to fl_position_manager to old
jihyunbak Feb 15, 2021
cb35385
Refactor old dataset processing (#9)
jihyunbak Feb 17, 2021
c91ff5f
Update README.md
lfrank Mar 11, 2021
6e65f8b
Update README.md
lfrank Mar 11, 2021
8f5db13
updates to manage RAM usage for large MDA files
lfrank May 24, 2021
94233d1
Merge pull request #10 from LorenFrankLab:chunked_mda_read
lfrank May 24, 2021
1a3b44e
removed print statement
lfrank May 24, 2021
dabaed5
fixes to reference electrode code
lfrank May 25, 2021
11b5d52
Merge branch 'master' of https://github.com/LorenFrankLab/rec_to_nwb
lfrank May 25, 2021
2ae5c7c
Fix underscore in experimenter name
edeno Jun 18, 2021
f75ed96
Fix underscore in experiment description
edeno Jun 18, 2021
5daf7fc
Make data acq device have underscores
edeno Jun 18, 2021
351cbd8
Fix underscore for session description
edeno Jun 18, 2021
bb54b30
Fix underscore for electrode groups
edeno Jun 18, 2021
63681e1
Fix underscore in ntrode electrode group channel map
edeno Jun 18, 2021
8bebe1f
Fix underscore in subject id
edeno Jun 18, 2021
153a840
Merge pull request #11 from LorenFrankLab/Fix-underscore-in-yaml
lfrank Jun 18, 2021
40e8d5b
Add yaml tag for code highlighting
edeno Jul 2, 2021
6389539
Add jupyter lab as a dependency and use conda to install rec_to_binaries
edeno Jul 2, 2021
e4170d0
Merge branch 'master' of https://github.com/LorenFrankLab/rec_to_nwb
edeno Jul 2, 2021
30c5c20
Revert "Add jupyter lab as a dependency and use conda to install rec_…
edeno Jul 2, 2021
595d623
Add jupyterlab
edeno Jul 2, 2021
74ede99
Added batch processing and yaml conversion scripts (#12)
asilvaalex4 Jul 7, 2021
98c08de
Add to gitignore
edeno Aug 20, 2021
5292023
Ignore vscode
edeno Aug 20, 2021
cff93a8
Remove egg info
edeno Aug 20, 2021
5b5cee6
Delete .DS_Store
edeno Aug 20, 2021
f851ae6
Delete rec_to_nwb.log
edeno Aug 20, 2021
be14f0a
Delete settings.json
edeno Aug 20, 2021
d986d89
Fix ignore vscode
edeno Aug 20, 2021
95485d0
Add franklab rec_to_binaries
edeno Aug 20, 2021
d5fd423
Delete .gitignore
edeno Aug 20, 2021
1000580
Add RawToNWBBuilder and MetadataManager to top level for easy importing
edeno Aug 20, 2021
a6c3f62
Add repr to RawToNWBBuilder
edeno Aug 20, 2021
a2e82f4
Minor formatting
edeno Aug 20, 2021
ae94089
Switch order of priority of channels
edeno Aug 20, 2021
e17cef8
Move environment.yml to top folder
edeno Aug 20, 2021
cdf8ac9
Ignore .dat files
edeno Aug 20, 2021
596aa1d
Allow for preprocessing output to be in a different place
edeno Aug 20, 2021
6f8895a
Minor formatting
edeno Aug 20, 2021
6728e7a
Ignore xml, video and mda files
edeno Aug 23, 2021
d5705ee
Write headers to preprocessing out if it exists
edeno Aug 23, 2021
7af723d
Fix missing references to preprocessing out
edeno Aug 23, 2021
1c736f2
Ignore nwb files
edeno Aug 23, 2021
6da06cb
Add units to the Camera Sample Frame Counts
edeno Aug 23, 2021
1582fe3
Minor formatting
edeno Aug 23, 2021
722194c
Minor formatting
edeno Aug 23, 2021
b893839
Minor formatting
edeno Aug 23, 2021
db2c299
Delete .DS_Store
edeno Aug 23, 2021
00f65dc
Remove unused import
edeno Aug 23, 2021
0e83fb7
Handle new dio filename format
edeno Aug 24, 2021
9863741
Don't log contents of associated files. Clutters the log file.
edeno Aug 24, 2021
acac94a
Safer path handling
edeno Aug 24, 2021
6772b1d
Remove preprocessing out. It is redundant.
edeno Aug 25, 2021
5e49fea
Indicate constants
edeno Aug 25, 2021
90f0c8e
Make constant explicit
edeno Aug 25, 2021
38157ef
Safer paths
edeno Aug 25, 2021
3923467
Minor formatting
edeno Aug 25, 2021
3149df2
Merge branch 'master' of https://github.com/LorenFrankLab/rec_to_nwb
edeno Aug 25, 2021
e86c748
Safer paths for logging
edeno Aug 25, 2021
d6d3fd1
Minor formatting
edeno Aug 25, 2021
0aed294
Make constants explicit
edeno Aug 25, 2021
a7c7fa1
Fix missing commas
edeno Aug 25, 2021
13fc6b1
Remove old environment yaml
edeno Aug 25, 2021
f81f441
Update README.md
edeno Aug 25, 2021
d921781
Update test environment
edeno Aug 25, 2021
da163de
Update README.md
edeno Aug 25, 2021
8df8cdf
Minor formatting
edeno Aug 26, 2021
1fb6a8a
Add documentation
edeno Aug 26, 2021
6a567db
Add documentation
edeno Aug 26, 2021
84562ec
Add documentation
edeno Aug 26, 2021
556f440
Add copying of video to doc
edeno Aug 26, 2021
bdd0a18
Add documentation
edeno Aug 26, 2021
7b055df
Avoid loop
edeno Aug 26, 2021
06d40cc
Add documentation
edeno Aug 26, 2021
d06d920
Move scripts to franklabnwb repo
edeno Aug 26, 2021
4b77a17
Fix filenames
edeno Aug 26, 2021
a2e9b0a
Missing period
edeno Aug 26, 2021
bf0b164
More detailed logging information
edeno Aug 26, 2021
05b1783
Minor formatting
edeno Aug 26, 2021
6c04bb6
Don't log xml header differences
edeno Aug 26, 2021
cb05f5d
Remove unused code
edeno Aug 26, 2021
e15d1c4
Avoid two loops
edeno Aug 26, 2021
2fb081f
Add docstring
edeno Aug 26, 2021
fcc1f8f
Merge branch 'master' of https://github.com/LorenFrankLab/rec_to_nwb
edeno Aug 26, 2021
9bd7ba5
Add documentation
edeno Aug 27, 2021
7a426ad
Add more documentation
edeno Aug 27, 2021
7eb334b
More documentation
edeno Aug 27, 2021
726ac47
Simplify code using np.digitize
edeno Aug 27, 2021
82610c2
Minor formatting
edeno Aug 27, 2021
e316de8
Fix video timestamps so that they correspond to the adjusted timestam…
edeno Aug 31, 2021
b6d57b7
Revert "Fix video timestamps so that they correspond to the adjusted …
edeno Aug 31, 2021
3b509d8
Fix spelling
edeno Sep 8, 2021
a6801fe
Use PTP time when it is available for position tracking timestamps
edeno Sep 8, 2021
914f07c
Handle case where there are duplicated timestamps
edeno Sep 9, 2021
0230a69
Don't make PosTimestamp the index
edeno Sep 9, 2021
448cbe0
Get the unique timestamps from the online tracking and use those to i…
edeno Sep 9, 2021
7fcdb6d
Don't include rightmost bin
edeno Sep 9, 2021
dc94bab
Change formatting of string
edeno Sep 26, 2021
2dbaa4b
added print in fl_mda_extractor
lfrank Oct 13, 2021
dc7c37c
Changed file size calculation to reflect multiple channels and 2 byte…
jguides Oct 19, 2021
d0630f4
Merge pull request #16 from LorenFrankLab/rec_to_nwb_jag_edits
lfrank Oct 19, 2021
85d6f9c
Changes to enable storing task environment in metadata
jguides Nov 7, 2021
7901a1f
Changed task metadata subfield from environment to task_environment t…
jguides Nov 9, 2021
825a473
Merge pull request #17 from LorenFrankLab/rec_to_nwb_jag_edits
edeno Nov 10, 2021
00e96c5
Set task_environment to none if not defined in metadata
jguides Nov 14, 2021
6fdd0f9
Merge pull request #18 from LorenFrankLab/rec_to_nwb_jag_edits
lfrank Nov 17, 2021
eb4e291
Set default arguments by trodes version
edeno Nov 27, 2021
90224f2
Use sorting mode 1 to have separate ntrode files
edeno Nov 29, 2021
ee5bbc1
If can't find mda files in .mda folder, look in .mountainsort folder …
edeno Nov 29, 2021
c6f773f
bug fixes for electrode_table: all electrodes now included
lfrank Dec 9, 2021
2f27365
version update
lfrank Dec 9, 2021
f948de1
updated requirements in setup.py
lfrank Dec 9, 2021
78b8729
Fix README formatting
rly Dec 11, 2021
d963621
Fix missing comma
edeno Dec 12, 2021
9c6792d
Minor formatting
edeno Dec 12, 2021
284b9e2
Use ndx-franklab-novela 0.1.0 (#19)
rly Jan 13, 2022
deac816
Fix lfp default arguments
edeno Jan 31, 2022
dc1825b
Make sure no referencing for trodes 2.0+
edeno Jan 31, 2022
cb18ddf
Use HWSync not HWFrameCount for PTP
edeno Feb 1, 2022
25e3591
Fix missing comma
edeno Feb 2, 2022
41416d9
Detect when hwsync file is not found
edeno Feb 2, 2022
21078b0
Handle multiple experimenters in __str__
edeno Mar 3, 2022
58c82fa
Create PR-test.yml
edeno Mar 15, 2022
cecec56
Add badge
edeno Mar 15, 2022
f08ba85
Fix pip install
edeno Mar 15, 2022
b38dae2
added print for debugging
lfrank May 2, 2022
6297030
add try except to position_originator.py
lfrank May 3, 2022
d19e913
added print statement
lfrank May 3, 2022
cdca8ef
Revert "Detect when hwsync file is not found"
edeno May 3, 2022
511c9ed
Revert "Use HWSync not HWFrameCount for PTP"
edeno May 3, 2022
824bbe7
Return only unique timestamps
edeno May 17, 2022
7d0790c
Unique returns a numpy array instead of a pandas series.
edeno May 25, 2022
6a64202
Refactor to handle non-ptp timestamps and simplify code logic.
edeno Jun 3, 2022
9c79226
Fix order of assertion test
edeno Jun 3, 2022
bfa285a
Remove equality
edeno Jun 3, 2022
b02f478
Auto stash before merge of "master" and "origin/master"
shijiegu Jun 3, 2022
5b81078
Handle case where there are no corresponding trodes time stamps even …
edeno Jun 3, 2022
95394a3
Merge remote-tracking branch 'origin/master'
shijiegu Jun 4, 2022
3439602
Merge branch 'master' into shijiegu
shijiegu Jun 4, 2022
10d78bd
Merge pull request #26 from LorenFrankLab/shijiegu
shijiegu Jun 17, 2022
a65ad84
Revert "Merge remote-tracking branch 'origin/master'"
edeno Jun 21, 2022
097033d
Squashed commit of the following:
edeno Jun 23, 2022
b07eabc
Merge branch 'master' into abhilasha_fix
edeno Jun 23, 2022
b99ea0e
Add try statement
edeno Jun 23, 2022
22d89b7
Merge pull request #29 from LorenFrankLab/abhilasha_fix
edeno Jul 7, 2022
8eb5d82
Handle disconnects
edeno Jul 19, 2022
19b74bc
This code inserts PTP time and video frame count in position if there…
edeno Aug 2, 2022
1ad547f
Merge pull request #36 from LorenFrankLab/handle-no-position-tracking
edeno Aug 4, 2022
c80be85
Fix string representation of experimenter name
edeno Aug 19, 2022
dc2b2ca
Remove unused variable
edeno Aug 19, 2022
2374247
Account for trodes time that exists for the video but not for the mcu…
edeno Aug 29, 2022
bbd00f2
typo in log statement for estimated camera frame rate
MichaelCoulter Sep 23, 2022
7e143c5
Merge pull request #39 from MichaelCoulter/patch-1
edeno Oct 12, 2022
278b42d
Fix for missing online position tracking files
edeno Oct 19, 2022
d69eb65
Merge pull request #40 from LorenFrankLab/fix-for-missing-pos-trackin…
edeno Oct 25, 2022
badcd8c
Skip MCU_IO binaries and alert user
acomrie Apr 14, 2023
6b4fc43
Merge pull request #47 from acomrie/patch-1
edeno Apr 14, 2023
c73852f
Handle date of birth of subject
edeno Apr 21, 2023
aa8481b
Format using black and sort imports
edeno Apr 21, 2023
3aba8cb
Emphasize file and directory structure needed to run rec_to_nwb
edeno Apr 21, 2023
530a901
Fix call to metadata
edeno Apr 28, 2023
356d4ef
Convert DOB from datetime object to string
edeno Apr 28, 2023
8e35dd3
save multiple LED position data as separate spatialSeries
Jun 15, 2023
119fcca
reduce potential position variable names
samuelbray32 Jun 16, 2023
6132016
correct contditional indentation
Jun 16, 2023
3dafd50
only single first timestamp per epoch
Jun 16, 2023
8603821
reduce valid position name options. Ensure both LED's us xloc, yloc a…
Jun 16, 2023
4d4c25d
simple cleanup
samuelbray32 Jun 16, 2023
91f1a52
resolve redundant first_timestamps addon
Jun 16, 2023
d4b6391
Handle case where there are no camera dio ticks and add warnings
edeno Jun 29, 2023
daa74b1
Convert from uint32 to int32 before unwrapping
edeno Jul 3, 2023
626c9d6
If no DOB, continue
edeno Jul 3, 2023
0396a66
Add position frame indexes and non-repeating timestamps as new proces…
samuelbray32 Jul 6, 2023
fd2c6b9
Detect if ptp is enabled based on rec header
edeno Jul 6, 2023
8e612be
Cleanup syntax
edeno Jul 7, 2023
1c1b2da
Merge branch 'master' into master
edeno Jul 11, 2023
73c83f7
Update position_originator.py
edeno Jul 11, 2023
8b1c219
Merge pull request #51 from samuelbray32/master
edeno Jul 11, 2023
6a08662
Remove type checking
edeno Jul 31, 2023
653fa96
Raise error if no DOB
edeno Aug 1, 2023
d5ffecc
Change key to prevent overiding between analog channels with similar …
samuelbray32 Aug 18, 2023
952e039
Prevent timestamps label from being added to the behavioral events de…
samuelbray32 Aug 18, 2023
85cd84a
Minor style change
samuelbray32 Aug 18, 2023
7506848
Fix error caused by Controller_Din headstage channels
samuelbray32 Aug 18, 2023
6edf70c
Merge pull request #55 from samuelbray32/fix_analog_name_overlap
edeno Aug 18, 2023
7eafba6
Merge pull request #56 from samuelbray32/fix_dio_name_overlap
edeno Aug 18, 2023
785e32c
Fix f-string bug
samuelbray32 Sep 6, 2023
2ee025a
Merge pull request #57 from samuelbray32/patch-1
edeno Sep 6, 2023
4a23927
Use ptp to detect pause time if dio video stamps unavailable
samuelbray32 Oct 4, 2023
1ee4f4f
Merge pull request #58 from samuelbray32/master
edeno Oct 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/PR-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: PR Test

on: push

jobs:
run-tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest] #, macos-latest, windows-latest]
env:
OS: ${{ matrix.os }}
PYTHON: '3.8'
steps:
- name: Cancel Workflow Action
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Set up conda environment
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: rec_to_nwb
environment-file: environment.yml
- name: Install rec_to_nwb
shell: bash -l {0}
run: |
pip install -e .
33 changes: 28 additions & 5 deletions rec_to_nwb/.gitignore → .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
Expand All @@ -38,6 +40,7 @@ pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
Expand Down Expand Up @@ -72,9 +75,20 @@ target/
# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# celery beat schedule file
celerybeat-schedule

Expand Down Expand Up @@ -102,9 +116,18 @@ venv.bak/

# mypy
.mypy_cache/

# idea pycharm
../.idea/

#testexample
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
.DS_Store
*.mat
*.lock
*.dirlock
.vscode
*.dat
*.xml
*.h264
*.mda
*.nwb
117 changes: 52 additions & 65 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,12 @@
# rec_to_nwb
[![PR Test](https://github.com/LorenFrankLab/rec_to_nwb/actions/workflows/PR-test.yml/badge.svg)](https://github.com/LorenFrankLab/rec_to_nwb/actions/workflows/PR-test.yml)
# About
rec_to_nwb is a python conda package for converting SpikeGadgets rec files to NWB files.<br>
It converts experiment data from `/raw` or `/preprocessing` folder to `.nwb` file. It utilizes rec_to_binaries package for preprocessing phase.<br>
<https://github.com/LorenFrankLab/rec_to_binaries><br>

# Prerequisites
## For users
1. Install Spike Gadgets <br>
<https://bitbucket.org/mkarlsso/trodes/downloads/>
2. Add SpikeGadgets to path. <br>
If Spike Gadgets is in default location: <br>
```bash
export PATH="$HOME/SpikeGadgets/:$PATH"
```
3. Download miniconda from <br>
<https://docs.conda.io/en/latest/miniconda.html> <br>
4. Install rec_to_nwb package:
```bash
conda install -c conda-forge -c novelakrk rec_to_nwb
```
5. Install Jupyter notebook
```bash
pip install jupyter notebook
```
# Instructions:
Currently we suggest following the instructions to install https://github.com/LorenFrankLab/franklabnwb, as that includes additional files that are helpful, but you can install this using the instructions below.

## For developers
1. Install Spike Gadgets <br>
Expand All @@ -32,21 +16,21 @@ It converts experiment data from `/raw` or `/preprocessing` folder to `.nwb` fil
```bash
export PATH="$HOME/SpikeGadgets/:$PATH"
```
3. Download miniconda from<br>
<https://docs.conda.io/en/latest/miniconda.html><br>
3. Install anaconda or miniconda if you haven't already.

4. clone repository
```bash
git clone https://github.com/NovelaNeuro/rec_to_nwb.git
git clone https://github.com/LorenFrankLab/rec_to_nwb.git

cd rec_to_nwb/rec_to_nwb
cd rec_to_nwb
```
5. Create conda environment.
```bash
conda env create -f environment.yml
```
6. jupyter notebook installation
6. Install rec_to_nwb
```bash
pip install jupyter notebook
pip install -e .
```
7. Documentation can be viewed at <br>
<https://novelaneuro.github.io/rec_to_nwb-docs/>
Expand All @@ -63,27 +47,31 @@ It converts experiment data from `/raw` or `/preprocessing` folder to `.nwb` fil
jupyter notebook nwb_generation.ipynb
```
4. Metadata.yml description:
```
# general information about the experiment
experimenter name: Alison Comrie

Important note: right now the code assumes that the electrode groups listed below (each of which corresponds to one or more NTrode in the file) are in ascending order by NTrode number. If this is not the case the data could be scrambled. Thus, the first listed electrode group should correspond to, for example, NTrode 1 (or perhaps NTrodes 1-4) while the second would correspond to NTrode 2 (or 5-8), etc.


```yaml
# general information about the experiment
experimenter_name: Alison Comrie
lab: Loren Frank
institution: University of California, San Francisco
experiment description: Reinforcement learning
session description: Reinforcement leaarning
experiment_description: Reinforcement learning
session_description: Reinforcement leaarning
session_id: beans_01
subject:
description: Long Evans Rat
genotype: Wild Type
sex: Male
species: Rat
subject id: Beans
subject_id: Beans
weight: Unknown
#Units of analog and behavioral_events
units:
analog: 'unspecified'
behavioral_events: 'unspecified'
#data acq device used in experiment
data acq device:
#data_acq_device used in experiment
data_acq_device:
- name: acq_0
system: sample_system
amplifier: sample_amplifier
Expand Down Expand Up @@ -129,19 +117,18 @@ It converts experiment data from `/raw` or `/preprocessing` folder to `.nwb` fil
associated_video_files:
- name: 20190718_beans_01_s1.1.h264
camera_id : 0
# Times period multiplier is used in pos/mda invalid/valid times, to multiply the period when detecting gaps,
to avoid creating invalid times in case of only small deviations. (optional parameter, default 1.5)
# Times period multiplier is used in pos/mda invalid/valid times, to multiply the period when detecting gaps, to avoid creating invalid times in case of only small deviations. (optional parameter, default 1.5)
times_period_multiplier: 1.5
# Din/Dout events which filter out files from DIO data in data directory. Each name has to be unique. Stored in behavioral_events section in output nwb file.
behavioral_events:
behavioral_events:
- name: Poke2
description: Din2
# Device name. Stored in output nwb file.
device:
device:
name:
- Trodes
# Electrode Groups list used in experiment. Each Id has to be unique, device_type has to refer to existing device_type in probe.yml. Target_x,y,z fields describe the specified location where this group should be. Possible value of units: 'um' or 'mm'
electrode groups:
# Electrode Groups list used in experiment. Each Id has to be unique, device_type has to refer to existing device_type in probe.yml. Target_x,y,z fields describe the specified location where this group should be. Possible value of units: 'um' or 'mm'
electrode_groups:
- id: 0
location: mPFC
device_type: 128c-4s8mm6cm-20um-40um-sl
Expand All @@ -163,8 +150,8 @@ It converts experiment data from `/raw` or `/preprocessing` folder to `.nwb` fil
# Ntrodes list which refer 1:1 to <SpikeNTrode> elements from xml header existing in rec binary file.
# ntrode_id has to match to SpikeNTrode id, electrode_group_id refers to electrode group,
# bad_channels is a list of broken channels in the map, where map corresponds to the electrode channels
- ntrode_id: 1
electrode_group_id: 0
- ntrode_id: 1
electrode_group_id: 0
bad_channels: [0,2]
map:
0: 0
Expand All @@ -179,9 +166,10 @@ It converts experiment data from `/raw` or `/preprocessing` folder to `.nwb` fil
1: 5
2: 6
3: 7
```
5. Probe.yml description:
```

5. Probe.yml description:
```yaml
probe_type: tetrode_12.5 # Type of the probe that refers to device_type in electrode_group in metadata.yml
units: 'um' # possible value for unit is um or mm
probe_description: 'four wire electrode'
Expand Down Expand Up @@ -212,8 +200,8 @@ It converts experiment data from `/raw` or `/preprocessing` folder to `.nwb` fil
7. Input files `metadata.yml` as well as `probe[1-N].yml` are validated against rec files headers.

8. We provide two class to generate the NWB file. <br>
* `RawToNWBBuilder` - To generate NWB file from raw data. <br>
* `NWBFileBuilder` - To generate NWB file from preprocessed data. <br>
* `RawToNWBBuilder` - To generate NWB file from raw data. <br>
* `NWBFileBuilder` - To generate NWB file from preprocessed data. <br>

##### Raw data
Initialize RawToNWBBuilder, which requires `animal_name`, `data_path` and `dates` which exist in your experiment folder. Next build the NWB using `build_nwb()`. <br>
Expand All @@ -238,9 +226,9 @@ If you don't want mda or pos invalid/valid times in your nwb, set accordingly fl
**dates** = `list of strings` names of folders that contain experiment data <br>

**nwb_metadata** = `MetadataManager` object with metadata.yml and probes.yml <br>

**output_path** = `string` path specifying location and name of result file (dafault 'output.nwb') <br>

**video_path** = `string` path specifying location of video files .h264 where those are copied <b4>

**extract_analog** = `boolean` flag specifying if analog data should be extracted from raw (default True) <br>
Expand All @@ -254,22 +242,22 @@ If you don't want mda or pos invalid/valid times in your nwb, set accordingly fl
**extract_mda** = `boolean` flag specifying if mda data should be extracted from raw (default True) <br>

**parallel_instances** = `int` number of threads, optimal value highly depends on hardware (default 4) <br>

**overwrite** = `boolean` If true, will overwrite existing files. (default True) <br>

**trodes_rec_export_args** = `tuple of strings` path to rec header file which overrides all headers existing in rec binary files e.g `_DEFAULT_TRODES_REC_EXPORT_ARGS = ('-reconfig', str(path) + '/test/processing/res/reconfig_header.xml')` <br>

build_nwb arguments:

**process_mda_valid_time** = 'boolean' True if the mda valid times should be build and append to nwb.
Need the mda data inside the nwb. (default True) <br>

**process_mda_invalid_time** = 'boolean' True if the mda invalid times should be build and append to nwb.
Need the mda data inside the nwb. (default True) <br>

**process_pos_valid_time** = 'boolean' True if the pos valid times should be build and append to nwb.
Need the pos data inside the nwb. (default True) <br>

**process_pos_invalid_time** = 'boolean' True if the pos invalid times should be build and append to nwb.
Need the pos data inside the nwb. (default True) <br>

Expand All @@ -294,38 +282,38 @@ After that, you can add mda or pos invalid/valid data to your NWB, using 'build_
NWBFileBuilder arguments

**data_path** = `string` path to directory containing all experiments data <br>

**animal_name** = `string` directory name which represents animal subject of experiment <br>

**date** = `string` date of experiment <br>

**nwb_metadata** = `MetadataManager` object contains metadata about experiment <br>

**process_dio** = `boolean` flag if dio data should be processed <br>

**process_mda** = `boolean` flag if mda data should be processed <br>

**process_analog** = `boolean` flag if analog data should be processed <br>

**video_path** = `string` path specifying location of video files .h264 where those are copied <b4>

**output_file** = `string` path and name specifying where .nwb file gonna be written <br>

build_and_append_to_nwb arguments:

**process_mda_valid_time** = 'boolean' True if the mda valid times should be build and append to nwb.
Need the mda data inside the nwb. (default True) <br>

**process_mda_invalid_time** = 'boolean' True if the mda invalid times should be build and append to nwb.
Need the mda data inside the nwb. (default True) <br>

**process_pos_valid_time** = 'boolean' True if the pos valid times should be build and append to nwb.
Need the pos data inside the nwb. (default True) <br>

**process_pos_invalid_time** = 'boolean' True if the pos invalid times should be build and append to nwb.
Need the pos data inside the nwb. (default True) <br>

9. Make sure that the data structure in given directory (in that case `test_data`) looks similar to following example:
9. Make sure that the file and directory structure (in that case `test_data`) looks similar to following example. Please NOTE that rec_to_nwb will fail if the data is not in this format:
```bash
--test_data
|
Expand Down Expand Up @@ -560,4 +548,3 @@ After that, you can add mda or pos invalid/valid data to your NWB, using 'build_
|-- README.md
```
When processing completes, a nwb file is created in the output_path directory

Loading