Auryn simulator

Simulator for spiking neural networks with synaptic plasticity

User Tools

Site Tools


manual:python_binary_toolkit

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
manual:python_binary_toolkit [2016/08/10 18:14] – created zenkemanual:python_binary_toolkit [2016/08/30 18:19] – [Auryn Python binary tools] zenke
Line 1: Line 1:
-====== Auryn Python toolkit ======+====== Auryn Python binary tools ======
  
 Auryn v0.8.0 is the first version to come with a set of Python tools which allow decoding from binary files generated with [[BinarySpikeMonitor]] or [[BinaryStateMonitor]]. You can find the Python code in the ''tools/python'' directory. Auryn v0.8.0 is the first version to come with a set of Python tools which allow decoding from binary files generated with [[BinarySpikeMonitor]] or [[BinaryStateMonitor]]. You can find the Python code in the ''tools/python'' directory.
  
 +To use the Auryn tools point your Python path to the ''auryn/tools/python'' directory. For instance by
 +<code>
 +export PYTHONPATH=$PYTHONPATH:<path_to_auryn_src_directory>/tools/python
 +</code>
  
 ===== Example: Plot spikes from spk file ===== ===== Example: Plot spikes from spk file =====
Line 12: Line 16:
 import numpy as np import numpy as np
 import pylab as pl import pylab as pl
-from auryn_binary_tools import *+from auryntools import *
  
 filename  =  "/tmp/coba.0.e.spk" filename  =  "/tmp/coba.0.e.spk"
Line 38: Line 42:
 import numpy as np import numpy as np
 import pylab as pl import pylab as pl
-from auryn_binary_tools import *+from auryntools import *
  
 num_mpi_ranks = 4 num_mpi_ranks = 4
Line 67: Line 71:
 import numpy as np import numpy as np
 import pylab as pl import pylab as pl
-from auryn_binary_tools import *+from auryntools import *
  
 datadir = "/home/zenke/data/sim" # Set this to your local data path datadir = "/home/zenke/data/sim" # Set this to your local data path
Line 99: Line 103:
 {{ :manual:python_receptive_fields.png?500 |}} {{ :manual:python_receptive_fields.png?500 |}}
 as you can see the neuron here is torn between being selective to a square and a triangle. as you can see the neuron here is torn between being selective to a square and a triangle.
 +
 +
 +===== Example: Get membrane potential from BinaryStateMonitor file =====
 +
 +Finally, here is an example of howto read binary state monitor files:
 +
 +<code python>
 +import numpy as np
 +import pylab as pl
 +from auryntools import *
 +
 +# This code snipped assumes that you have run the example simulation
 +# sim_epsp_binmon with default parameters and adjusted the below 
 +# filename to its output.
 +
 +filename  =  "../../build/release/examples/out_epsp.0.bmem"
 +t_from=0.2
 +t_to  =2.5
 +
 +sf = AurynBinaryStateFile(filename)
 +mem = np.array(sf.get_data(t_from, t_to))
 +
 +pl.plot(mem[:,0], mem[:,1])
 +pl.xlabel("Time [s]")
 +pl.ylabel("Membrane potential [V]")
 +pl.show()
 +</code>
 +
 +{{ :manual:python_membrane.png?500 |}}
manual/python_binary_toolkit.txt · Last modified: 2016/08/30 18:21 by zenke