Search found 205 matches

by ramcdougal
Wed Jan 29, 2020 8:07 pm
Forum: NEURON + Python
Topic: Rset or reboot neuron without exist in python
Replies: 6
Views: 1347

Re: Rset or reboot neuron without exist in python

h.finitialize() resets a model (if the mod files, etc were setup right) but it does not reset the simulator . importlib.reload will have no useful effect. It will not cause Sections to disappear, it will not reset the temperature, etc. It's basically only useful for modules that are themselves writ...
by ramcdougal
Wed Jan 29, 2020 12:31 am
Forum: Adding new mechanisms and functions to NEURON
Topic: Interfacing NEURON with other software on runtime
Replies: 4
Views: 500

Re: Interfacing NEURON with other software on runtime

Your specific code doesn't work because you are evaluating the function foo(ns) at the time of your callback (it returns None) and that's what's being set as your callback. (By the order of operations, we evaluate foo(ns) before calling set_callback.) You could fix this by passing in a lambda that e...
by ramcdougal
Fri Jan 17, 2020 9:00 am
Forum: NEURON + Python
Topic: Dynamically accessing vectors in python (_ref_x)
Replies: 5
Views: 524

Re: Dynamically accessing vectors in python (_ref_x)

Think of these things with [] as an array of sections; what that means is that the object you getattr is the array, not any individual section. i.e. do something like this: >>> from neuron import h >>> h('create axon[6]') 1 >>> getattr(h, 'axon')[5] axon[5] >>> sec = getattr(h, 'axon')[5] >>> ptr = ...
by ramcdougal
Tue Jan 14, 2020 4:41 pm
Forum: UNIX/Linux
Topic: Failed to run neuron inside virtual environment in Ubuntu18 with Anaconda (PATH issue?)
Replies: 3
Views: 1000

Re: Failed to run neuron inside virtual environment in Ubuntu18 with Anaconda (PATH issue?)

Do you have root access? Assuming so, when you installed with dpkg, I believe you meant for PYTHONPATH to start with /usr/ not with /home/usr/ That worked for me in Ubuntu 19.04: (base) robert@robert-VirtualBox:~/anaconda3/envs/my_env$ cd (base) robert@robert-VirtualBox:~$ conda activate my_env (my_...
by ramcdougal
Mon Jan 13, 2020 2:00 pm
Forum: NEURON + Python
Topic: Dynamically accessing vectors in python (_ref_x)
Replies: 5
Views: 524

Re: Dynamically accessing vectors in python (_ref_x)

I believe you're looking for Python's getattr function: You can get a pointer to the membrane potential at the center of the soma via: ptr = getattr(soma(0.5), '_ref_v') (Here, I'm assuming "soma" is a Python Section object... adjust accordingly for HOC variables, which you can also get by name with...
by ramcdougal
Mon Jan 13, 2020 1:43 pm
Forum: NEURON + Python
Topic: different section names, morphology - h.Section
Replies: 2
Views: 399

Re: different section names, morphology - h.Section

Specify the name attribute when creating a section to give them meaningful names: soma = h.Section(name='soma') Specify both name and cell (and give the cell a reasonable __repr__) for meaningful dot notation: from neuron import h class MyCell: def __repr__(self): return 'MyCell[{}]'.format(self._id...
by ramcdougal
Mon Jan 13, 2020 12:39 pm
Forum: NEURON + Python
Topic: Finding middle of a section
Replies: 4
Views: 450

Re: Finding middle of a section

So it's best to call h.define_shape() preemptively, right after all sections have been created, connected, assigned their geometries via L and diam or pt3dadd statements, and their nseg parameters have been set. And after you do that, every section will have its own pt3d data that will include the ...
by ramcdougal
Mon Jan 13, 2020 11:38 am
Forum: NEURON + Python
Topic: Finding middle of a section
Replies: 4
Views: 450

Re: Finding middle of a section

Neither of those strategies necessarily identifies the coordinates of the center of the section. The second solution doesn't necessarily lead to a point on the section (consider a circular section with evenly spaced 3D points; it would find the center of the circle). The explanation is simple: 3D po...
by ramcdougal
Fri Jan 03, 2020 12:59 pm
Forum: Reaction-diffusion in NEURON
Topic: Cell membrane with PMCA pump
Replies: 3
Views: 541

Re: Cell membrane with PMCA pump

Are you trying to do this with a network model or a single cell? Do you care what happens to the extracellular concentration or do you want to treat that as constant? A way of doing this is to an rxd.Extracellular domain and to use the rxd.membrane() geometry for the plasma membrane. The following e...
by ramcdougal
Wed Jan 01, 2020 2:13 pm
Forum: NEURON + Python
Topic: Associative arrays in HOC
Replies: 5
Views: 606

Re: Associative arrays in HOC

As long as Python is installed, you can use Python dictionaries from inside HOC:

Code: Select all

oc>objref py, d
oc>py = new PythonObject()
oc>d = py.dict()
oc>d.__setitem__("axon", 100)
	NULLobject 
oc>d.__setitem__("soma", 10)
	NULLobject 
oc>d.get("soma")
	10 
oc>d.get("axon")
	100 
by ramcdougal
Wed Jan 01, 2020 2:00 pm
Forum: NEURON + Python
Topic: Converting HOC extracellular to Python
Replies: 3
Views: 484

Re: Converting HOC extracellular to Python

In HOC, if foo is an array, assigning to foo is a syntactic shortcut for assigning to foo[0].
by ramcdougal
Tue Dec 17, 2019 5:13 pm
Forum: UNIX/Linux
Topic: CentOS with RxD and NEURON build from source
Replies: 1
Views: 438

Re: CentOS with RxD and NEURON build from source

Looks like something went wrong with the Cython part of the compilation (which provides voxelize2). If you're using Centos 7 and Python 3.4, try recompiling after something like: yum -y install python34-Cython (I understand you may not have sudo rights on this machine, but you ought to be able to in...
by ramcdougal
Wed Dec 11, 2019 12:09 pm
Forum: Anatomically detailed models
Topic: Precise 3D morphology
Replies: 6
Views: 720

Re: Precise 3D morphology

NEURON doesn't use cylinders. It uses truncated cones ("frusta of a right circular cone") for the electrophysiology. For 3D reaction-diffusion domains, we use essentially the algorithm of McDougal et al., 2013 to convert Neurolucidia-style point-diameter measurements into watertight surfaces. The SW...
by ramcdougal
Mon Nov 25, 2019 1:36 pm
Forum: Other questions
Topic: Could neuron be installed on Windows/MacOS through the command line?
Replies: 2
Views: 429

Re: Could neuron be installed on Windows/MacOS through the command line?

We have two active projects that may be of interest to you: (1) pip installable wheels at https://github.com/neuronsimulator/nrn/tree/setuppy/dist Important: this is a work in progress. At this writing, neither nrnivmodl nor the GUI work. If you don't need those though, you should be good. (The nrni...
by ramcdougal
Fri Nov 22, 2019 1:28 pm
Forum: NEURON + Python
Topic: Is it possible to run nrnivmodl from python?
Replies: 4
Views: 891

Re: Is it possible to run nrnivmodl from python?

As long as you're using NEURON 7.7+ installed by the regular installer, just use nrnivmodl on every platform. The Linux (at least with the deb, didn't check rpm), Windows, and macOS installers all default to putting nrnivmodl on the path. In Windows, in particular, one can open a regular cmd or Powe...