samna.dynapse1#
Submodules#
Module content#
- class samna.dynapse1.Dynapse1Chip#
Bases:
pybind11_object
Dynapse1Chip represents one DYNAP-SE1 chip, including 4 cores. The constructor function doesn’t accept any input parameters.
- property chip_id#
chip ID, [0,4).
- Type:
int
- property cores#
4 cores of the chip.
- Type:
- from_json(self: samna.dynapse1.Dynapse1Chip, arg0: str) None #
- to_json(self: samna.dynapse1.Dynapse1Chip) str #
- class samna.dynapse1.Dynapse1Configuration#
Bases:
pybind11_object
Dynapse1Configuration represents one DYNAP-SE1 configuration , including 4 DYNAP-SE1 chips. The constructor function doesn’t accept any input parameters.
- property chips#
4 chips of the configuration.
- Type:
- from_json(self: samna.dynapse1.Dynapse1Configuration, arg0: str) None #
- to_json(self: samna.dynapse1.Dynapse1Configuration) str #
- class samna.dynapse1.Dynapse1Core#
Bases:
pybind11_object
Dynapse1Core represents one DYNAP-SE1 core, containing 256 DYNAP-SE1 neurons and the their shared parameters. The constructor function of Dynapse1Core doesn’t accept any input parameters.
- property chip_id#
chip ID, [0,4).
- Type:
int
- property core_id#
core ID, [0,4).
- Type:
int
- from_json(self: samna.dynapse1.Dynapse1Core, arg0: str) None #
- property neurons#
neuron ID, [0,256).
- Type:
int
- property parameter_group#
ParameterGroup including 25 parameters shared by a core of neurons.
- to_json(self: samna.dynapse1.Dynapse1Core) str #
- class samna.dynapse1.Dynapse1Destination#
Bases:
pybind11_object
Contains information (target chip and cores) of one outgoing destination in SRAM. The constructor function of Dynapse1Destination doesn’t accept any input parameters.
- property core_mask#
target core mask.
- Type:
int
- property dx#
- Type:
int
- property dy#
dy.
- Type:
int
- from_json(self: samna.dynapse1.Dynapse1Destination, arg0: str) None #
- property in_use#
if this destination is occupied or not.
- Type:
bool
- property sx#
sx.
- Type:
int
- property sy#
sy.
- Type:
int
- property target_chip_id#
target post chip ID.
- Type:
int
- to_json(self: samna.dynapse1.Dynapse1Destination) str #
- property virtual_core_id#
virtual core ID.
- Type:
int
- class samna.dynapse1.Dynapse1FpgaSpikeGen#
Bases:
pybind11_object
Can be used to configure spike generators of DYNAP-SE1 as self-defined spike generators. You cannot create a Dynapse1FpgaSpikeGen by yourself in Python script, instead you can only get the Dynapse1FpgaSpikeGen from a Dynapse1Mode.
- get_base_addr(self: samna.dynapse1.Dynapse1FpgaSpikeGen) int #
- Returns:
base_addr.
- Return type:
int.
- get_isi(self: samna.dynapse1.Dynapse1FpgaSpikeGen) int #
Get inter-spike interval.
- Returns:
isi, inter-spike interval.
- Return type:
int.
- get_isi_multiplier(self: samna.dynapse1.Dynapse1FpgaSpikeGen) int #
- Returns:
isi_multiplier.
- Return type:
int.
- get_module_type(self: samna.dynapse1.Dynapse1FpgaSpikeGen) samna.dynapse1.FpgaModuleType #
WRONG for now. Do NOT call it.. Need to bind FpgaModuleType to Python…
- Returns:
FpgaModuleType: FpgaModuleType.
- get_repeat_mode(self: samna.dynapse1.Dynapse1FpgaSpikeGen) bool #
Check if the repeat mode is on or not.
- Returns:
repeat.
- Return type:
bool.
- get_stim_count(self: samna.dynapse1.Dynapse1FpgaSpikeGen) int #
- Returns:
stim_count.
- Return type:
int.
- is_running(self: samna.dynapse1.Dynapse1FpgaSpikeGen) bool #
Check if the FPGA spike generator(s) are on.
- Returns:
run_status: if the Dynapse1PoissonGen is on.
- Return type:
bool.
- preload_stimulus(self: samna.dynapse1.Dynapse1FpgaSpikeGen, arg0: List[samna.dynapse1.FpgaSpikeEvent]) None #
Preload FpgaSpikeEvents.
- Parameters:
events (list[samna.dynapse1.FpgaSpikeEvent]) – FpgaSpikeEvents to be loaded.
- set_base_addr(self: samna.dynapse1.Dynapse1FpgaSpikeGen, arg0: int) None #
- Parameters:
base_addr (int) – base_addr.
- set_isi(self: samna.dynapse1.Dynapse1FpgaSpikeGen, arg0: int) None #
Set inter-spike interval.
- Parameters:
isi (int) – isi, inter-spike interval.
- set_isi_multiplier(self: samna.dynapse1.Dynapse1FpgaSpikeGen, arg0: int) None #
- Parameters:
multiplier (int) – isi base.
- set_repeat_mode(self: samna.dynapse1.Dynapse1FpgaSpikeGen, arg0: bool) None #
If repeat is true, the pre loaded stimulus will be played repeatedly.
- Parameters:
repeat (bool) – repeat.
- set_stim_count(self: samna.dynapse1.Dynapse1FpgaSpikeGen, arg0: int) None #
- Parameters:
stim_count (int) – stim_count.
- set_variable_isi_mode(self: samna.dynapse1.Dynapse1FpgaSpikeGen, arg0: bool) None #
- Parameters:
enabled (bool) – enabled.
- start(self: samna.dynapse1.Dynapse1FpgaSpikeGen) None #
Start the FPGA spike generator(s). If it’s already on, this function will do nothing.
- stop(self: samna.dynapse1.Dynapse1FpgaSpikeGen) None #
stop the FPGA spike generator(s). If it’s already off, this function will do nothing.
- class samna.dynapse1.Dynapse1Interface#
Bases:
pybind11_object
Using DYNAP-SE1 interface it is possible to monitor neuron activity using an oscilloscope, use Tau2 mode, and reset board timestamp. You cannot create a Dynapse1Interface by yourself in Python script, instead you can only get the API from a Dynapse1Model.
- monitor_neuron(self: samna.dynapse1.Dynapse1Interface, arg0: int, arg1: int) None #
Select the neuron you want to monitor using oscilloscope. You can only monitor one neuron per core.
- Parameters:
chip_id (int) – chip_id, [0,4).
neuron_id (int) – neuron id in the chip, [0,1023).
- reset_tau_1(self: samna.dynapse1.Dynapse1Interface, arg0: int, arg1: int) None #
Switch a specific core to use tau1.
- Parameters:
chip_id (int) – chip_id, [0,4).
core_id (int) – core_id, [0,4).
- reset_tau_2(self: samna.dynapse1.Dynapse1Interface, arg0: int, arg1: int) None #
Switch a specific core to use tau2.
- Parameters:
chip_id (int) – chip_id, [0,4).
core_id (int) – core_id, [0,4).
- reset_timestamp(self: samna.dynapse1.Dynapse1Interface) None #
Reset the time counter on the FPGA. Called automatically in the init of Dynapse1Model every time you open the board.
- set_tau_2(self: samna.dynapse1.Dynapse1Interface, arg0: int, arg1: int) None #
Switch a specific neuron to use tau2.
- Parameters:
chip_id (int) – chip_id, [0,4).
neuron_id (int) – neuron id in the chip, [0,1023).
- class samna.dynapse1.Dynapse1Model#
Bases:
pybind11_object
The DYNAP-SE1 model is the standard interface between Python code and a connected DYNAP-SE1 chip. Via the model it is possible to connect its source and sink nodes to the filtering system and apply configurations.
- apply_configuration(self: samna.dynapse1.Dynapse1Model, arg0: samna.dynapse1.Dynapse1Configuration) None #
Apply new configuration to the DYNAP-SE1 board.
- Parameters:
new_config (Dynapse1Configuration) – new configuration.
- apply_configuration_by_chip(self: samna.dynapse1.Dynapse1Model, arg0: samna.dynapse1.Dynapse1Configuration, arg1: int) None #
Apply new configuration only to a single chip of the DYNAP-SE1 board. NOTE: be careful if you use this method because this is specifically designed for the user who only does experiments in a single chip. If you have network components in other chips, please don NOT use this method.
- Parameters:
config (Dynapse1Configuration) – new configuration.
chip_id (int) – the chip you want to change, [0,4).
- apply_configuration_by_core(self: samna.dynapse1.Dynapse1Model, arg0: samna.dynapse1.Dynapse1Configuration, arg1: int, arg2: int) None #
Apply new configuration only to a single core of the DYNAP-SE1 board. NOTE: be careful if you use this method because this is specifically designed for the user who only does experiments in a single core. If you have network components in other cores, please don NOT use this method.
- Parameters:
config (Dynapse1Configuration) – new configuration.
chip_id (int) – the chip you want to change.
- get_configuration(self: samna.dynapse1.Dynapse1Model) samna.dynapse1.Dynapse1Configuration #
Get the current configuration of the DYNAP-SE1 board.
- Returns:
samna.dynapse1.Dynapse1Configuration: current configuration of the board.
- get_dynapse1_api(self: samna.dynapse1.Dynapse1Model) samna.dynapse1.Dynapse1Interface #
Get Dynapse1Interface which can do monitor_neuron, reset_timestamp, reset_tau_1, reset_tau_2, set_tau_2.
- Returns:
samna.dynapse1.Dynapse1Interface: Dynapse1Interface.
- get_fpga_spike_gen(self: samna.dynapse1.Dynapse1Model) samna.dynapse1.Dynapse1FpgaSpikeGen #
Get Dynapse1FpgaSpikeGen.
- Returns:
samna.dynapse1.Dynapse1FpgaSpikeGen: Dynapse1FpgaSpikeGen.
- get_poisson_gen(self: samna.dynapse1.Dynapse1Model) samna.dynapse1.Dynapse1PoissonGen #
Get Dynapse1PoissonGen.
- Returns:
samna.dynapse1.Dynapse1PoissonGen: Dynapse1PoissonGen.
- get_source_node(self: samna.dynapse1.Dynapse1Model) samna.DeviceSourceNode_dynapse1_dynapse1_event #
Get the source node in the Dynapse1Model which sends spikes out.
- Parameters:
parameter (Dynapse1Parameter) – Dynapse1Parameter object.
chip_id (int) – chip_id, [0,4).
- Returns:
graph.nodes.BasicSourceNode: BasicSourceNode with the event type Dynapse1Event.
- update_parameter_group(self: samna.dynapse1.Dynapse1Model, arg0: samna.dynapse1.Dynapse1ParameterGroup, arg1: int, arg2: int) None #
Update the parameters of a specific core.
- Parameters:
parameter_group (Dynapse1ParameterGroup) – Dynapse1ParameterGroup object.
chip_id (int) – chip_id, [0,4).
core_id (int) – core_id, [0,4).
- update_single_parameter(self: samna.dynapse1.Dynapse1Model, arg0: samna.dynapse1.Dynapse1Parameter, arg1: int, arg2: int) None #
Update a single parameter of a specific core.
- Parameters:
parameter (Dynapse1Parameter) – Dynapse1Parameter object.
chip_id (int) – chip_id, [0,4).
core_id (int) – core_id, [0,4).
- class samna.dynapse1.Dynapse1Neuron#
Bases:
pybind11_object
Dynapse1Neuron represents a silicon neuron on chip, containing information of neuron location, incoming and outgoing connections. The constructor function of Dynapse1Destination doesn’t accept any input parameters.
- property chip_id#
chip_id, [0,4).
- Type:
int
- property core_id#
core_id, [0,4).
- Type:
int
- property destinations#
list of destinations.
- Type:
- from_json(self: samna.dynapse1.Dynapse1Neuron, arg0: str) None #
- property neuron_id#
neuron_id, [0,256).
- Type:
int
- property synapses#
list of synapses.
- Type:
- to_json(self: samna.dynapse1.Dynapse1Neuron) str #
- class samna.dynapse1.Dynapse1Parameter#
Bases:
pybind11_object
Dynapse1Parameter represents one parameter. The constructor function accept 0 or 3 input parameters.
- Parameters:
param_name (string) – parameter name.
coarse_value (int) – parameter coarse value, [0, 8).
fine_value (int) – parameter fine value, [0, 256).
- property coarse_value#
coarse value.
- Type:
int
- property fine_value#
fine value.
- Type:
int
- from_json(self: samna.dynapse1.Dynapse1Parameter, arg0: str) None #
- property param_name#
parameter name, in one of the following values:
"IF_THR_N", "PS_WEIGHT_INH_S_N", "PS_WEIGHT_INH_F_N", "PS_WEIGHT_EXC_S_N", "PS_WEIGHT_EXC_F_N", "IF_RFR_N", "IF_TAU1_N", "IF_AHTAU_N", "IF_CASC_N", "IF_TAU2_N", "IF_BUF_P", "IF_AHTHR_N", "NPDPIE_THR_S_P", "NPDPIE_THR_F_P", "NPDPII_THR_F_P", "NPDPII_THR_S_P", "IF_NMDA_N", "IF_DC_P", "IF_AHW_P", "NPDPII_TAU_S_P", "NPDPII_TAU_F_P", "NPDPIE_TAU_F_P", "NPDPIE_TAU_S_P", "R2R_P", "PULSE_PWLK_P".
- Type:
string
- to_json(self: samna.dynapse1.Dynapse1Parameter) str #
- property type#
“P” or “N.
- Type:
string
- class samna.dynapse1.Dynapse1ParameterGroup#
Bases:
pybind11_object
Dynapse1ParameterGroup represents a group of 25 parameters shared by a core of neurons. The constructor function doesn’t accept any input parameters.
- property chip_id#
chip ID.
- Type:
int
- property core_id#
core ID.
- Type:
int
- from_json(self: samna.dynapse1.Dynapse1ParameterGroup, arg0: str) None #
- get_linear_parameter(self: samna.dynapse1.Dynapse1ParameterGroup, arg0: str) float #
Get a Dynapse1Parameter from the parameter group given the parameter name.
- Parameters:
param_name (string) – parameter name.
- Returns:
linear_param_value
- Return type:
float
- get_parameter_by_name(self: samna.dynapse1.Dynapse1ParameterGroup, arg0: str) samna.dynapse1.Dynapse1Parameter #
Get a Dynapse1Parameter from the parameter group given the parameter name. :param string param_name: parameter name.
- property param_map#
parameters.
- to_json(self: samna.dynapse1.Dynapse1ParameterGroup) str #
- class samna.dynapse1.Dynapse1PoissonGen#
Bases:
pybind11_object
Can be used to configure spike generators of DYNAP-SE1 as Poisson spike generators. You cannot create a Dynapse1PoissonGen by yourself in Python script, instead you can only get the Dynapse1PoissonGen from a Dynapse1Model.
- get_module_type(self: samna.dynapse1.Dynapse1PoissonGen) samna.dynapse1.FpgaModuleType #
WRONG for now. Do NOT call it.. Need to bind FpgaModuleType to Python…
- Returns:
FpgaModuleType: FpgaModuleType.
- get_poisson_rate_hz(self: samna.dynapse1.Dynapse1PoissonGen, arg0: int) float #
Get the firing rate of a specific Poisson generator.
:param int neuron_id
- Returns:
rates: rate of a specific Poisson generator.
- Return type:
float.
- get_poisson_rates_hz(self: samna.dynapse1.Dynapse1PoissonGen) List[float] #
Get the firing rates of 1024 Poisson generators.
- Returns:
rates: rate of a specific Poisson generator.
- Return type:
list[float].
- is_running(self: samna.dynapse1.Dynapse1PoissonGen) bool #
Check if the Poisson generator(s) are on.
- Returns:
run_status: if the Dynapse1PoissonGen is on.
- Return type:
bool.
- set_chip_id(self: samna.dynapse1.Dynapse1PoissonGen, arg0: int) None #
Set the target chip where the stimulated neurons are located.
- Parameters:
chip_id (int) – chip_id.
- start(self: samna.dynapse1.Dynapse1PoissonGen) None #
Start the Poisson generator(s). If it’s already on, will do nothing.
- stop(self: samna.dynapse1.Dynapse1PoissonGen) None #
Stop the Poisson generator(s). If it’s already off, will do nothing.
- write_poisson_rate_hz(self: samna.dynapse1.Dynapse1PoissonGen, arg0: int, arg1: float) None #
Set the firing rate of a specific Poisson generator.
- Parameters:
neuron_id (int) – neuron_id, [0,1023).
rate_hz (float) – rate_hz.
- write_poisson_rates_hz(self: samna.dynapse1.Dynapse1PoissonGen, arg0: List[float]) None #
Set the firing rates of 1024 Poisson generators.
- Parameters:
rates (list[float]) – rate list.
- class samna.dynapse1.Dynapse1SynType#
Bases:
pybind11_object
Members:
GABA_B
GABA_A
NMDA
AMPA
- property name#
- class samna.dynapse1.Dynapse1Synapse#
Bases:
pybind11_object
Contains information (ID of presynaptic neuron, synapse type) of one incoming connection, CAM. The constructor function of Dynapse1Synapse doesn’t accept any input parameters.
- from_json(self: samna.dynapse1.Dynapse1Synapse, arg0: str) None #
- property listen_core_id#
listened pre core ID.
- Type:
int
- property listen_neuron_id#
listened pre neuron ID.
- Type:
int
- property syn_type#
4 types. Note that GABA_A and GABA_B is switched, to be corrected.
AMPA: Fast excitatory synapse. Old FAST_EXC synapse in cortexcontrol.
NMDA: Slow excitatory synapse. Old SLOW_EXC synapse in cortexcontrol.
GABA_B: Slow inhibitory synapse. Old SLOW_INH synapse in cortexcontrol.
GABA_A: Shunting inhibitory synapse. Old FAST_INH synapse in cortexcontrol.
- to_json(self: samna.dynapse1.Dynapse1Synapse) str #
- class samna.dynapse1.Dynapse1Trace#
Bases:
pybind11_object
An event that stores the exponentially-decaying spiking traces of a list of monitored neurons in trace_map.
The Dynapse1Trace event has three public attributes:
- trace_map
A map that records the current trace values of monitored neurons. The neuron ID tuple is in the order of (chip, core, neuron).
- Type:
map(tuple(int, int, int), double)
- timestamp
The DYNAP-SE1 timestamp when the Dynapse1Trace event is generated.
- Type:
int
- trigger_neuron
The trigger neuron that triggers the traces update and the generation of this Dynapse1Trace. The neuron ID tuple is in the order of (chip, core, neuron).
- Type:
tuple(int, int, int)
The Dynapse1Trace events are generated by some Dynapse1NeuronTrace filter node, which can be connected to sink nodes to stream the events out. The events from the sink node can be used to trigger downstream algorithms, such as weight updates (LTP and LTD) in STDP or instantaneous firing rates tracking.
The constructor function of Dynapse1Trace accepts: - 0 input parameters, - 2 inputs (timestamp, trigger_neuron), or - 3 inputs (timestamp, trigger_neuron, trace_map).
- from_json(self: samna.dynapse1.Dynapse1Trace, arg0: str) None #
- property timestamp#
timestamp of the Dynapse1Trace event when it’s generated.
- Type:
int
- to_json(self: samna.dynapse1.Dynapse1Trace) str #
- property trace_map#
a map that records the trace values of monitored neurons at timestamp. Neuron ID is specified as tuple(chip,core,neuron).
- Type:
map(tuple(int,int,int), double)
- property trigger_neuron#
tuple(chip,core,neuron).
- Type:
tuple(int,int,int)
- class samna.dynapse1.FpgaModuleType#
Bases:
pybind11_object
Members:
PoissonGen
SpikeGen
- property name#
- class samna.dynapse1.FpgaSpikeEvent#
Bases:
pybind11_object
The constructor function of FpgaSpikeEvent accepts 0 or 4 input parameters as the following.
- Parameters:
core_mask (int) – 4-bits binary core mask specifying the target cores. e.g. 15 (i.e. 1111) means to target all 4 cores off the target chip.
neuron_id (int) – target neuron id.
target_chip (int) – target chip.
isi (int) – inter spike interval.
- Returns:
An FpgaSpikeEvent.
- Return type:
FpgaSpikeEvent.
- property core_mask#
core mask. 4-bits binary core mask specifying the target cores. e.g. 15 (i.e. 1111) means to target all 4 cores off the target chip.
- Type:
int
- from_json(self: samna.dynapse1.FpgaSpikeEvent, arg0: str) None #
- property isi#
inter spike interval.
- Type:
int
- property neuron_id#
target neuron ID.
- Type:
int
- property target_chip#
target chip ID.
- Type:
int
- to_json(self: samna.dynapse1.FpgaSpikeEvent) str #
- class samna.dynapse1.Spike#
Bases:
pybind11_object
Spike of silicon DYNAP-SE1 neuron. The constructor function of Spike doesn’t accept any input parameters.
- property chip_id#
chip_id, [0,4).
- Type:
int
- property core_id#
core_id, [0,4).
- Type:
int
- from_json(self: samna.dynapse1.Spike, arg0: str) None #
- property neuron_id#
neuron_id, [0,256).
- Type:
int
- property timestamp#
timestamp, in microsecond, 1e-6 second.
- Type:
int
- to_json(self: samna.dynapse1.Spike) str #
- class samna.dynapse1.TimestampWrapEvent#
Bases:
pybind11_object
TimestampWrapEvent is generated when the timestamp of DYNAP-SE1 is wrapped around. The constructor function of TimestampWrapEvent doesn’t accept any input parameters.
- from_json(self: samna.dynapse1.TimestampWrapEvent, arg0: str) None #
- property timestamp#
timestamp, in microsecond, 1e-6 second.
- Type:
int
- to_json(self: samna.dynapse1.TimestampWrapEvent) str #