io
Data
DEFAULT_BUFFER_SIZE = 10000
__name__ = NeuroTools.io
Functions
check_dependency(name)
Classes
DataHandler
Class to establish the interface for loading/saving objects in NeuroTools
Inputs: filename - the user file for reading/writing data. By default, if this is string, a StandardTextFile is created object - the object to be saved. Could be a SpikeList or an AnalogSignalList
Examples:
txtfile = StandardTextFile("results.dat") DataHandler(txtfile) picklefile = StandardPickelFile("results.dat") DataHandler(picklefile)
__init__(self, user_file, object=None)
load_analogs(self, type, **params)
Read an AnalogSignalList object from a file and return the AnalogSignalList object of type type, created from the File and from the additional params that may have been provided
type can be in ["vm", "current", "conductance"]
Examples:
params = {'id_list' : range(100), 't_stop' : 1000} handler.load_analogs("vm", params)
VmList Object (with params taken into account)
handler.load_analogs("current", params)
CurrentList Object (with params taken into account)
See also AnalogSignalList, load_spikes
load_spikes(self, **params)
Function to load a SpikeList object from a file. The data type is automatically infered. Return a SpikeList object
Inputs: params - a dictionnary with all the parameters used by the SpikeList constructor
Examples:
params = {'id_list' : range(100), 't_stop' : 1000} handler.load_spikes(params)
SpikeList object
See also SpikeList, load_analogs
save(self)
Save the object defined in self.object with the method os self.user_file
Note that you can add your own format for I/O of such NeuroTools objects
FileHandler
Class to handle all the file read/write methods for the key objects of the signals class, i.e SpikeList and AnalogSignalList. Could be extented
This is an abstract class that will be implemented for each format (txt, pickle, hdf5) The key methods of the class are: write(object) - Write an object to a file read_spikes(params) - Read a SpikeList file with some params read_analogs(type, params) - Read an AnalogSignalList of type type with some params
Inputs: filename - the file name for reading/writing data
If you want to implement your own file format, you just have to create an object that will inherit from this FileHandler class and implement the previous functions. See io.py for more details
__init__(self, filename)
read_analogs(self, type, params)
Read an AnalogSignalList object from a file and return the AnalogSignalList object of type type, created from the File and from the additional params that may have been provided
type can be in ["vm", "current", "conductance"]
Examples:
params = {'id_list' : range(100), 't_stop' : 1000} handler.read_analogs("vm", params)
VmList Object (with params taken into account)
handler.read_analogs("current", params)
CurrentList Object (with params taken into account)
read_spikes(self, params)
Read a SpikeList object from a file and return the SpikeList object, created from the File and from the additional params that may have been provided
Examples:
params = {'id_list' : range(100), 't_stop' : 1000} handler.read_spikes(params)
SpikeList Object (with params taken into account)
write(self, object)
Write the object to the file.
Examples:
handler.write(SpikeListObject) handler.write(VmListObject)
StandardPickleFile
__init__(self, filename)
read_analogs(self, type, params)
read_spikes(self, params)
write(self, object)
StandardTextFile
__init__(self, filename)
get_data(self, sepchar='\t', skipchar='#')
Load data from a text file and returns a list of data
