BlackRock Examples
First we need to create our NWB object, we’ll use this generic one
1from simply_nwb import SimpleNWB
2import pendulum
3from pynwb.file import Subject
4
5
6def nwb_gen():
7 return SimpleNWB.create_nwb(
8 # Required
9 session_description="Mouse cookie eating session",
10 # Subtract 1 year so we don't run into the 'NWB start time is at a greater date than current' issue
11 session_start_time=pendulum.now().subtract(years=1),
12 experimenter=["Schmoe, Joe"],
13 lab="Felsen Lab",
14 experiment_description="Gave a mouse a cookie",
15
16 # Optional
17 identifier="cookie_0",
18 subject=Subject(**{
19 "subject_id": "1",
20 "age": "P90D", # ISO-8601 for 90 days duration
21 "strain": "TypeOfMouseGoesHere", # If no specific used, 'Wild Strain'
22 "description": "Mouse#2 idk",
23 "sex": "M", # M - Male, F - Female, U - unknown, O - other
24 # NCBI Taxonomy link or Latin Binomial (e.g.'Rattus norvegicus')
25 "species": "http://purl.obolibrary.org/obo/NCBITaxon_10116",
26 }),
27 session_id="session0",
28 institution="CU Anschutz",
29 keywords=["mouse"],
30
31 # related_publications="DOI::LINK GOES HERE FOR RELATED PUBLICATIONS"
32 )
An example usage of the blackrock functions is as follows
1from simply_nwb.transforms import blackrock_load_data, blackrock_all_spiketrains
2from simply_nwb import SimpleNWB
3from gen_nwb import nwb_gen
4
5
6def nwb_nev():
7 nwb = nwb_gen()
8 SimpleNWB.blackrock_spiketrains_as_units(
9 nwb,
10 blackrock_filename="../data/wheel_4p3_lSC_2001.nev",
11 device_description="BlackRock device hardware #123",
12 electrode_name="Steve the Electrode",
13 electrode_description="Electrode desc",
14 electrode_location_description="location description",
15 # stereotaxic position of this electrode group (x, y, z)
16 # (+y is inferior)(+x is posterior)(+z is right) (required)
17 electrode_resistance=0.4, # Impedance in ohms
18 # Description of the reference electrode and/or reference scheme used for this electrode,
19 # e.g.,"stainless steel skull screw" or "online common average referencing"
20
21 # Optional args
22 device_manufacturer="BlackRock",
23 device_name="BlackRock#4",
24 )
25
26 t = nwb.units["spike_times"][:] # List of spike times
27
28 return nwb, []
29
30
31def nev_test():
32 d = blackrock_load_data("../data/wheel_4p3_lSC_2001.nev")
33 d2 = blackrock_all_spiketrains("../data/wheel_4p3_lSC_2001.nev")
34 tw = 2