Skip to content

Commit

Permalink
New LFPy logo, some docstring fixes (#421)
Browse files Browse the repository at this point in the history
* compartment->segment

* code-generated LFPy logo

* logo in docs
  • Loading branch information
espenhgn committed Apr 13, 2022
1 parent 2b065ea commit 6db2d13
Show file tree
Hide file tree
Showing 10 changed files with 9,572 additions and 30 deletions.
10 changes: 5 additions & 5 deletions LFPy/alias_method.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ cpdef np.ndarray[long, ndim=1, negative_indices=False] alias_method(
Parameters
----------
idx: np.ndarray
compartment indices as array of ints
segment indices as array of ints
probs: np.ndarray
compartment areas as array of floats
segment areas as array of floats
nsyn: int
number of randomized compartment indices
number of randomized segment indices
Returns
-------
out: np.ndarray
integer array of randomly drawn compartment indices
integer array of randomly drawn segment indices
"""
assert idx.size == probs.size, 'length of idx and probs arrays must be equal'
Expand Down Expand Up @@ -77,7 +77,7 @@ cpdef alias_setup(np.ndarray[DTYPE_t, ndim=1, negative_indices=False] probs):
Parameters
----------
probs: np.ndarray
float array of compartment areas
float array of segment areas

Returns
-------
Expand Down
26 changes: 13 additions & 13 deletions LFPy/cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class Cell(object):
tstop: float
Stop time for simulation > 0 ms. Defaults to 100 ms.
nsegs_method: 'lambda100' or 'lambda_f' or 'fixed_length' or None
nseg rule, used by NEURON to determine number of compartments.
nseg rule, used by NEURON to determine number of segments.
Defaults to 'lambda100'
max_nsegs_length: float or None
Maximum segment length for method 'fixed_length'. Defaults to None
Expand Down Expand Up @@ -529,7 +529,7 @@ def set_synapse(self, idx, syntype,
Parameters
----------
idx: int
Index of compartment where synapse is inserted
Index of segment where synapse is inserted
syntype: str
Type of synapse. Built-in types in NEURON: ExpSyn, Exp2Syn
record_current: bool
Expand Down Expand Up @@ -607,7 +607,7 @@ def set_point_process(self, idx, pptype, record_current=False,
Parameters
----------
idx: int
Index of compartment where point process is inserted
Index of segment where point process is inserted
pptype: str
Type of pointprocess. Examples: SEClamp, VClamp,
IClamp, SinIClamp, ChirpIClamp
Expand Down Expand Up @@ -708,7 +708,7 @@ def _collect_geometry(self):

def get_idx(self, section='allsec', z_min=-np.inf, z_max=np.inf):
"""
Returns compartment idx of segments from sections with names that match
Returns segment idx of segments from sections with names that match
the pattern defined in input section on interval [z_min, z_max].
Parameters
Expand Down Expand Up @@ -908,7 +908,7 @@ def enable_extracellular_stimulation(
mechanism. Extracellular potentials are computed from electrode
currents using the point-source approximation.
If ``model`` is ``'inf'`` (default), potentials are computed as
(:math:`r_i` is the position of a compartment :math:`i`,
(:math:`r_i` is the position of a segment :math:`i`,
:math:`r_n` is the position of an electrode :math:`n`,
:math:`\\sigma` is the conductivity of the medium):
Expand Down Expand Up @@ -1006,7 +1006,7 @@ def simulate(self, probes=None,
probes: list of :obj:, optional
None or list of LFPykit.RecExtElectrode like object instances that
each have a public method `get_transformation_matrix` returning
a matrix that linearly maps each compartments' transmembrane
a matrix that linearly maps each segments' transmembrane
current to corresponding measurement as
.. math:: \\mathbf{P} = \\mathbf{M} \\mathbf{I}
Expand Down Expand Up @@ -1845,7 +1845,7 @@ def get_intersegment_distance(self, idx0=0, idx1=0):
raise ValueError(ERRMSG)

def get_idx_children(self, parent="soma[0]"):
"""Get the idx of parent's children sections, i.e. compartments ids
"""Get the idx of parent's children sections, i.e. segments ids
of sections connected to parent-argument
Parameters
Expand Down Expand Up @@ -1952,7 +1952,7 @@ def get_idx_name(self, idx=np.array([0], dtype=int)):
# ensure all idx are valid
if np.any(idx >= self.totnsegs):
wrongidx = idx[np.where(idx >= self.totnsegs)]
raise Exception('idx %s >= number of compartments' % str(wrongidx))
raise Exception('idx %s >= number of segments' % str(wrongidx))

# create list of seg names:
allsegnames = []
Expand Down Expand Up @@ -2306,13 +2306,13 @@ def get_idx_polygons(self, projection=('x', 'z')):
def insert_v_ext(self, v_ext, t_ext):
"""Set external extracellular potential around cell.
Playback of some extracellular potential v_ext on each cell.totnseg
compartments. Assumes that the "extracellular"-mechanism is inserted
on each compartment.
segments. Assumes that the "extracellular"-mechanism is inserted
on each segment.
Can be used to study ephaptic effects and similar
The inputs will be copied and attached to the cell object as
cell.v_ext, cell.t_ext, and converted
to (list of) neuron.h.Vector types, to allow playback into each
compartment e_extracellular reference.
segment e_extracellular reference.
Can not be deleted prior to running cell.simulate()
Parameters
Expand Down Expand Up @@ -2531,7 +2531,7 @@ def get_axial_currents_from_vmem(self, timepoints=None):

def get_axial_resistance(self):
"""
Return NEURON axial resistance for all cell compartments.
Return NEURON axial resistance for all cell segments.
Returns
-------
Expand Down Expand Up @@ -2692,7 +2692,7 @@ def distort_geometry(self, factor=0., axis='z', nu=0.0):
the neuron geometry along each axis.
This method does not affect the underlying cable properties of the
cell, only predictions of extracellular measurements (by affecting the
relative locations of sources representing the compartments).
relative locations of sources representing the segments).
Parameters
----------
Expand Down
4 changes: 2 additions & 2 deletions LFPy/eegmegcalc.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def get_dipole_potential_from_multi_dipoles(self, cell, timepoints=None):
By multiple current dipoles we mean the dipoles computed from all
axial currents in a neuron simulation, typically two
axial currents per compartment, except for the root compartment.
axial currents per segment, except for the root segment.
Parameters
----------
Expand Down Expand Up @@ -215,7 +215,7 @@ def get_multi_dipole_potential(self, cell,
The multiple current dipoles corresponds to dipoles computed from all
axial currents in a neuron simulation, typically two
axial currents per compartment, excluding the root compartment.
axial currents per segment, excluding the root segment.
Parameters
----------
Expand Down
10 changes: 5 additions & 5 deletions LFPy/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class NetworkCell(TemplateCell):
tstop: float
stop time for simulation > 0 ms. Defaults to 100.
nsegs_method: 'lambda100' or 'lambda_f' or 'fixed_length' or None
nseg rule, used by NEURON to determine number of compartments.
nseg rule, used by NEURON to determine number of segments.
Defaults to 'lambda100'
max_nsegs_length: float or None
max segment length for method 'fixed_length'. Defaults to None
Expand Down Expand Up @@ -773,7 +773,7 @@ def connect(self, pre, post, connectivity,
``weight`` connection weight, ``delay`` connection delay,
``sec`` section name, ``sec.x`` relative location on section,
and ``x``, ``y``, ``z`` the corresponding
midpoint coordinates of the target compartment.
midpoint coordinates of the target segment.
Returns
-------
Expand Down Expand Up @@ -1012,7 +1012,7 @@ def enable_extracellular_stimulation(self, electrode, t_ext=None, n=1,
mechanism. Extracellular potentials are computed from electrode
currents using the point-source approximation.
If ``model`` is ``'inf'`` (default), potentials are computed as
(:math:`r_i` is the position of a compartment :math:`i`,
(:math:`r_i` is the position of a segment :math:`i`,
:math:`r_n` is the position of an electrode :math:`n`,
:math:`\\sigma` is the conductivity of the medium):
Expand Down Expand Up @@ -1076,7 +1076,7 @@ def simulate(self, probes=None,
probes: list of :obj:, optional
None or list of LFPykit.RecExtElectrode like object instances that
each have a public method `get_transformation_matrix` returning
a matrix that linearly maps each compartments' transmembrane
a matrix that linearly maps each segments' transmembrane
current to corresponding measurement as
.. math:: \\mathbf{P} = \\mathbf{M} \\mathbf{I}
Expand Down Expand Up @@ -1394,7 +1394,7 @@ def __run_simulation_with_probes(self, cvode,
probes: list of :obj:, optional
None or list of LFPykit.RecExtElectrode like object instances that
each have a public method `get_transformation_matrix` returning
a matrix that linearly maps each compartments' transmembrane
a matrix that linearly maps each segments' transmembrane
current to corresponding measurement as
.. math:: \\mathbf{P} = \\mathbf{M} \\mathbf{I}
Expand Down
4 changes: 2 additions & 2 deletions LFPy/pointprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,9 @@ class StimIntElectrode(PointProcess):
such as VClamp, SEClamp and ICLamp.
Membrane currents will no longer sum to zero if these mechanisms are used,
as the equivalent circuit is akin to a current input to the compartment
as the equivalent circuit is akin to a current input to the segment
from a far away extracellular location ("ground"), not immediately from
the surface to the inside of the compartment as with transmembrane
the surface to the inside of the segment as with transmembrane
currents.
Refer to NEURON documentation @ neuron.yale.edu for keyword arguments or
Expand Down
2 changes: 1 addition & 1 deletion LFPy/templatecell.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class TemplateCell(Cell):
tstop : float
stop time for simulation > 0 ms. Defaults to 100.
nsegs_method : 'lambda100' or 'lambda_f' or 'fixed_length' or None
nseg rule, used by NEURON to determine number of compartments.
nseg rule, used by NEURON to determine number of segments.
Defaults to 'lambda100'
max_nsegs_length : float or None
max segment length for method 'fixed_length'. Defaults to None
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Information

LFPy provides a set of easy-to-use Python classes for setting up your model, running your simulations and calculating the extracellular potentials arising from activity in your model neuron. If you have a model working in NEURON (www.neuron.yale.edu) already, it is likely that it can be adapted to work with LFPy.

The extracellular potentials are calculated from transmembrane currents in multi-compartment neuron models using the line-source method (Holt & Koch, J Comp Neurosci 1999),
The extracellular potentials are calculated from transmembrane currents in multicompartment neuron models using the line-source method (Holt & Koch, J Comp Neurosci 1999),
but a simpler point-source method is also available. The calculations assume that the neuron are surrounded by an infinite extracellular medium with homogeneous and frequency
independent conductivity, and compartments are assumed to be at least at a minimal distance from the electrode (which can be specified by the user). For more information on
the biophysics underlying the numerical framework used see this coming book chapter:
Expand Down

0 comments on commit 6db2d13

Please sign in to comment.