Classes for NEURON
- class blenderneuron.nrn.neuronnode.NeuronNode(server_end=None, *args, **kwargs)[source]
-
- static clamp_section_x(x_in)[source]
When placing synapses, avoid using 0 and 1 section locations, esp. if extracellular potentials will be computed. See the warning comment in:
- https://www.neuron.yale.edu/neuron/static/py_doc/modelspec/programmatic/
mechanisms/mech.html?highlight=i_membrane#mech-extracellular
- Parameters:
x_in – 0-1 section location
- Returns:
section location constrained to 0.001-0.999
- create_netcon_syn(syn_class_name, syn_sec, syn_sec_x, syn_params, source_sec, source_x, threshold, delay, weight, source_on_rank, syn_on_rank, source_gid)[source]
- gather_group_dicts(local_groups)[source]
Gather local group dictionaries on rank zero and merge their roots.
ParallelContext.py_alltoallis used rather than an external MPI dependency. Each rank sends its local fragment only to rank zero, so large activity traces are not replicated on every worker.
- get_group_dicts(compressed=True)[source]
Return the selected groups, gathering rank-local roots under MPI.
When MPI is enabled this is a collective operation: every rank must call it in the same order. Only rank zero receives the complete result; non-root ranks return
None. Keeping the collective boundary here means a caller can send precisely one complete payload to Blender.
- merge_mpi_group_fragments(fragments)[source]
Merge rank fragments deterministically, restoring Blender names.
- run_simulation()[source]
Initialize and run, dispatching to every rank under the coordinator.
Without the coordinator, MPI callers must call this on every rank.
- section_rx = re.compile('(.+?])\\.?(.*)')
- segment_gid(sec_name, seg_id, has_spine)[source]
Only one gid can be associated with a segment. If more than one gid is assigned to a seg, only the last gid will send events to the post- synapse.
However, if the segment index can be computed from section.x location, locations that refer to the same segment e.g. section(0.49) and section(0.51) when nseg=3, can be identified.
This method generates a unique gid for each segment based on the section name and segment index. Where section(0) -> seg_id=0 and section(1) -> seg_id=nseg-1
If a spine was added, its assumed that the pre-syn location is at the head of the spine.
- Parameters:
sec_name –
seg_id –
has_spine –
- Returns:
- start_mpi_coordinator()[source]
Start rank-zero Blender coordination after MPI model setup.
Call this on every rank after
init_mpi. It returns immediately on rank zero, which remains available to Blender; worker ranks enter the request loop and return only afterstop_mpi_coordinatoris called on rank zero.
- class blenderneuron.nrn.neuronrootgroup.NeuronRootGroup[source]
-
- collect()[source]
Based on the group’s color level, gathers the values of the group’s collect_variable. This method is called at regular times during the simulation.
- Returns:
None
- prepare_activity(queue_cleared=False)[source]
Clear traces and refresh geometry before the first sample of a run.
Rebuilding also captures direct NEURON pt3d edits between runs. Direct pt3d edits during collection require an explicit cache rebuild; Blender coordinate updates invalidate the affected sections automatically.
- class blenderneuron.nrn.neuronsection.NeuronSection[source]
- collect(recursive=True)[source]
Recursively collects the section midpoint values of a group’s collect_variable (e.g. ‘v’)
- Parameters:
recursive – Whether to collect child section values (otherwise stop at root/soma)
- Returns:
None
- collect_segments_recursive()[source]
Recursively collects the values of segments of a root section. Segments are given sequential 0-based names similar to NEURON cells and sections. For example, TestCell[0].dend[3][4] refers to first TestCell, 4th dendrite, 5th segment. Segment order is determined by the order in which they appear in NEURON’s xyz3d() function.
- Returns:
None
- from_nrn_section(nrn_section, group)[source]
Iteratively initializes the NeuronSection instances from NEURON sections, maintaining the original structure.
- Parameters:
nrn_section – The NEURON section to initialize from
group – The group to which the sections belong
- Returns:
None
- from_updated_blender_root(blender_section)[source]
Update the coordinates and radii from the updated blender_section, iteratively for all child sections.
- Parameters:
blender_section – The updated blender section data
- Returns:
None