neurai.const package#

Submodules#

exception neurai.const.error.CustomError(error_code, msg)#

Bases: Exception

Custom error class with an associated error code and message.

Parameters:
  • error_code (ErrorCode) – The numerical value of the error code.

  • msg (str) – The error message.

class neurai.const.error.ErrorCode(value)#

Bases: Enum

Parameters:
  • value (int) – The numerical value of the enum member.

  • NO_ERROR – Not an error.

  • DT – Not supported: Simulation step size of 0.1.

  • DELAY_STEP – Not supported: Delay_step of synapse is the range: [1, 15].

  • STDP – Not supported: STDP synaptic connections.

  • SOLVE – Not supported: Methods for solving neurons indices other than EXP_EULER.

  • RECORD_POISSON – Not supported: Recording spike from PoissonGenerator.

  • CONSTRUCT – Not supported: PoissonGenerator and DCGenerator constructed before Neurons.

  • NEURON_NUMBER – Not supported: The number of neurons is greater than 1 million.

  • SYNAPSE_NUMBER – Not supported: The number of connections of synapses is exceeds 100 million.

  • LABEL_DUPLICATE – ERROR: label duplicate.

  • NEURON_EMPTY – ERROR: Neurons can not empty.

  • PARAM – ERROR: Params input is error.

  • SYNAPSE_TOTAL_NUMBER – ERROR: Synapse number exceed pre neuron size * post neuron size.

  • SYNAPSE_ONE2ONE – ERROR: Connect rule One2One, pre neuron size must equal to post neuron size.

  • POISSON_MULTI_POP – ERROR: One poisson generator can not connect to multi pops.

  • BUILD_STOP – WARNING: Build stopped.

  • NET_ERROR – ERROR: Network error.

  • CHIP_USED – ERROR: Chip has used.

class neurai.const.math.SolverMethodODE(value)#

Bases: Enum

An enumeration class representing different numerical methods for solving ordinary differential equations (ODEs).

Parameters:

value (int) – The numerical value of the enum member.

EULER#

Euler method

EXP_EULER#

Exponential Euler method

RK2#

Second-order Runge-Kutta method

RK3#

Third-order Runge-Kutta method

RK4#

Fourth-order Runge-Kutta method

RKF45#

The Runge–Kutta–Fehlberg method has two methods of orders 5 and 4

IMPLICT_EULER#

Implict Euler method

Examples

>>> from neurai.const.math import SolverMethodODE
>>> method = SolverMethodODE.EXP_EULER
>>> print(method.value)
0
class neurai.const.math.SolverMethodSDE(value)#

Bases: Enum

An enumeration class representing different numerical methods for solving stochastic differential equations (SDEs).

Parameters:
  • MISLTEAIN – Mislteain method

  • HEUN – Heun method

class neurai.const.reset_type.ResetType(value)#

Bases: IntEnum

IntEnum class for different reset type to reset the membrane potential for neurons. :param value: The numerical value of the enum member. :type value: int

HARD#

The type for hard reset.

SOFT#

The type for soft reset.

class neurai.const.simulation.ConnectRepr(value)#

Bases: Enum

The data structure representation of the connection. COO: denotes Coordinate data format, express here is (selected_pre_ids, selected_post_ids); CSR: denotes Compressed Sparse Row data format, express here is (selected_post_ids, selected_pre_indptr); MAT: denotes Matrix data format, express here is Array([pre_num, post_num]).

Parameters:

value (int) – The numerical value of the enum member.

Examples

>>> from neurai.const.simulation import ConnectRepr
>>> repr = ConnectRepr.COO
>>> print(repr.value)
0
class neurai.const.train.ComputationType(value)#

Bases: IntEnum

IntEnum class for different computation type for neurons. :param value: The numerical value of the enum member. :type value: int

FORLOOP#

The type for for_loop.

CUDA#

The type for cuda.

class neurai.const.train.EPMode(value)#

Bases: IntEnum

Enum class for different EP modes.

Parameters:
  • TWO_PHASE – The method of EP.

  • THREE_PHASE – The method of EP.

Examples

>>> from neurai.const.train import EPMode
>>> mode = EPMode.TWO_PHASE
>>> print(mode.value)
0
class neurai.const.train.PCMode(value)#

Bases: IntEnum

Enum class for different PC modes.

Parameters:
  • STRICT – The method of PC.

  • FIXED_PRED – The method of PC.

  • SWEIGHT_BISTRICT – The method of BiPC.

  • BWEIGHT_BISTRICT – The method of BiPC.

Examples

>>> from neurai.const.train import PCMode
>>> mode = PCMode.STRICT
>>> print(mode.value)
0
class neurai.const.train.StepMode(value)#

Bases: IntEnum

IntEnum class for different step modes for neurons. :param value: The numerical value of the enum member. :type value: int

SINGLE#

The mode for single-step update.

MULTI#

The mode for multi-step update.

Module contents#