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_point_process(name)[source]¶
Check if a PointProcess with
name
exists on theHocInterpreter
.- Parameters
name (str) – Name of the PointProcess to look for. Needs to be a known attribute of
neuron.h
.- Returns
Whether an attribute with
name
exists onneuron.h
and has functions matching those expected to be present on aPointProcess
.- 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:
patch.objects.PythonHocObject
- broadcast(data, root=0)[source]¶
Broadcast either a Vector or arbitrary picklable data. If
data
is a Vector, the Vectors are resized and filled with the data from the Vector in theroot
node. Ifdata
is not a Vector, it is pickled, transmitted and returned from this function to all nodes.- Parameters
data (
Vector
or 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.HocObjects
that aren’t Vectors are transmitted
- setup_transfer(*args, **kwargs)¶
- source_var(*args, **kwargs)¶
- target_var(*args, **kwargs)¶
patch.objects module¶
- class patch.objects.IClamp(interpreter, ptr)[source]¶
Bases:
patch.objects.PythonHocObject
,patch.objects.WrapsPointers
- class patch.objects.NetStim(*args, **kwargs)[source]¶
Bases:
patch.objects.PythonHocObject
,patch.objects.Connectable
- class patch.objects.PointProcess(*args, **kwargs)[source]¶
Bases:
patch.objects.PythonHocObject
,patch.objects.Connectable
,patch.objects.WrapsPointers
Wrapper for all point processes (membrane and synapse mechanisms).
- class patch.objects.PythonHocObject(interpreter, ptr)[source]¶
Bases:
object
- class patch.objects.SEClamp(interpreter, ptr)[source]¶
Bases:
patch.objects.PythonHocObject
,patch.objects.WrapsPointers
- class patch.objects.Section(*args, **kwargs)[source]¶
Bases:
patch.objects.PythonHocObject
,patch.objects.Connectable
,patch.objects.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 or array) – A scalar or array of diameters corresponding to the points. Default value is the section diameter.
- connect_points(target, x=None, **kwargs)[source]¶
Connect a Segment of this Section to a target. Usually used to connect the membrane potential to a point process.
- iclamp(x=0.5, delay=0, duration=100, amplitude=0)[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 (Union[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, **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
synapses
attribute.
- vclamp(x=0.5, delay=0, duration=100, after=0, voltage=- 70, holding=- 70)[source]¶
Create a voltage 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.
after (float) – Duration of the post-step holding interval, from delay + duration to delay + duration + after ms.
voltage (Union[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, ptr)[source]¶
Bases:
patch.objects.PythonHocObject
- property child¶
- class patch.objects.Segment(interpreter, ptr, section, **kwargs)[source]¶
Bases:
patch.objects.PythonHocObject
,patch.objects.Connectable
,patch.objects.WrapsPointers
- class patch.objects.VecStim(*args, **kwargs)[source]¶
Bases:
patch.objects.PythonHocObject
,patch.objects.Connectable
- property pattern¶
- property vector¶