( was https://facets.kip.uni-heidelberg.de/private/wiki/index.php/NeuroTools )

NeuroTools is a set of tools written in python to manage, store and analyze your simulations. It works along with [PyNN] but does not depend on it. These tools were produced mainly by Thierry Brizzi for WP8. They are used so far in WP9T2.

source:trunk/examples/earth.jpg

Getting started with HDF5 in NeuroTools

Requirements

Download

You can get it from the neuralensemble Subversion repository:

svn co https://neuralensemble.kip.uni-heidelberg.de/svn/NeuroTools/trunk NeuroTools

using the standard FACETS username/password.

Install

Place NeuroTools into the search path for python.

Test

#A Little HowTo :

#First import all functions of the extension module
from NeuroTools.FileExtension import *
from numpy import array
#Then open an hdf5 file in write mode
url="file:///tmp/file.h5"
file = openHDF5File(url, "w", title = "test file")
#Generate the file structure and nodes attributes

template = {'Node1':{ 'title' : 'testnode', 
                         'test1':1.0, 
                         't2':'string', 
                         'tuple':(1.0,2.0,4.0), 
                         'list':array([[0,0,0,1], [0,1,2,3], [1,2,3,4]]),
                         'sfa_parameters':{'Theta':-57.0,
                                           'Vreset': -70.0,
                                           'TauR': 0.5,
                                           'gL':28.95,
                                           'C':289.5,
                                           'V_reversal_E': 0.0,
                                           'V_reversal_I': -75.0,
                                           'TauSyn_E': 1.5, 
                                           'TauSyn_I': 10.0, 
                                           'V_reversal_sfa': -70.0,
                                           'q_sfa': 14.48, 
                                           'Tau_sfa': 110.0,
                                           'V_reversal_relref': -70.0, 
                                           'q_relref': 3214.0,  
                                           'Tau_relref': 1.97, 
                                           'python': True
                                          }
                         },
                'Node2' : {'a' : 2.0, 
                           'b' : 3.0 
                           }
              }
   

# create a the structure under the Root node
file.setStructure(template, directory = "/")

# it's possible to see the file structure
file.__str__()
file.__repr__()

#Or just choose the node that you want to see attributes
attrs = file.getAttributes("/Node1")
print attrs

#Now declare into the hierarchy a SpikeList instance and make store spikes respecting poisson law
spikelist = file.createSpikeList("/Node3", "PoissonSpikeList", title = "An example of poisson spikelist generation", dt = 0.2, spec = 'reltime_id', createparents = True)
spikelist.shuffle(N = 100, k = 3)
print spikelist.read(flavor = "numpy")
                

ToDo?

  • remove dependencies (e.g. gsl, pygsl)
  • test units

Beyond PyTables?, HDF5 and MatLab? users

PyTables? is not the only easy way to store scientific data in HDF5 format. MatLab? has got its own functions resumed here. Even if PyTables? warns, it's possible to read data coming from MatLab? like a simple Array. All format used in PyTables? and the extension like VLArray or Images, are not compatible with MatLab?. The only secure way to share data beetween these two software is to store data in Arrays.