Skip to content

Commit 6b3031c

Browse files
authored
docs: update docs on NMODL, read_morphology (#520)
2 parents bd64ab3 + 9f6d710 commit 6b3031c

3 files changed

Lines changed: 19 additions & 21 deletions

File tree

docs/bibliography.bib

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,6 @@ @Inbook{COBYLA
114114
doi="10.1007/978-94-015-8330-5_4",
115115
url="https://doi.org/10.1007/978-94-015-8330-5_4"
116116
}
117+
118+
119+
@article{MODL, title={A block organized model builder}, volume={19}, ISSN={0895-7177}, DOI={10.1016/0895-7177(94)90190-2}, abstractNote={A new language has been developed for defining simulation models for biomedical science and implemented as a preprocessor for SCoP1 (Simulation Control Program) written by the National Biomedical Simulation Resource. The preprocessor creates a C program by translation of statements in a model definition file. The language defines variables and equations in labelled blocks of statements which are either mathematical equations or English phrases. The availability of several kinds of equation definition blocks simplifies the description of the corresponding classes of equations. Sub-blocks are provided for some special operations, such as logical tests. Algebraic logical operators are included. Special statements called directives instruct the preprocessor to create specific variables or generate code to call specific numerical methods routines from SCoP’s library. Models may be decomposed into sub-models stored on separate model definition files and automatically assembled by the preprocessor in hierarchical fashion. The model description language has been implemented in the C language by generating machine independent code with the Unix lex and yacc programs. An example of the use of the model description language, including hierarchical assembly, is illustrated by a model of the human ovulatory cycle.}, number={6}, journal={Mathematical and Computer Modelling}, author={Kohn, M. C. and Hines, M. L. and Kootsey, J. M. and Feezor, M. D.}, year={1994}, month=mar, pages={75–97} }

docs/file_formats.rst

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,10 @@ Note that the mechanism name in :ref:`mod_file_format` files are defined in the
100100
.. seealso::
101101
The :ref:`mod_file_format` file documentation for how these files are structured.
102102

103-
Each range mechanism must have the key ``spatial``, and its value must match one of the supported spatial profiles in ISF. All spatial profiles except for ``"uniform"`` require additional parameters that need to be defined for a given range mechanism. E.g. the exponential profile expects the parameters ``offset``, ``linScale``, ``_lambda``, ``xOffset``. Distances for these spatial profiles are calculated in terms of distance to soma.
103+
Each range mechanism must have the key ``spatial``, and its value must match one of the supported spatial profiles in ISF. All spatial profiles except for ``"uniform"`` require additional parameters that need to be defined for a given range mechanism. E.g. the exponential profile expects the parameters ``offset``, ``linScale``, ``_lambda``, ``xOffset``.
104+
Distances for these spatial profiles are calculated in terms of distance to soma.
104105
If ``"distance": "relative"`` is passed for a range mechanism, the distance dependency is scaled by the maximum distance of all sections with the same label. E.g. for a simple dendrite, this means that all distance metrics are scaled with the length of the longest dendrite. This is useful for setting scaling parameters without necessarily having to worry about the exact dimensions of the neurites beforehand.
105-
Spatial profiles are evaluated on a segment-by-segment basis: the segment center is used as the distance dependency of each spatial profile, and channels are uniform within a single segment.
106+
Spatial profiles are evaluated on a segment-by-segment basis: the segment center is used as the distance dependency of each spatial profile, and neuron parameters are uniform within a single segment.
106107

107108
.. seealso::
108109
:meth:`~single_cell_parser.cell_parser.CellParser.insert_range_mechanisms` for an overview of the available spatial profiles for range mechanisms.
@@ -897,21 +898,21 @@ Example::
897898

898899
.mod
899900
****
900-
``MODL`` is a file format Used to define dynamical systems as simply as reasonably possible.
901-
NEURON :cite:t:`hines2001neuron` provides an extension to this format called ``NMODL``, in this
902-
case to define channel and synapse dynamics for use in NEURON simulations.
903-
NEURON translates these files to ``C`` (and to ``C++`` since NEURON 9.0), to be compiled to machine code on the host machine.
901+
``MODL`` ("MOdel Description Language") is a file format developed at the National Biomedical Simulation Resource, intended to define physical systems as simultaneous algebraic equations :cite:`MODL`.
902+
NEURON :cite:`hines2001neuron` provides an extension to this format called ``NMODL`` ("Neuron MODL"), in this
903+
case to define channel and synapse dynamics per neuronal compartment for use in NEURON simulations.
904+
The NEURON simulation environment provides translators and compilers (``nrnivmodl`` for UNIX, ``nrnmkdll`` for Windows) to translate these files to ``C`` (and to ``C++`` since NEURON 9.0), and to compile the resulting C/C++ to machine code on the host machine.
904905

905-
``NMODL`` files are categorized in blocks.
906+
``MODL``/``NMODL`` files are categorized in blocks.
906907
We highlight some important ones below:
907908

908909
.. list-table::
909910

910911
* - NEURON
911-
- NEURON :cite:t:`hines2001neuron` specific specification, such as ``READ`` and ``WRITE`` statements,
912-
defining which global variables this particular mechanism needs access to (e.g. intracellular :math:`Ca^{2+}` for :math:`Ca^{2+}`-activated channels).
912+
- NEURON :cite:`hines2001neuron` specific specification, such as ``READ`` and ``WRITE`` statements,
913+
defining which segment-wide shared variables this particular mechanism needs access to (e.g. :math:`Ca^{2+}`-activated channels and buffers both need access to the intracellular :math:`Ca^{2+}` concentration).
913914
The mechanism's name is defined as either a ``SUFFIX`` or ``POINTPROCESS`` in this block.
914-
This is the name that will be accessible by the user, and how NEURON will register it in the NEURON or Python namespace.
915+
This is the name that will be accessible by the user in :ref:`cell_parameters_format`, and how NEURON will register it in the NEURON or Python namespace.
915916
* - PARAMETER
916917
- Free parameters used in this mechanism.
917918
These are the parameters the user has direct access to, and can be tweaked during optimization or exploration.
@@ -1025,11 +1026,6 @@ Example:
10251026
if they exist in the NEURON namespace.
10261027

10271028

1028-
1029-
1030-
1031-
1032-
10331029
.. _am_file_format:
10341030

10351031
.am

single_cell_parser/io/morphology/__init__.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@
1919
This module specifies converters between :ref:`swc_file_format` and :ref:`hoc_file_format` morphologies.
2020
"""
2121
from __future__ import annotations
22-
from typing import List, Dict, Any
23-
import numpy as np
24-
from data_base.dbopen import dbopen
2522
from config.isf_logging import get_isf_logger
26-
from typing import Optional
2723
from .hoc import read_hoc, write_hoc
2824
from .swc import read_swc
2925
from pathlib import Path
@@ -36,10 +32,13 @@ def read_morphology(
3632
):
3733
"""Read a morphology in :ref:`hoc_file_format` or :ref:`swc_file_format` format.
3834
39-
This function is a simply strategy pattern to decide which reader to use.
35+
This function is simply a strategy pattern to decide which reader to use:
36+
37+
- :meth:`~single_cell_parser.io.morphology.hoc.read_hoc`
38+
- :meth:`~single_cell_parser.io.morphology.swc.read_swc`
4039
4140
Args:
42-
fn (str|:class:`~Path`): Name of the morphology file.
41+
fn (str | :class:`~pathlib.Path`): Name of the morphology file.
4342
4443
Returns:
4544
List[_Edge]: List of :class:`~_Edge` objects for further parsing, usually by :meth:`~CellParser.spatialgraph_to_cell`

0 commit comments

Comments
 (0)