Cypress
1.0
C++ Spiking Neural Network Simulation Framework
|
#include <pynn.hpp>
Classes | |
class | PyNNSimulatorNotFound |
Public Member Functions | |
PyNN (const std::string &simulator, const Json &setup=Json()) | |
~PyNN () override | |
Real | timestep () |
std::unordered_set< const NeuronType * > | supported_neuron_types () const override |
std::string | name () const override |
const std::string & | simulator () const |
const std::string & | normalised_simulator () const |
const std::vector< std::string > & | imports () const |
std::string | nmpi_platform () const |
Json | setup () const |
void | run (NetworkBase &network, Real duration=0.0) const |
Static Public Member Functions | |
static std::vector< std::string > | simulators () |
static std::string | get_import (const std::vector< std::string > &imports, const std::string &simulator) |
static int | get_pynn_version () |
static int | get_neo_version () |
static py::dict | json_to_dict (Json json) |
static std::string | get_neuron_class (const NeuronType &neuron_type) |
static void | init_logger () |
static py::object | create_source_population (const PopulationBase &pop, py::module &pynn) |
static py::object | create_homogeneous_pop (const PopulationBase &pop, py::module &pynn, bool &init_available) |
static void | set_inhomogeneous_parameters (const PopulationBase &pop, py::object &pypop, bool init_available=false) |
static void | set_homogeneous_rec (const PopulationBase &pop, py::object &pypop) |
static void | set_inhomogenous_rec (const PopulationBase &pop, py::object &pypop, py::module &pynn) |
static py::object | get_pop_view (const py::module &pynn, const py::object &py_pop, const PopulationBase &c_pop, const size_t &start, const size_t &end) |
static py::object | get_connector7 (const ConnectionDescriptor &conn, const py::module &pynn) |
static py::object | get_connector (const std::string &connector_name, const py::module &pynn, const Real &additional_parameter, const bool allow_self_connections) |
static py::object | group_connect (const std::vector< PopulationBase > &populations, const std::vector< py::object > &pypopulations, const ConnectionDescriptor &conn, const py::module &pynn, const bool nest_flag, const Real timestep=0.0) |
static py::object | group_connect (const std::vector< PopulationBase > &populations, const std::vector< py::object > &pypopulations, const ConnectionDescriptor &conn, const py::module &pynn, const Real nest_flag)=delete |
static py::object | group_connect7 (const std::vector< PopulationBase > &populations, const std::vector< py::object > &pypopulations, const ConnectionDescriptor &conn, const py::module &pynn) |
static std::tuple< py::object, py::object > | list_connect (const std::vector< py::object > &pypopulations, const ConnectionDescriptor conn, const py::module &pynn, const bool current_based, const Real timestep=0.0) |
static std::tuple< py::object, py::object > | list_connect (const std::vector< py::object > &pypopulations, const ConnectionDescriptor conn, const py::module &pynn, const Real current_based)=delete |
static std::tuple< py::object, py::object > | list_connect7 (const std::vector< py::object > &pypopulations, const ConnectionDescriptor conn, const py::module &pynn) |
template<typename T > | |
static Matrix< T > | matrix_from_numpy (const py::object &object, bool transposed=false) |
static void | fetch_data_nest (const std::vector< PopulationBase > &populations, const std::vector< py::object > &pypopulations) |
static void | fetch_data_spinnaker (const std::vector< PopulationBase > &populations, const std::vector< py::object > &pypopulations) |
static void | fetch_data_neo (const std::vector< PopulationBase > &populations, const std::vector< py::object > &pypopulations) |
static void | spikey_run (NetworkBase &source, Real duration, py::module &pynn, py::dict dict) |
static py::object | spikey_create_source_population (const PopulationBase &pop, py::module &pynn) |
static py::object | spikey_create_homogeneous_pop (const PopulationBase &pop, py::module &pynn) |
static void | spikey_set_homogeneous_rec (const PopulationBase &pop, py::object &pypop, py::module &pynn) |
static void | spikey_set_inhomogeneous_rec (const PopulationBase &pop, py::object &pypop, py::module pynn) |
static void | spikey_set_inhomogeneous_parameters (const PopulationBase &pop, py::object &pypop) |
static void | spikey_get_spikes (PopulationBase pop, py::object &pypop) |
static void | spikey_get_voltage (NeuronBase neuron, py::module &pynn) |
Protected Member Functions | |
void | do_run (NetworkBase &network, Real duration) const override |
Protected Attributes | |
std::string | m_simulator |
std::string | m_normalised_simulator |
std::vector< std::string > | m_imports |
bool | m_keep_log |
Json | m_setup |
The Backend class is an abstract base class which provides the facilities for network execution.
Constructor of the PyNN backend. Throws an exception if the given PyNN backend does not exist.
simulator | is the name of the simulator backend to be used by PyNN. Use the static backends method to list available backends. |
setup | contains additional setup information that should be passed to the backend. |
|
override |
Destructor of the PyNN class.
|
static |
|
static |
|
overrideprotectedvirtual |
Abstract method which has to be implemented by the backend.
Implements cypress::Backend.
|
static |
Fetch all data (spikes, traces) from NEO. This is a general method
populations | Cypress populations |
pypopulations | PyNN populations |
|
static |
Fetch all data (spikes, traces) from nest. This is faster than using NEO.
populations | Cypress populations |
pypopulations | PyNN populations |
|
static |
Fetch all data (spikes, traces) from spiNNaker. This is faster than using NEO.
populations | Cypress populations |
pypopulations | PyNN populations |
|
static |
connector_name | name of the pyNN connector |
pynn | Reference to the pynn module |
additional_parameter | Additional parameter needed by the connector |
allow_self_connections | flag to allow self connections if source and target populations are the same |
|
static |
|
static |
Returns a string containing the import for given simulator. Throws an error is simualator could not be found
imports | list of possible/supported imports |
simulator | simulator string |
|
static |
Returns the neo version, 5 represents version 0.5.x
|
static |
Given a NeuronType, this function returns the name of the PyNN neuron_type
neuron_type | Reference to the NeuronType of the population |
|
static |
Get a handler for a part of a population
pynn | handler for the PyNN instance |
py_pop | PyNN population |
c_pop | Cypress population |
start | id of the first neuron |
end | id of the last neuron |
|
static |
Returns the PyNN version, 8 represents version 0.8.x
|
static |
Connect based on an existing PyNN connector
populations | vector of cypress populations |
pypopulations | vector of PyNN populations |
conn | Cypress connection descriptor |
pynn | Handler for PyNN module |
nest_flag | use sign of weight and ignore receptor_type for nest and current based neurons |
timestep | timestep of the simulator |
|
staticdelete |
|
static |
|
inline |
Returns the Python imports that tried to be used when starting the platform.
|
static |
Intitialize the logger, still TODO
|
static |
Converting a Json object to a py::dict. Make sure that the python interpreter is already started before calling this function
json | The json object which will be converted |
|
static |
Creates a PyNN FromList Connection
pypopulations | list of python populations |
conn | ConnectionDescriptor of the List connection |
pynn | Handler for PyNN python module |
current_based | true if target population is current_based |
timestep | Timestep of the simulator, default 0 |
|
staticdelete |
|
static |
Creates a PyNN6/7 FromList Connection
pypopulations | list of python populations |
conn | ConnectionDescriptor of the List connection |
pynn | Handler for PyNN python module |
|
static |
Given a numpy object, this method creates the (transposed) C++ matrix without creating a copy. The python dtype is checked and compared to
T. | Matrix sizes are caught in Python, because the py::buffer_info seems to be misleading in some cases. |
T | Type of the matrix |
object | handler for numpy array |
transposed | matrix dimensions are swapped (hack for NEO) |
|
inlineoverridevirtual |
Returns the canonical name of the backend.
Implements cypress::Backend.
std::string cypress::PyNN::nmpi_platform | ( | ) | const |
|
inline |
Returns the canonical simulator name.
|
inherited |
Simulates the given spiking neural network for the given duration.
network | is the network that should be simulated. The simulation result will be written to the network instance. |
duration | is the duration for which the network should be simulated. |
|
static |
Set recording for a full population
pop | Source cypress population |
pypop | Target PyNN population |
|
static |
Sets parameters of an existing population
pop | Source cypress population |
pypop | Target PyNN population |
init_available | flag for initializing the population |
|
static |
Set mixed recordings for a population
pop | Source cypress population |
pypop | Target PyNN population |
|
inline |
Return the system config
|
inline |
Returns the simulator name as provided by the user.
|
static |
Lists available PyNN simulators.
|
static |
|
static |
|
static |
Fetches spikes and saves them to pop
pop | cypress population |
pypop | PyNN population |
|
static |
Fetch membrane voltage for a neuron in Spikey
neuron | The cypress neuron recording the membrane |
pynn | pointer to PyNN module |
|
static |
Special run function for the Spikey system
source | The Network description |
duration | Simulation duration |
pynn | Module pointer to PyNN.hardware.spikey |
|
static |
Sets parameters of an existing population for spikey
pop | Source cypress population |
pypop | Target PyNN population |
init_available | flag for initializing the population |
|
static |
Set mixed recordings for a population for the Spikey system
pop | Source cypress population |
pypop | Target PyNN population |
|
static |
Set recording for a full population for spikey
pop | Source cypress population |
pypop | Target PyNN population |
|
overridevirtual |
Returns a set of neuron types which are supported by this backend. Trying to execute a network with other neurons than the ones specified in the result of this function will result in an exception.
Implements cypress::Backend.
Real cypress::PyNN::timestep | ( | ) |
Calculates the timestep the simulation will be running with. This does not make any sense for analogue hardware, why zero is returned in this case.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |