patch package¶
patch.core module¶
- patch.core.assert_connectable(obj, label=None)[source]¶
Assert whether an object could be used as a
Connectable.- Parameters:
label (str) – Optional label to display to describe the object if the assertion fails.
- patch.core.is_density_mechanism(obj: str | neuron.hoc.HocObject)[source]¶
Check if obj is a (name of a) DensityMechanism on the
HocInterpreter.- Parameters:
obj – HocObject or name of the DensityMechanism to look for. Needs to be a known attribute of
neuron.h.- Return type:
bool
- patch.core.is_point_process(obj: str | neuron.hoc.HocObject)[source]¶
Check if obj is a (name of a) PointProcess on the
HocInterpreter.- Parameters:
obj – HocObject or name of the PointProcess to look for. Needs to be a known attribute of
neuron.h.- Return type:
bool
- patch.core.transform(obj)[source]¶
Transform an object to its NEURON representation, if the
__neuron__magic method is present.
- patch.core.transform_arc(obj, *args, **kwargs)[source]¶
Get an arclength object on a NEURON object.
Calls the
__arc__magic method on the callable object if present, otherwise returns the transformed object.
patch.interpreter module¶
- class patch.interpreter.ParallelContext(*args, **kwargs)[source]¶
Bases:
PythonHocObject- broadcast(data, root=0)[source]¶
Broadcast either a Vector or arbitrary picklable data. If
datais a Vector, the Vectors are resized and filled with the data from the Vector in therootnode. Ifdatais not a Vector, it is pickled, transmitted and returned from this function to all nodes.- Parameters:
data (
Vectoror any picklable object.) – The data to broadcast to the nodes.root (int) – The id of the node that is broadcasting the data.
- Returns:
None (Vectors filled) or the transmitted data
- Raises:
BroadcastError if
neuron.hoc.HocObjectsthat aren’t Vectors are transmitted
- setup_transfer(*args, **kwargs)¶
- source_var(*args, **kwargs)¶
- target_var(*args, **kwargs)¶
- class patch.interpreter.PythonHocInterpreter[source]¶
Bases:
object- NetStim(interpreter: PythonHocInterpreter, ptr)¶
- PointProcess(interpreter: PythonHocInterpreter, ptr)¶
- Section(interpreter: PythonHocInterpreter, ptr)¶
- Segment(interpreter, ptr, section, **kwargs)¶
- TimeSingleton(interpreter: PythonHocInterpreter, ptr)¶
- Vector(interpreter: PythonHocInterpreter, ptr)¶
- property parallel: ParallelContext¶
- property time¶
- class patch.interpreter.TimeSingleton(interpreter: PythonHocInterpreter, ptr)[source]¶
Bases:
Vector
patch.objects module¶
- class patch.objects.IClamp(*args, **kwargs)[source]¶
Bases:
PythonHocObject- property amplitude: float¶
Get the amplitude during current injection.
- property duration: float¶
Get the duration of the current injection.
- class patch.objects.NetCon(*args, **kwargs)[source]¶
Bases:
PythonHocObject- property threshold¶
- class patch.objects.NetStim(interpreter: PythonHocInterpreter, ptr)[source]¶
Bases:
PythonHocObject,Connectable
- class patch.objects.PointProcess(interpreter: PythonHocInterpreter, ptr)[source]¶
Bases:
PythonHocObject,Connectable,WrapsPointersWrapper for all point processes (membrane and synapse mechanisms).
- class patch.objects.PythonHocObject(interpreter: PythonHocInterpreter, ptr)[source]¶
Bases:
object
- class patch.objects.SEClamp(*args, **kwargs)[source]¶
Bases:
PythonHocObject- property after¶
Get the duration of the period after clamping during which the holding potential is clamped.
- property delay¶
Get the delay period from 0ms to delay ms during which the holding potential is clamped.
- property duration¶
Get the duration of the command potential clamping period.
- property holding¶
Get the holding potential that is active before and after the step period.
- property voltage¶
- class patch.objects.Section(interpreter: PythonHocInterpreter, ptr)[source]¶
Bases:
PythonHocObject,Connectable,WrapsPointers- add_3d(points, diameters=None)[source]¶
Add new 3D points to this section xyz data.
- Parameters:
points – A 2D array of xyz points.
diameters (float | list[float]) – A scalar or array of diameters corresponding to the points. Default value is the section diameter.
- connect_synapse(target, **kwargs)[source]¶
Connect a Segment of this Section to a target.
Usually used to connect the membrane potential to a point process.
- iclamp(amplitude: float = 1, *, x: float = 0.5, delay: float = 0, duration: float = 100) IClamp[source]¶
Create a current clamp on the section.
- Parameters:
x (float) – Location along the segment from 0 to 1.
delay (float) – Duration of the pre-step holding interval, from 0 to delay ms.
duration (float) – Duration of the step interval, from delay to delay + duration ms.
amplitude (float | list[float]) – Can be a single value to define the current during the step (delay to delay + duration ms), or a sequence to play after delay ms. This will play 1 value of the sequence into the clamp per timestep.
- Returns:
The current clamp placed in the section.
- Return type:
- property parent¶
Returns the parent of the Section, or
None
- property points¶
Return the 3d point information associated to this section.
- push()[source]¶
Return a context manager that pushes this Section onto the section stack and takes it off when the context is exited.
- record(x=None)[source]¶
Record the Section at a certain point.
- Parameters:
x (float) – Arcpoint, defaults to
__arc__if omitted.
- set_dimensions(length, diameter)[source]¶
Set the length and diameter of the piece of cable this Section will represent in the simulation.
- set_segments(segments)[source]¶
Set the number of discrete points where equations are solved during simulation.
- synapse(factory, *args, store=False, attributes=None, **kwargs)[source]¶
Insert a synapse into the Section.
- Parameters:
factory (Callable) – Callable that creates a point process, is given the Section as first argument and passes on all other args.
store (bool) – Store the synapse on the Section in a
synapsesattribute.
- vclamp(voltage: float = -70, *, x: float = 0.5, before: float = 0, duration: float = 100, after: float = 0, holding=-70) SEClamp[source]¶
Create a voltage clamp on the section.
- Parameters:
x (float) – Location along the segment from 0 to 1.
before (float) – Duration of the pre-step holding interval, from 0 to delay ms.
duration (float) – Duration of the step interval, from delay to delay + duration ms.
after (float) – Duration of the post-step holding interval, from delay + duration to delay + duration + after ms.
voltage (float | list[float]) – Can be a single value to define the voltage during the step (delay to delay + duration ms), or 3 values to define the pre-step, step and post-step voltages altogether.
holding (float) – If voltage is a single value, holding is used for the pre-step and post-step voltages.
- Returns:
The single electrode voltage clamp placed in the section.
- Return type:
- class patch.objects.SectionRef(interpreter: PythonHocInterpreter, ptr)[source]¶
Bases:
PythonHocObject- property child¶
- class patch.objects.Segment(interpreter, ptr, section, **kwargs)[source]¶
Bases:
PythonHocObject,Connectable,WrapsPointers
- class patch.objects.VecStim(interpreter: PythonHocInterpreter, ptr)[source]¶
Bases:
PythonHocObject,Connectable- property pattern¶
- property vector¶
- class patch.objects.Vector(interpreter: PythonHocInterpreter, ptr)[source]¶
Bases:
PythonHocObject
Module contents¶
Quality of life patch for the NEURON simulator.
- patch.h: PythonHocInterpreter = <patch.interpreter.PythonHocInterpreter object>¶
- patch.is_density_mechanism(obj: str | neuron.hoc.HocObject)[source]¶
Check if obj is a (name of a) DensityMechanism on the
HocInterpreter.- Parameters:
obj – HocObject or name of the DensityMechanism to look for. Needs to be a known attribute of
neuron.h.- Return type:
bool
- patch.is_point_process(obj: str | neuron.hoc.HocObject)[source]¶
Check if obj is a (name of a) PointProcess on the
HocInterpreter.- Parameters:
obj – HocObject or name of the PointProcess to look for. Needs to be a known attribute of
neuron.h.- Return type:
bool
- patch.p: PythonHocInterpreter = <patch.interpreter.PythonHocInterpreter object>¶
- patch.transform_arc(obj, *args, **kwargs)[source]¶
Get an arclength object on a NEURON object.
Calls the
__arc__magic method on the callable object if present, otherwise returns the transformed object.