Skip to content
This repository was archived by the owner on Jun 6, 2023. It is now read-only.

Commit c19272c

Browse files
authored
Merge pull request #435 from SpikeInterface/update_tests
Update tests
2 parents 9ac1e1e + a407b60 commit c19272c

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ services:
66
python:
77
- '3.6'
88
install:
9-
# - pip install shybrid
10-
- pip install mountainlab_pytools pynwb==1.3.3 pyopenephys kbucket h5py MEArec==1.4.1 exdir ruamel.yaml nixio neo>=0.8 hdf5storage bs4 lxml
9+
- pip install mountainlab_pytools pynwb==1.3.3 pyopenephys kbucket h5py MEArec shybrid exdir ruamel.yaml nixio neo>=0.8 hdf5storage bs4 lxml
1110
- pip install .
1211
- pip install pytest==3.6
1312
script: pytest

spikeextractors/extractors/nwbextractors/nwbextractors.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,11 @@ def add_epochs(recording, nwbfile):
499499
return nwbfile
500500

501501
@staticmethod
502-
def add_all_to_nwbfile(recording: se.RecordingExtractor, nwbfile: NWBFile,
502+
def add_all_to_nwbfile(recording: se.RecordingExtractor, nwbfile,
503503
metadata: dict = None):
504+
505+
assert isinstance(nwbfile, NWBFile), "'nwbfile' should be of type pynwb.NWBFile"
506+
504507
# Add devices
505508
nwbfile = se.NwbRecordingExtractor.add_devices(
506509
recording=recording,
@@ -537,7 +540,7 @@ def add_all_to_nwbfile(recording: se.RecordingExtractor, nwbfile: NWBFile,
537540

538541
@staticmethod
539542
def write_recording(recording: se.RecordingExtractor, save_path: PathType = None,
540-
nwbfile: NWBFile = None, metadata: dict = None):
543+
nwbfile=None, metadata: dict = None):
541544
'''
542545
Parameters
543546
----------
@@ -559,6 +562,9 @@ def write_recording(recording: se.RecordingExtractor, save_path: PathType = None
559562
'''
560563
assert HAVE_NWB, NwbRecordingExtractor.installation_mesg
561564

565+
if nwbfile is not None:
566+
assert isinstance(nwbfile, NWBFile), "'nwbfile' should be of type pynwb.NWBFile"
567+
562568
assert distutils.version.LooseVersion(pynwb.__version__) >= '1.3.3', \
563569
"'write_recording' not supported for version < 1.3.3. Run pip install --upgrade pynwb"
564570

@@ -720,7 +726,7 @@ def frame_to_time(self, frame):
720726
return frame / self.get_sampling_frequency()
721727

722728
@staticmethod
723-
def write_units(sorting: se.SortingExtractor, nwbfile: NWBFile,
729+
def write_units(sorting: se.SortingExtractor, nwbfile,
724730
property_descriptions: dict):
725731
'''
726732
Helper function for write_sorting.
@@ -829,7 +835,7 @@ def write_units(sorting: se.SortingExtractor, nwbfile: NWBFile,
829835

830836
@staticmethod
831837
def write_sorting(sorting: se.SortingExtractor, save_path: PathType = None,
832-
nwbfile: NWBFile = None, property_descriptions: dict = None,
838+
nwbfile=None, property_descriptions: dict = None,
833839
**nbwbfile_kwargs):
834840
'''
835841
Parameters
@@ -881,5 +887,6 @@ def write_sorting(sorting: se.SortingExtractor, save_path: PathType = None,
881887

882888
io.write(nwbfile)
883889
else:
890+
assert isinstance(nwbfile, NWBFile), "'nwbfile' should be of type pynwb.NWBFile"
884891
se.NwbSortingExtractor.write_units(sorting, nwbfile,
885892
property_descriptions)

0 commit comments

Comments
 (0)