Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve NodeList support for different region types #1280

Closed
adamjhn opened this issue May 15, 2021 · 0 comments · Fixed by #2780
Closed

Improve NodeList support for different region types #1280

adamjhn opened this issue May 15, 2021 · 0 comments · Fixed by #2780
Assignees
Labels
bug improvement Improvement over existing implementation rxd reaction-diffusion

Comments

@adamjhn
Copy link
Member

adamjhn commented May 15, 2021

Context

NodeList calls should only raise an error if all of the nodes can not test the condition. Currently it raises an error if any of the nodes can not test the condition.

Overview of the issue

For example, this gives an error, because NodeExtracellular doesn't support _in_sec method;

from neuron import h, rxd
sec = h.Section(name='sec')
cyt = rxd.Region(h.allsec())
ecs = rxd.Extracellular(-10, -10, -10, 10, 10, 10, dx=10)
k = rxd.Species([ecs,cyt],name='k', charge=1)
nd = k.nodes(sec)
print(nd.x)

Expected result/behavior

I'd expect calls to NodeList to only give an error when all of the node give an error, so the above would return an list containing one node for k in sec(0.5), so would print;

[0.5]

NEURON setup

  • Version: master branch
  • Installation method cmake build
  • OS + Version: Ubuntu 18.04.5
  • Compiler + Version: gcc 8.4.0

Minimal working example - MWE

from neuron import h, rxd
sec = h.Section(name='sec')
cyt = rxd.Region(h.allsec())
ecs = rxd.Extracellular(-10, -10, -10, 10, 10, 10, dx=10)
k = rxd.Species([ecs,cyt],name='k', charge=1)
nd = k.nodes(sec)
  • CMake build commands:
git clone git@github.com:neuronsimulator/nrn.git
mkdir -p build/install && cd build
cmake -DNRN_ENABLE_CORENEURON=OFF -DNRN_ENABLE_PYTHON=ON -DPYTHON_EXECUTABLE=`which python3` -DNRN_ENABLE_TESTS=ON -DNRN_ENABLE_MPI=OFF -DNRN_ENABLE_RX3D=ON -DNRN_ENABLE_INTERVIEWS=ON -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_INSTALL_PREFIX=`pwd`/install ..
cmake --build . --
>>> from neuron import h, rxd
>>> sec = h.Section(name='sec')
>>> cyt = rxd.Region(h.allsec())
>>> ecs = rxd.Extracellular(-10, -10, -10, 10, 10, 10, dx=10)
>>> k = rxd.Species([ecs,cyt],name='k', charge=1)
>>> nd = k.nodes(sec)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/adam/neuron/nrn.ns/build/install/lib/python/neuron/rxd/nodelist.py", line 9, in __call__
    return NodeList([i for i in self if i.satisfies(restriction)])
  File "/home/adam/neuron/nrn.ns/build/install/lib/python/neuron/rxd/nodelist.py", line 9, in <listcomp>
    return NodeList([i for i in self if i.satisfies(restriction)])
  File "/home/adam/neuron/nrn.ns/build/install/lib/python/neuron/rxd/node.py", line 801, in satisfies
    raise RxDException("unrecognized node condition: %r" % condition)
neuron.rxd.rxdException.RxDException: unrecognized node condition: sec
@adamjhn adamjhn added bug improvement Improvement over existing implementation rxd reaction-diffusion labels May 15, 2021
@ramcdougal ramcdougal self-assigned this May 27, 2023
rgourdine added a commit that referenced this issue Mar 15, 2024
pramodk pushed a commit that referenced this issue May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug improvement Improvement over existing implementation rxd reaction-diffusion
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants