Misc
pynapple.io.misc
Various io functions
load_file
Load file. Current format supported is (npz,nwb,)
.npz -> If the file is compatible with a pynapple format, the function will return a pynapple object. Otherwise, the function will return the output of numpy.load
.nwb -> Return the pynapple.io.NWBFile class wrapping the NWBFile
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
Path to the file |
required |
lazy_loading |
bool, optional default True
|
Lazy loading of the data. If not specified, the function will use the defaults True. Works only with NWB files. |
None
|
Returns:
Type | Description |
---|---|
(Tsd, TsdFrame, Ts, IntervalSet, TsGroup, NWBFile)
|
One of the 5 pynapple objects or pynapple.io.NWBFile |
Raises:
Type | Description |
---|---|
FileNotFoundError
|
If file is missing |
Source code in pynapple/io/misc.py
load_folder
Load folder containing files or other folder. Pynapple will walk throught the subfolders to detect compatible npz files or nwb files.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
Path to the folder |
required |
Returns:
Type | Description |
---|---|
Folder
|
A dictionary-like class containing all the sub-folders and compatible files (i.e. npz, nwb) |
Raises:
Type | Description |
---|---|
RuntimeError
|
If folder is missing |
Source code in pynapple/io/misc.py
load_session
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % WARNING : THIS FUNCTION IS DEPRECATED % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% General Loader for
-
Neurosuite
-
Phy
-
Minian
-
Inscopix-cnmfe
-
Matlab-cnmfe
-
Suite2p
- None for default session.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
The path to load the data |
required |
session_type |
str
|
Can be 'neurosuite', 'phy', 'minian', 'inscopix-cnmfe', 'cnmfe-matlab', 'suite2p' or None for default loader. |
None
|
Returns:
Type | Description |
---|---|
Session
|
A class holding all the data from the session. |
Source code in pynapple/io/misc.py
load_eeg
load_eeg(
filepath,
channel=None,
n_channels=None,
frequency=None,
precision="int16",
bytes_size=2,
)
Standalone function to load eeg/lfp/dat file in binary format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filepath |
str
|
The path to the eeg file |
required |
channel |
int or list of int
|
The channel(s) to load. If None return a memory map of the dat file to avoid memory error |
None
|
n_channels |
int
|
Number of channels |
None
|
frequency |
float
|
Sampling rate of the file |
None
|
precision |
str
|
The precision of the binary file |
'int16'
|
bytes_size |
int
|
Bytes size of the binary file |
2
|
Raises:
Type | Description |
---|---|
RuntimeError
|
If can't find the lfp/eeg/dat file |
Returns:
Type | Description |
---|---|
Tsd or TsdFrame
|
The lfp in a time series format |
Deleted Parameters
extension : str, optional The file extenstion (.eeg, .dat, .lfp). Make sure the frequency match
Source code in pynapple/io/misc.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
|
append_NWB_LFP
Standalone function for adding lfp/eeg to already existing nwb files.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
The path to the data. The function will looks for a nwb file in path or in path/pynapplenwb. |
required |
lfp |
Tsd or TsdFrame
|
Description |
required |
channel |
None
|
channel number in int ff lfp is a Tsd |
None
|
Raises:
Type | Description |
---|---|
RuntimeError
|
If can't find the nwb file If no channel is specify when passing a Tsd |