Neurodamus.core Sub-Modules¶
neurodamus.core.configuration¶
Runtime configuration
Classes
- class neurodamus.core.configuration.CircuitConfig(opt_dict=None, **opts)¶
- CellLibraryFile = <neurodamus.utils.pyutils.ConfigT._ConfigFlag object>¶
- DetailedAxon = False¶
- Engine = None¶
- METypePath = None¶
- MorphologyPath = None¶
- MorphologyType = None¶
- NodesetName = None¶
- PopulationName = None¶
- PopulationType = None¶
- name = None¶
- nrnPath = <neurodamus.utils.pyutils.ConfigT._ConfigFlag object>¶
- class neurodamus.core.configuration.CliOptions(opt_dict=None, **opts)¶
- NoRestriction = <neurodamus.core.configuration.CliOptions.NoRestriction object>¶
- build_model = None¶
- cell_permute = None¶
- coreneuron_direct_mode = False¶
- crash_test = False¶
- dry_run = False¶
- enable_coord_mapping = False¶
- enable_shm = False¶
- keep_axon = False¶
- keep_build = False¶
- lb_mode = None¶
- memory_tracker = None¶
- model_stats = False¶
- modelbuilding_steps = None¶
- num_target_ranks = None¶
- output_path = None¶
- report_buffer_size = None¶
- restore = None¶
- restrict_connectivity = 0¶
- restrict_features = <neurodamus.core.configuration.CliOptions.NoRestriction object>¶
- restrict_node_populations = <neurodamus.core.configuration.CliOptions.NoRestriction object>¶
- save = False¶
- simulate_model = True¶
- simulator = None¶
- exception neurodamus.core.configuration.ConfigurationError¶
Error due to invalid settings in simulation config ConfigurationError should be raised by all ranks to be caught properly. Otherwise we might end up with deadlocks. For Exceptions that are raised by a single rank Exception should be used. This is due to the way Exceptions are caught from commands.py.
- neurodamus.core.configuration.EXCEPTION_NODE_FILENAME = '.exception_node'¶
A file which controls which rank shows exception
- class neurodamus.core.configuration.Feature(*values)¶
- LoadBalance = 5¶
- Replay = 1¶
- SpontMinis = 2¶
- Stimulus = 4¶
- SynConfigure = 3¶
- class neurodamus.core.configuration.GlobalConfig¶
- debug_conn = ''¶
- classmethod set_mpi()¶
- verbosity = 1¶
- class neurodamus.core.configuration.LoadBalanceMode(*values)¶
An enumeration, inc parser, of the load balance modes.
- class AutoBalanceModeParams¶
Parameters for auto-selecting a load-balance mode
- cell_count = 1000¶
- duration = 1000¶
- mpi_ranks = 200¶
- multisplit_cpu_cell_ratio = 4¶
- Memory = 3¶
- MultiSplit = 2¶
- RoundRobin = 0¶
- WholeCell = 1¶
- classmethod auto_select(use_neuron, cell_count, duration, auto_params=<class 'neurodamus.core.configuration.LoadBalanceMode.AutoBalanceModeParams'>)¶
Simple heuristics for auto selecting load balance
- classmethod parse(lb_mode)¶
Parses the load balancing mode from a string. Options other than WholeCell or MultiSplit are considered RR
- neurodamus.core.configuration.check_connections_configure(config: _SimConfig, target_manager) None¶
Check connection block configuration and raise warnings for: 1. Global variables should be set in the Conditions block 2. Connection overriding chains (t=0) 3. Connections with Weight=0 not overridden by delayed (not instantiated) 4. Partial connection overriding -> Error 5. Connections with delay > 0 not overriding anything
- neurodamus.core.configuration.get_debug_cell_gids(cli_options)¶
Parse the –dump-cell-state option from CLI.
Supports: - A single integer (e.g., “2”) - A comma-separated list of integers or ranges (e.g., “1,3-5,7”) - A file path containing one GID per line
- Returns:
List of GIDs as integers, or None if not provided.
- Raises:
ConfigurationError – if the format is invalid or file doesn’t exist.
- neurodamus.core.configuration.make_circuit_config(config_dict, req_morphology=True)¶
neurodamus.core.random¶
Py Wrappers for the HOC RNGs
- class neurodamus.core.random.Random123(id1, id2, id3, seed=None)¶
- neurodamus.core.random.gamma(rng, a, b, N=1)¶
Sample N variates from a gamma distribution with parameters shape = a, scale = b using the NEURON random number generator rng. Uses the algorithm by Marsaglia and Tsang 2001.
neurodamus.core.stimuli¶
Stimuli sources. inc current and conductance sources which can be attached to cells
- class neurodamus.core.stimuli.ConductanceSource(reversal=0.0, *, delay=0.0, rng=None, represents_physical_electrode=False)¶
- attach_to(section, position=0.5)¶
- class neurodamus.core.stimuli.CurrentSource(base_amp=0.0, *, delay=0, rng=None, represents_physical_electrode=False)¶
- attach_to(section, position=0.5)¶
- class neurodamus.core.stimuli.ElectrodeSource(efields: list[EField])¶
Manages extracellular electric field stimulation for a single cell and applies to every segment.extracellular._ref_e via EFieldIntegrator mechanism. EFieldIntegrator computes the potential at every time step as the sum of multiple e-fields, each defined by peak amplitudes (Ex,Ey,Ez), frequency, phase, delay, ramp up and ramp down.
- apply_segment_potentials(segment_displacements)¶
Apply potentials to segment.extracellular._ref_e
- Parameters:
segment_displacements – list of (segment, displacement vector) tuples (x/y/z in meters)
- class neurodamus.core.stimuli.SignalSource(base_amp=0.0, *, delay=0, rng=None, represents_physical_electrode=False)¶
- add_noise(mean, variance, duration, dt=0.5)¶
Adds a noise component to the signal.
- add_ornstein_uhlenbeck(tau, sigma, mean, duration, dt=0.25)¶
Adds an Ornstein-Uhlenbeck process with given correlation time, standard deviation and mean value.
tau: correlation time [ms], white noise if zero sigma: standard deviation [uS] mean: mean value [uS] duration: duration of signal [ms] dt: timestep [ms]
- add_pulse(max_amp, duration, **kw)¶
Add a constant-amplitude pulse.
Generates a pulse with a constant amplitude (max_amp) for the specified duration. This is a special case of add_ramp with no amplitude change over time.
- add_ramp(amp1, amp2, duration, **kw)¶
Add a linear amplitude ramp.
Creates a ramp signal that linearly changes amplitude from amp1 to amp2 over the given duration. All intermediate values between the start and end times are linearly interpolated.
- add_segment(amp, duration, amp2=None)¶
Sets a linear signal for a certain duration.
If amp2 is None (default) then we have constant signal
- add_shot_noise(tau_D, tau_R, rate, amp_mean, amp_var, duration, dt=0.25)¶
Adds a Poisson shot noise signal with gamma-distributed amplitudes and bi-exponential impulse response: https://paulbourke.net/miscellaneous/functions/
tau_D: bi-exponential decay time [ms] tau_R: bi-exponential raise time [ms] rate: Poisson event rate [Hz] amp_mean: mean of gamma-distributed amplitudes [nA] amp_var: variance of gamma-distributed amplitudes [nA^2] duration: duration of signal [ms] dt: timestep [ms]
- add_sin(amp, total_duration, freq, step=0.025, **kw)¶
Builds a sinusoidal signal.
- Parameters:
amp – The max amplitude of the wave
total_duration – Total duration, in ms
freq – The wave frequency, in Hz
step – The step, in ms (default: 0.025)
- add_train(amp, frequency, pulse_duration, total_duration, **kw)¶
Stimulus with repeated pulse injections at a specified frequency.
- Parameters:
amp (float) – Amplitude of each pulse.
frequency (float) – Number of pulses per second (Hz).
pulse_duration (float) – Duration of a single pulse (peak time) in milliseconds.
total_duration (float) – Total duration of the pulse train in milliseconds.
base_amp (float, optional) – Base amplitude (default is 0.0).
- Returns:
The instance of the SignalSource class with the configured pulse train.
- Return type:
- delay(duration)¶
Increments the ref time so that the next created signal is delayed
- classmethod noise(mean, variance, duration, dt=0.5, base_amp=0.0, **kw)¶
- classmethod ornstein_uhlenbeck(tau, sigma, mean, duration, dt=0.25, base_amp=0.0, **kw)¶
- plot(ylims=None)¶
- classmethod pulse(max_amp, duration, base_amp=0.0, **kw)¶
- classmethod ramp(amp1, amp2, duration, base_amp=0.0, **kw)¶
- classmethod shot_noise(tau_D, tau_R, rate, amp_mean, var, duration, dt=0.25, base_amp=0.0, **kw)¶
- classmethod sin(amp, total_duration, freq, step=0.025, base_amp=0.0, **kw)¶
- classmethod train(amp, frequency, pulse_duration, total_duration, base_amp=0.0, **kw)¶