Skip to content

Commit 32397c7

Browse files
committed
Clean up IO classes
1 parent 74cc961 commit 32397c7

File tree

3 files changed

+56
-10
lines changed

3 files changed

+56
-10
lines changed

src/pynwb/io/icephys.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ def __init__(self, spec):
2626

2727
@register_map(IntracellularRecordingsTable)
2828
class IntracellularRecordingsTableMap(AlignedDynamicTableMap):
29-
"""
30-
Customize the mapping for AlignedDynamicTable
31-
"""
32-
def __init__(self, spec):
33-
super().__init__(spec)
3429

3530
@DynamicTableMap.object_attr('electrodes')
3631
def electrodes(self, container, manager):

src/pynwb/io/misc.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
@register_map(DecompositionSeries)
99
class DecompositionSeriesMap(TimeSeriesMap):
10-
def __init__(self, spec):
11-
super().__init__(spec)
1210

1311
@TimeSeriesMap.constructor_arg('bands')
1412
def bands(self, builder, manager):
@@ -23,9 +21,6 @@ def bands(self, builder, manager):
2321
@register_map(Units)
2422
class UnitsMap(DynamicTableMap):
2523

26-
def __init__(self, spec):
27-
super().__init__(spec)
28-
2924
@DynamicTableMap.constructor_arg('resolution')
3025
def resolution_carg(self, builder, manager):
3126
if 'spike_times' in builder:

units.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
from datetime import datetime
2+
from uuid import uuid4
3+
4+
import numpy as np
5+
from dateutil import tz
6+
7+
from pynwb import NWBHDF5IO, NWBFile, TimeSeries
8+
9+
10+
nwbfile = NWBFile(
11+
session_description="Mouse exploring an open field", # required
12+
identifier=str(uuid4()), # required
13+
session_start_time=datetime(2018, 4, 25, 2, 30, 3, tzinfo=tz.gettz("US/Pacific")), # required
14+
experimenter=[
15+
"Baggins, Bilbo",
16+
], # optional
17+
)
18+
19+
waveforms_list = [
20+
np.array([ # unit 1
21+
[ # electrode 1
22+
[1, 2, 3, 4, 5], # spike time 1 [sample 1, sample 2, ...]
23+
[2, 3, 4, 5, 6], # spike time 2
24+
],
25+
[ # electrode 2
26+
[3, 4, 5, 6, 7], # spike time 1 [sample 1, sample 2, ...]
27+
[2, 3, 4, 5, 6], # spike time 2
28+
],
29+
]),
30+
np.array([ # unit 2
31+
[ # electrode 1
32+
[10, 20, 30, 40, 50], # spike time 1 [sample 1, sample 2, ...]
33+
],
34+
[ # electrode 2
35+
[100, 200, 300, 400, 500], # spike time 1 [sample 1, sample 2, ...]
36+
],
37+
]),
38+
]
39+
# mean and sd across spike times
40+
waveform_mean_list = [np.mean(i, axis=1) for i in waveforms_list]
41+
waveform_sd_list = [np.std(i, axis=1) for i in waveforms_list]
42+
43+
electrodes_list = [[1, 2], [3]]
44+
for unit_id in range(2):
45+
nwbfile.add_unit(
46+
id=unit_id,
47+
electrodes=electrodes_list[unit_id],
48+
waveforms=waveforms_list[unit_id],
49+
waveform_mean=waveform_mean_list[unit_id], # does not support different number of electrodes
50+
waveform_sd=waveform_sd_list[unit_id], # does not support different number of electrodes
51+
)
52+
53+
breakpoint()
54+
55+
with NWBHDF5IO("temp.nwb", "w") as io:
56+
io.write(nwbfile)

0 commit comments

Comments
 (0)