Separated MechanismType file and code#176
Merged
Merged
Conversation
>>> from neuron import h
>>> s = h.Section(name='s')
>>> mt = h.MechanismType(0)
>>> dir(mt)
['__bool__', '__call__', '__class__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__module__', '__ne__', '__new__', '__next__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__setstate__', '__sizeof__', '__str__', '__subclasshook__', 'action', 'baseattr', 'code', 'count', 'file', 'has_net_event', 'hname', 'hocobjptr', 'internal_type', 'is_artificial', 'is_netcon_target', 'make', 'menu', 'pp_begin', 'pp_next', 'remove', 'same', 'select', 'selected']
>>> mt.select('hh')
0.0
>>> mt.file()
'hh.mod'
>>> print('\n'.join(mt.code().split('\n')[:4]))
TITLE hh.mod squid sodium, potassium, and leak channels
COMMENT
This is the original Hodgkin-Huxley treatment for the set of sodium,
nrnhines
added a commit
that referenced
this pull request
Apr 1, 2019
* Text of nmodl file available if a mechanism. * MechanismType.code() returns the text of the mod file of the selected mechanism. If there is no mod file for the implementation, returns "". Note the first line of the code is the name of the modfile. * Separated MechanismType file and code (#176) >>> from neuron import h >>> s = h.Section(name='s') >>> mt = h.MechanismType(0) >>> dir(mt) ['__bool__', '__call__', '__class__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__module__', '__ne__', '__new__', '__next__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__setstate__', '__sizeof__', '__str__', '__subclasshook__', 'action', 'baseattr', 'code', 'count', 'file', 'has_net_event', 'hname', 'hocobjptr', 'internal_type', 'is_artificial', 'is_netcon_target', 'make', 'menu', 'pp_begin', 'pp_next', 'remove', 'same', 'select', 'selected'] >>> mt.select('hh') 0.0 >>> mt.file() 'hh.mod' >>> print('\n'.join(mt.code().split('\n')[:4])) TITLE hh.mod squid sodium, potassium, and leak channels COMMENT This is the original Hodgkin-Huxley treatment for the set of sodium, * NMODL_TEXT nmodl_filename is the full path from realpath. * NMODL_TEXT for INCLUDE "fname" comments the INCLUDE line with :::, adds a ::: commented full path line if realpath available, inserts the text of the INCLUDE file, and closes the text with a ::: commented "end INCLUDE fname" line.
olupton
pushed a commit
that referenced
this pull request
Dec 7, 2022
* Allow json printer to embed NMODL in the JSON ast Change-Id: Id3a38a67a104c85b1771638e31d6071e310483c7 * explicit about params in python test Change-Id: I410cd04f8a0c264638c158333858b95bc949259a
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Example:
from neuron import hs = h.Section(name='s')mt = h.MechanismType(0)mt.select('hh')print(mt.file()) # prints: hh.modprint('\n'.join(mt.code().split('\n')[:4]))"""
prints:
TITLE hh.mod squid sodium, potassium, and leak channels
COMMENT
This is the original Hodgkin-Huxley treatment for the set of sodium,
"""