pynapple.io.misc#

Various io functions

Functions

append_NWB_LFP(path, lfp[, channel])

Standalone function for adding lfp/eeg to already existing nwb files.

load_eeg(filepath[, channel, n_channels, ...])

Standalone function to load eeg/lfp/dat file in binary format.

load_file(path[, lazy_loading])

Load file.

load_folder(path)

Load folder containing files or other folder.

load_session(path[, session_type])

% WARNING : THIS FUNCTION IS DEPRECATED % General Loader for

pynapple.io.misc.append_NWB_LFP(path, lfp, channel=None)[source]#

Standalone function for adding lfp/eeg to already existing nwb files.

Parameters:
  • path (str) – The path to the data. The function will looks for a nwb file in path or in path/pynapplenwb.

  • lfp (Tsd or TsdFrame) – Description

  • channel (None, optional) – channel number in int ff lfp is a Tsd

Raises:

RuntimeError – If can’t find the nwb file If no channel is specify when passing a Tsd

pynapple.io.misc.load_eeg(filepath, channel=None, n_channels=None, frequency=None, precision='int16', bytes_size=2)[source]#

Standalone function to load eeg/lfp/dat file in binary format.

Parameters:
  • filepath (str) – The path to the eeg file

  • channel (int or list of int, optional) – The channel(s) to load. If None return a memory map of the dat file to avoid memory error

  • n_channels (int, optional) – Number of channels

  • frequency (float, optional) – Sampling rate of the file

  • precision (str, optional) – The precision of the binary file

  • bytes_size (int, optional) – Bytes size of the binary file

Raises:

RuntimeError – If can’t find the lfp/eeg/dat file

Returns:

  • 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

pynapple.io.misc.load_file(path, lazy_loading=None)[source]#

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:
  • path (str) – Path to the file

  • 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.

Returns:

One of the 5 pynapple objects or pynapple.io.NWBFile

Return type:

(Tsd, TsdFrame, Ts, IntervalSet, TsGroup, pynapple.io.NWBFile)

Raises:

FileNotFoundError – If file is missing

pynapple.io.misc.load_folder(path)[source]#

Load folder containing files or other folder. Pynapple will walk throught the subfolders to detect compatible npz files or nwb files.

Parameters:

path (str) – Path to the folder

Returns:

A dictionary-like class containing all the sub-folders and compatible files (i.e. npz, nwb)

Return type:

Folder

Raises:

RuntimeError – If folder is missing

pynapple.io.misc.load_session(path, session_type=None)[source]#

% WARNING : THIS FUNCTION IS DEPRECATED %#

General Loader for

  • Neurosuite

  • Phy

  • Minian

  • Inscopix-cnmfe

  • Matlab-cnmfe

  • Suite2p

  • None for default session.

param path:

The path to load the data

type path:

str, optional

param session_type:

Can be ‘neurosuite’, ‘phy’, ‘minian’, ‘inscopix-cnmfe’, ‘cnmfe-matlab’, ‘suite2p’ or None for default loader.

type session_type:

str, optional

returns:

A class holding all the data from the session.

rtype:

Session