Skip to content

Commit

Permalink
add nsp sub-module
Browse files Browse the repository at this point in the history
  • Loading branch information
TomDonoghue committed May 26, 2024
1 parent 2da0020 commit adc9e45
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 5 deletions.
5 changes: 2 additions & 3 deletions convnwb/io/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import yaml

#from convnwb.objects import Task, Bundle, Electrodes
from convnwb.io.utils import get_files, check_ext, check_folder, make_session_name
from convnwb.modutils.dependencies import safe_import, check_dependency

Expand All @@ -31,7 +30,7 @@ def save_nwbfile(nwbfile, file_name, folder=None):
file_name : str or dict
The file name to load.
If dict, is passed into `make_session_name` to create the file name.
folder : str
folder : str or Path, optional
The folder to load the file from.
"""

Expand All @@ -51,7 +50,7 @@ def load_nwbfile(file_name, folder=None, return_io=False):
file_name : str or dict
The file name to load.
If dict, is passed into `make_session_name` to create the file name.
folder : str
folder : str or Path, optional
The folder to load the file from.
return_io : bool, optional, default: False
Whether to return the pynwb IO object.
Expand Down
Empty file added convnwb/nsp/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion convnwb/io/check.py → convnwb/nsp/check.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""I/O related check functions - check file properties."""
"""NSP related check functions - check file properties."""

from convnwb.timestamps.utils import convert_samples_to_time

Expand Down
35 changes: 35 additions & 0 deletions convnwb/nsp/io.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""NSP related I/O functions."""

from convnwb.io.utils import check_folder

neo = safe_import('neo')

###################################################################################################
###################################################################################################

@check_dependency(neo, 'neo')
def load_blackrock(file_name, folder, nsx_to_load=None, load_nev=None):
"""Load a set of Blackrock files.
Parameters
----------
file_name : str
The file name to load.
folder : str or Path
The folder to load the file(s) from.
nsx_to_load : int or list, optional
Which nsx file(s) to load.
load_nev : bool, optional, default: True
Whether to load the nev file.
Returns
-------
reader : neo.rawio.blackrockrawio.BlackrockRawIO
Blackrock file reader.
"""

reader = neo.rawio.BlackrockRawIO(\
check_folder(file_name, folder), nsx_to_load=nsx_to_load, load_nev=load_nev)
reader.parse_header()

return reader
3 changes: 2 additions & 1 deletion optional-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ scikit-learn
pandas
scipy
h5py
mat73
mat73
neo

0 comments on commit adc9e45

Please sign in to comment.