Skip to content
This repository has been archived by the owner on Jul 30, 2022. It is now read-only.

Commit

Permalink
add test script
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolocin committed Oct 6, 2020
1 parent d533c44 commit c660840
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# test script
# will upload data as datalad directory later

from BonsaiRecordingExtractor import BonsaiRecordingExtractor
from BonsaiNwbConverter import *
import json

import pynwb
from pynwb import NWBHDF5IO
from pynwb import NWBFile
from pynwb.ecephys import ElectricalSeries
from pynwb.ecephys import ElectrodeGroup
from pprint import pprint
from pandas import read_csv


# BonsaiRecordingExtractor inputs
params = {
"bonsai_dir": "data/jv_main",
"metadata_file": "aquisition_oni.bonsai",
"traces_file": "intan_2019-12-05T09_28_34.raw",
"time": "intan-first-time_2019-12-05T09_28_34.csv",
}


RX = BonsaiRecordingExtractor(**params)
md = RX.metadata

# saves auto generated metadata, needs editing to generate NWB file
with open('metadata_original.json', 'w') as outfile:
json.dump(md, outfile, indent=4, sort_keys=True)

# read edited metadata
with open('metadata_edited.json', 'r') as infile:
edited_md = json.load(infile)

# use edited metadata to generate NWB
edited_RX = RX
edited_RX.metadata = edited_md
create_nwb(edited_RX, 'bonsai.nwb')

0 comments on commit c660840

Please sign in to comment.