-
Notifications
You must be signed in to change notification settings - Fork 271
Expand file tree
/
Copy pathneuralynxio.py
More file actions
83 lines (73 loc) · 2.67 KB
/
neuralynxio.py
File metadata and controls
83 lines (73 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
"""
Class for reading data from Neuralynx files.
This IO supports NCS, NEV and NSE file formats.
Depends on: numpy
Supported: Read
Author: Julia Sprenger, Carlos Canova
"""
from neo.io.basefromrawio import BaseFromRaw
from neo.rawio.neuralynxrawio.neuralynxrawio import NeuralynxRawIO
class NeuralynxIO(NeuralynxRawIO, BaseFromRaw):
"""
Class for reading data from Neuralynx files.
This IO supports NCS, NEV, NSE, NTT and NVT file formats.
NCS contains signals for one channel
NEV contains events
NSE contains spikes and waveforms for mono electrodes
NTT contains spikes and waveforms for tetrodes
NVT contains coordinates and head angles for video tracking
"""
_prefered_signal_group_mode = "group-by-same-units"
mode = "dir"
def __init__(
self,
dirname="",
filename="",
use_cache=False,
cache_path="same_as_resource",
exclude_filename=None,
keep_original_times=False,
ignore_nvt=False,
):
"""
Initialise IO instance
Parameters
----------
dirname : str
Directory containing data files
filename : str
Name of a single ncs, nse, nev, or ntt file to include in dataset. Will be ignored,
if dirname is provided.
use_cache : bool, optional
Cache results of initial file scans for faster loading in subsequent runs.
Default: False
cache_path : str, optional
Folder path to use for cache files.
Default: 'same_as_resource'
exclude_filename: str or list
Filename or list of filenames to be excluded. Expects base filenames without
directory path.
keep_original_times : bool
Preserve original time stamps as in data files. By default datasets are
shifted to begin at t_start = 0*pq.second.
Default: False
ignore_nvt : bool
Ignore NVT files when loading data. This is only a temporary argument before
support for multiple NVT files are added. Turn it on if there are multiple NVT
files in the directory.
Default: False
"""
NeuralynxRawIO.__init__(
self,
dirname=dirname,
filename=filename,
use_cache=use_cache,
cache_path=cache_path,
exclude_filename=exclude_filename,
keep_original_times=keep_original_times,
ignore_nvt=ignore_nvt,
)
if self.rawmode == "one-file":
BaseFromRaw.__init__(self, filename)
elif self.rawmode == "one-dir":
BaseFromRaw.__init__(self, dirname)