Components
Core component classes and signals.
Public components
- class Clock(dt: float, sampling_rate: int = -1, name: str = 'default_clock')[source]
Bases:
ComponentRepresents the clock class.
This class manages the time counter and all operations on it.
- Parameters:
dt (float) – Time step variable for the simulation
sampling_rate (int = 1) – Integral postive multiple of dt, simulation data are stored on these time steps
name (str = “default_clock”) – Name of the component
- Variables:
dt (float) – Time step variable for the simulation
_sampling_rate (float) – Integral postive multiple of dt, simulation data are stored on these time steps
t (float = 0.0) – Time counter variable for simulation
_t_sample (float = 0.0) – Helper for sampling rate
running (bool = True) – Clock status for time updates
_t_final (float = 0.0) – Time at which to stop simulation and set running to False
- dt
Clock Delta time data
- t
Clock time data
- running
Clock running state data
- set(t_final: float, t: float | None = None)[source]
Clock set method
Sets t_final and t. Also sets running to True.
- Parameters:
t_final (float)
t (float = None)
- class TimeComponent(name: str = 'default_time_component')[source]
Bases:
ComponentRepresents the base timecomponent class.
This class is the base class for all components which are time dependent on clock data.
It provides methods for simulate() and input_port() based on clock data.
- Parameters:
name (str = “default_time_component”) – Name of the component
- Variables:
_data (any = 0) – A container for specific data according to child classes
- class DataComponent(name: str = 'default_data_component')[source]
Bases:
ComponentRepresents the base datacomponent class.
This class manages simulation data, and their corresponding data units.
It provides methods for data handling like get, display, store.
- Parameters:
name (str = “default_data_component”) – Name of the component
- Variables:
_simulation_data (dict = {}) – A dict storing keys and it stores values for those keys, at each sampling time step
_simulation_data_units (dict = {}) – A dict storing units corresponding to the keys
- store_data()[source]
DataComponent store_data method
Stores data for each key based on matching name of variable and key.
- display_data(time_data: ndarray, simulation_keys: tuple[str, ...] | None = None)[source]
DataComponent display_data method
Plots stored data of the component based on time_data and simulation_keys.
- Parameters:
time_data (ndarray) – A numpy array containing sequential time data
simulation_keys (tuple[str, …] = None) – An optional tuple of strings containing keys for which to plot data, Default all defined keys
- class PhysicalComponent(name: str = 'default_physical_component')[source]
Bases:
DataComponent,TimeComponentPhysicalComponent class
Noise and waveforms
- class LangevinNoise(Mu: int, Std_dev: int, name: str = 'default_langevin_noise')[source]
Bases:
NoNoiseLangevinNoise class
- class ArbitaryWave(name: str, t_unit: float = -1, total_spread: float = 1.0)[source]
ArbitaryWave class
- class PulseWave(name: str, pulse_low: float, pulse_high: float, t_unit: float, total_spread: float = 1)[source]
PulseWave class
- class AlternatingPulseWave(name: str, static_val: float, pulse_val: float, t_unit: float, total_spread: float = 1)[source]
AlternatingPulseWave class
- class ArbitaryWaveGenerator(*arg, **kwargs)[source]
ArbitaryWaveGenerator Singleton class
- signals: dict[str, ArbitaryWave]
Signals dictionary for ArbitaryWaves
- set(arbitarywaves: ArbitaryWave | tuple[ArbitaryWave, ...])[source]
ArbitaryWaveGenerator set method
Simulation wiring
- class Connection(input_components: Component | tuple[Component, ...] | None, output_components: Component | tuple[Component, ...], name: str = 'default_connection')[source]
Bases:
TimeComponentConnection class
- class Simulator(simulation_clock: Clock, name: str = 'default_simulator')[source]
Bases:
DataComponentSimulator class
- set(connections: Connection | tuple[Connection, ...])[source]
Simulator set method