Bug fix for detecting ION channel type in LoadBalance#2310
Merged
Conversation
- loadbal.hoc was checking existance of `_ion` to
determine if a given mechanism is ion type.
- this was causing runtime error if `SUFFIX` has
names like `SUFFIX internal_ions` was causing a runtime
error like:
```
... internal_ions is not an ion
0 LoadBalance[0].ion_style("internal_ions", 3, 2, 1, 1, 0)
```
- with this PR, introduce a `is_ion()` method is MechanismType
class to robustly check if a particular channel is of type
ION.
- add hoc and python test
pramodk
commented
Mar 29, 2023
|
✔️ 67078f2 -> Azure artifacts URL |
This comment has been minimized.
This comment has been minimized.
alexsavulescu
approved these changes
Mar 29, 2023
This comment has been minimized.
This comment has been minimized.
nrnhines
approved these changes
Mar 29, 2023
nrnhines
left a comment
Member
There was a problem hiding this comment.
Tested this with
from neuron import h
h.ion_register("hello_ion_foo", -3)
def test():
mt = h.MechanismType(0)
sref = h.ref("")
for i in range(mt.count()):
mt.select(i)
mt.selected(sref)
print (i, sref[0], mt.is_ion())
test()
and it gives the correct output
0 morphology False
1 capacitance False
2 pas False
3 extracellular False
4 fastpas False
5 na_ion True
6 k_ion True
7 hh False
8 hello_ion_foo_ion True
Only missing thing is a doc in docs/python/modelspec/programmatic/mechanism.rst
Codecov Report
@@ Coverage Diff @@
## master #2310 +/- ##
=======================================
Coverage 58.79% 58.79%
=======================================
Files 625 625
Lines 119912 119918 +6
=======================================
+ Hits 70498 70504 +6
Misses 49414 49414
... and 2 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
|
✔️ afb6505 -> Azure artifacts URL |
|
✔️ d046c0d -> Azure artifacts URL |
Collaborator
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.
_ionto determine if a given mechanism is ion type.SUFFIXhas names likeSUFFIX internal_ionslike:... internal_ions is not an ion 0 LoadBalance[0].ion_style("internal_ions", 3, 2, 1, 1, 0)is_ion()method inMechanismTypeclass to robustly check if a particular channel is of type ION.