Page 1 of 1

Updating extracellular values for all segments!

Posted: Sat Feb 10, 2018 6:52 pm
by edaneshi
Dear Ted,

I created a section in Python with 7 segments and inserted an extracellular mechanism.

Code: Select all

Soma=h.Section()
Soma.nseg=7
Soma.insert('extracellular')
Soma.xraxial[0]=100
Soma.xg[0]=1e10
Soma.xc[0]=0
However, when I print xraxial values for each segment, I see that only one segment's xraxial value is changed:

Code: Select all

h.finitialize()
for seg in Soma:
    print(seg.xraxial[0], seg.xraxial[1],  seg.diam)

h.psection(sec=Soma)

1000000000.0 1000000000.0 500.0
1000000000.0 1000000000.0 500.0
1000000000.0 1000000000.0 500.0
100.0 1000000000.0 500.0
1000000000.0 1000000000.0 500.0
1000000000.0 1000000000.0 500.0
1000000000.0 1000000000.0 500.0
__nrnsec_0x7fbab9181800 { nseg=7 L=100 Ra=35.4
/*location 0 attached to cell 0*/
/* First segment only */
insert capacitance { cm=1}
insert morphology { diam=500}
insert extracellular { xraxial=1e+09 xg=1e+09 xc=0 e_extracellular=0}
}


Could you please help me figure out what I'm doing wrong?

Thanks!

Re: Updating extracellular values for all segments!

Posted: Sat Feb 10, 2018 7:21 pm
by edaneshi
I should also mention that I could set the xraxial values for each segment individually in a for loop:

Code: Select all

h.finitialize()
for seg in Soma:
    seg.xraxial[0]=100
    print(seg.xraxial[0], seg.xraxial[1],  seg.diam)

h.psection(sec=Soma)
and I get the following results:

100.0 1000000000.0 500.0
100.0 1000000000.0 500.0
100.0 1000000000.0 500.0
100.0 1000000000.0 500.0
100.0 1000000000.0 500.0
100.0 1000000000.0 500.0
100.0 1000000000.0 500.0
__nrnsec_0x7f8552a18e00 { nseg=7 L=100 Ra=35.4
/*location 0 attached to cell 0*/
/* First segment only */
insert capacitance { cm=1}
insert morphology { diam=500}
insert extracellular { xraxial=100 xg=1e+09 xc=0 e_extracellular=0}


However, as I mentioned before, I don't know how to set the same values for the extracellular parameters in all segments without using a for loop!

Thank you!

Re: Updating extracellular values for all segments!

Posted: Sun Feb 11, 2018 8:44 pm
by hines
That lacuna is fixed in todays github changeset.
https://github.com/nrnhines/nrn/commit/ ... d189abf570

The test I used, along with result output is

Code: Select all

hines@hines-T7500:~/neuron/nrntest/npy$ cat rvarray.py
from neuron import h
s = h.Section()
s.nseg = 5
s.insert("extracellular")
s.xraxial[0] = 1
s.xraxial[1] = 2
for seg in s:
  seg.xg[0] = seg.x
  seg.xg[1] = 2*seg.x

for seg in s:
  print (seg.xraxial[0], seg.xraxial[1], seg.x, seg.xg[0], seg.xg[1])

hines@hines-T7500:~/neuron/nrntest/npy$ nrniv -python rvarray.py
NEURON -- VERSION 7.5 master (d9be927) 2018-02-11
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2016
See http://neuron.yale.edu/neuron/credits

(1.0, 2.0, 0.1, 0.1, 0.2)
(1.0, 2.0, 0.30000000000000004, 0.30000000000000004, 0.6000000000000001)
(1.0, 2.0, 0.5, 0.5, 1.0)
(1.0, 2.0, 0.7, 0.7, 1.4)
(1.0, 2.0, 0.8999999999999999, 0.8999999999999999, 1.7999999999999998)

Re: Updating extracellular values for all segments!

Posted: Sun Feb 11, 2018 9:00 pm
by edaneshi
Great! Thank you Dr. Hines for the fix.
Just a novice question. How should I update this NEURON file on a MAC? Should I uninstall Neuron and reinstall it with the MAC installer tool?
Is the NEURON installer package also updated?

Thank you!

Re: Updating extracellular values for all segments!

Posted: Mon Feb 12, 2018 10:14 am
by hines
I tend to make alpha distribution installers irregularly and on request.
https://neuron.yale.edu/ftp/neuron/vers ... 64-osx.pkg
is what you should get and should work for python 2.7 3.5 and 3.6 . Uninstall the previous version by dragging /Applications/NEURON-7.5 to the
trash.

Re: Updating extracellular values for all segments!

Posted: Mon Feb 12, 2018 1:41 pm
by edaneshi
Thank you Dr. Hines,

It works perfectly now! Thank you for your time and help!

Side note to other Neuron users: You may need to use "mknrndll" tool to recompile some of your mod files before you can run your models with the new version of Neruon!

Re: Updating extracellular values for all segments!

Posted: Mon Feb 12, 2018 2:25 pm
by ted
After updating NEURON it is ALWAYS necessary to recompile mod files.

Re: Updating extracellular values for all segments!

Posted: Tue Feb 13, 2018 3:01 am
by edaneshi
That's true. Thank you for your comment and help Dr. Carnevale.