Closed ajtritt closed 7 years ago
Original comment by Loren Frank (Bitbucket: lmfrnk, GitHub: Unknown):
Perfect.
thanks,
Loren M. Frank
Professor
Howard Hughes Medical Institute
Kavli Institute for Fundamental Neuroscience
Department of Physiology
University of California, San Francisco
Office Phone: 415-502-7357
Original comment by Loren Frank (Bitbucket: lmfrnk, GitHub: Unknown):
But ... the following fails:
#!python
s_tmp = SpikeEventSeries('cluster',
'source',
cluster_waveforms,
(int(day), int(tet_num)),
timestamps = np.asarray(spiketimes),
description = '%sspikes day %d tetrode %d cell %d data' % (prefix, day, tet_num, cell_num))
with an error
Traceback (most recent call last):
File "/Users/loren/Src/NWB/franklabnwb/convert_nspike.py", line 464, in
And for reference,
In[2]: type(cluster_waveforms)
Out[2]: numpy.ndarray
Original comment by Loren Frank (Bitbucket: lmfrnk, GitHub: Unknown):
I figured out that it needed to be a Device, but now I get:
Traceback (most recent call last):
File "/Users/loren/Src/NWB/franklab/convert_nspike.py", line 356, in
when I try to create the electrodegroup after creating a device.
Loren
-- Loren M. Frank
Professor
Howard Hughes Medical Institute
Kavli Institute for Fundamental Neuroscience
Department of Physiology
University of California, San Francisco
Office Phone: 415-502-7357
Original comment by Loren Frank (Bitbucket: lmfrnk, GitHub: Unknown):
Got it. One last bug:
TypeError: incorrect type for 'device' (got 'str', expected 'Device')
Loren M. Frank
Professor
Howard Hughes Medical Institute
Kavli Institute for Fundamental Neuroscience
Department of Physiology
University of California, San Francisco
Office Phone: 415-502-7357
Original comment by Loren Frank (Bitbucket: lmfrnk, GitHub: Unknown):
Unfortunately I still get an error message, although I've checked the order of the calls carefully. The error is
raceback (most recent call last):
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevd.py", line 1578, in
And here is a snippet of the code that is run:
#!python
tetinfo_file = "%s/%s%s" % (args.data_dir, prefix, tetinfo_file)
recording_device = "NSpike acquisition system"
channel_filtering = [np.nan, np.nan, np.nan, np.nan]
channel_impedance = [np.nan, np.nan, np.nan, np.nan]
electrode_group = dict()
mat = loadmat2(tetinfo_file)
#NOTE: day is 0 based, as is cell; only tetrode number has it's original numbering scheme
for day, day_struct in enumerate(mat.get('tetinfo')[0]):
if len(day_struct[0]):
electrode_group[day] = dict()
# kenny's data has a day epoch tetrode structure but duplicates the info across epochs, so we can use the first
# epoc for everything
for tet_ind, tet_struct in enumerate(day_struct[0][0][0]):
# go through the list of fields
hemi = '?'
coord = [np.nan, np.nan, np.nan]
location = '?'
sub_area = '?'
if len(tet_struct[0]):
tet = tet_struct[0][0]
field_names = tet._fieldnames
for field in tet._fieldnames:
if field == 'area':
area = tet.area[0]
if field == 'subarea' and len(tet.subarea):
sub_area = tet.subarea[0]
elif field == 'depth':
coord = [np.nan, np.nan, tet.depth[0][0][0][0] / 12 / 80 * 25.4] #convert to mm
elif field == 'hemisphere':
hemisphere = tet.hemisphere[0]
location = area + ' ' + sub_area
channel_location = [location, location, location, location]
channel_coordinates = [coord, coord, coord, coord]
name = "%02d-%02d" % (day, tet_ind + 1)
description = "tetrode {tet_num} located in {hemi} hemisphere on day {day}".format(tet_num=tet_ind+1, hemi=hemisphere, day=day)
channel_description = [description, description, description, description]
electrode_group[day][tet_ind+1] = nwbf.create_electrode_group(name,
channel_description,
channel_location,
channel_filtering,
channel_coordinates,
channel_impedance,
description,
location,
recording_device)
Original comment by Andrew Tritt (Bitbucket: ajtritt, GitHub: ajtritt):
Loren,
The ElectrodeGroup has changed in accordance with changes we had to make to the spec.
http://pynwb.readthedocs.io/en/latest/pynwb.ecephys.html#pynwb.ecephys.ElectrodeGroup
We had to modify the Electrode Group spec to make it more flexible with respect to channels, so you will need to specify data for each channel. This structure will make some unnecessary redundancy for tetrodes, but it was decided on in the interest of making it easier for storing information about more complex devices, like probes and arrays.
Andrew
Original comment by Andrew Tritt (Bitbucket: ajtritt, GitHub: ajtritt):
Hi Loren,
Please pull from dev to get the latest changes, and see the most recent documentation for IntervalSeries. Things should work as they used to, but please make sure your calls are in accordance with the current state of the API docs.
http://pynwb.readthedocs.io/en/latest/pynwb.misc.html#pynwb.misc.IntervalSeries
Andrew
Originally reported by: Loren Frank (Bitbucket: lmfrnk, GitHub: Unknown)
The call to create an interval series now requires a data element, but the documentation only specifies a name and a source.
In addition, with a data element specified, I now get the following error:
TypeError: either 'timestamps' or 'starting_time' and 'rate' must be specified.
I'm also getting similar errors when I execute nwbf.create_electrode_group(name, coord, desc, recording_device, area, 1.0):
File "/Users/loren/Src/NWB/franklab/convert_nspike.py", line 342, in
electrode_group[day][tet_ind+1] = nwbf.create_electrode_group(name, coord, desc, recording_device, area, 1.0)
File "/Users/loren/anaconda/lib/python3.5/site-packages/pynwb-0.0.1-py3.5.egg/form/utils.py", line 215, in func_call
File "/Users/loren/anaconda/lib/python3.5/site-packages/pynwb-0.0.1-py3.5.egg/pynwb/file.py", line 260, in create_electrode_group
File "/Users/loren/anaconda/lib/python3.5/site-packages/pynwb-0.0.1-py3.5.egg/form/utils.py", line 214, in func_call
TypeError: missing argument 'channel_impedance', missing argument 'description', missing argument 'location', missing argument 'device'