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

Example code does not create required dataset in TimeSeries #35

Closed
ajtritt opened this issue Jun 22, 2017 · 1 comment
Closed

Example code does not create required dataset in TimeSeries #35

ajtritt opened this issue Jun 22, 2017 · 1 comment
Labels
category: bug errors in the code or code behavior priority: high impacts proper operation or use of feature important to most users

Comments

@ajtritt
Copy link
Member

ajtritt commented Jun 22, 2017

Originally reported by: jeffteeters (Bitbucket: jeffteeters, GitHub: jeffteeters)


I tried implementing the example code on this page:
http://pynwb.readthedocs.io/en/latest/example.html#creating-and-writing-nwb-files
(under section “Write an NWBFile”) to create a TimeSeries.
This generates a TimeSeries that does not include “num_samples”, which is a required dataset. The sample code is below. The example would not run as written, so perhaps the code in the documentation needs to be updated. To allow it to run, I had to add several import statements (has comment "ADDED"). I also tried adding a specification of num_samples in the call to create the TimeSeries. Both with and without the addition of the argument (num_samples), the API failed to create num_samples dataset. There was no error or warning displayed that the required dataset “num_samples” was missing.

#!python

from pynwb import NWBFile, get_build_manager
from form.backends.hdf5 import HDF5IO
from datetime import datetime  # ADDED
from pynwb import base   # ADDED
 
# make an NWBFile
start_time = datetime(1970, 1, 1, 12, 0, 0)
create_date = datetime(2017, 4, 15, 12, 0, 0)
nwbfile = NWBFile('test.nwb', 'a test NWB File', 'TEST123', start_time, file_create_date=create_date)
ts = **base.**TimeSeries('test_timeseries', 'example_source', list(range(100,200,10)), 'SIunit', timestamps=list(range(10)), resolution=0.1, num_samples=3) # ADDED num_samples
nwbfile.add_raw_timeseries(ts)
 
manager = get_build_manager()
path = "test_pynwb_io_hdf5.h5"
 
io = HDF5IO(path, manager)
io.write(nwbfile)
io.close()

@ajtritt
Copy link
Member Author

ajtritt commented Jun 28, 2017

Original comment by Andrew Tritt (Bitbucket: ajtritt, GitHub: ajtritt):


Merged in issue_34 (pull request #67)

fixing issue #34 and issue #35

@ajtritt ajtritt added priority: high impacts proper operation or use of feature important to most users category: bug errors in the code or code behavior labels Aug 3, 2017
@ajtritt ajtritt closed this as completed Aug 3, 2017
ajtritt added a commit that referenced this issue Aug 9, 2017
ajtritt added a commit that referenced this issue Aug 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: bug errors in the code or code behavior priority: high impacts proper operation or use of feature important to most users
Projects
None yet
Development

No branches or pull requests

1 participant