These all return syntax errors except for the very first. The first seems successful but when I try to connect a net stim object to the soma I get the error "point process not located in a section". I believe this is because the parameter was not changed after all and a syntax error prevented the cell from being created which in turn lead to a synapse connecting to a null object.

so my question is... what is the proper syntax for changing default channel builder parameters? I got around this before by editing the .ses file(s) to the parameters I wanted but I would like to know if there is a way to do this through Python.

Thank you,
-Youngmin Park

Last edited by BBAmp on Wed Aug 18, 2010 1:06 pm, edited 1 time in total.

BBAmp wrote:I can't so soma.insert('X') so this was the best workaround I could find.

That's strange--soma.insert('X') works for me. Let's resolve this issue first, in case it is caused by a bug that may interfere with subsequent discussion. What version of NEURON are you running, and under what OS?

The answer to your motivating question--how to access the value of the density parameter for a distributed ("density") mechanism specified by a Channel Builder--is straightforward: the same way you would access the value of the density parameter of a distributed mechanism specified by NMODL.

For example, the hh mechanism (which is specified by NMODL code) has a sodium channel density parameter called gnabar_hh in hoc that is accessed by statements like

Now suppose there is a sodium channel called myna with gating properties that are specified by a Channel Builder, and that its density parameter is called gbar_myna in hoc. This parameter would be accessed by statements like

If you enable the "transition aliases" feature
(ChannelBuild / Properties / Provide transition aliases)
the parameters used by the formulas that describe the voltage- or concentration-dependence of the gating variables become available to hoc. For example, suppose that ChannelBuild[0] has states C1 and C2, where the transition
C1<-> C2
has forward rate aC1C2 = A/(1 + exp(-k*(d-v))). Then A, d, and v will be known to hoc as
ChannelBuild[0].aliases.aC1C2.A, ChannelBuild[0].aliases.aC1C2.d, and ChannelBuild[0].aliases.aC1C2.v, respectively.

And just today, Michael Hines made the necessary changes to NEURON's source code so that these parameters will be available in Python as h.ChannelBuild[0].aliases.infC1C2.A etc.. Seehttp://www.neuron.yale.edu/hg/neuron/nr ... cbbf5090c7
This feature will be included in the next alpha installer for NEURON, and also in the next standard distribution (probably later this year). If you need it before then, you will have to download the latest development sources and compile as described herehttp://www.neuron.yale.edu/neuron/download/getdevel

I have been working on converting a single cell model with detailed anatomy and biophysics from Hoc to Python. I am currently having problems with custom ion channel mechanisms. I am able to insert the mechanisms, but I am having problems defining some of the specific parameters.

I am able to define the parameters above in NEURON using the original Hoc code, but not in Python. I am also able to define them in Python using the direct call to the Hoc interpreter with the h(‘ ‘) command. However, when I define an object in Python as a neuron section and try to define the parameters, I get the error mentioned above. The parameters are all in the PARAMETER block of the Mod file. It seems I am only able to define parameters that are defined as RANGE parameters in the NEURON block.

Thanks. As I mentioned in the previous post, I was able to define properties such as conductances just fine. I only got problems when I tried to define "vshift" and "vtraub" for the AXNODE75 channels and "cai0" for the Cacum channel.

ted wrote:Sure, because that's not how to do it.

What is the correct way to do it? I tried making the same changes when going from Hoc to Python as I did for the conductances along with several other ways. What am I missing?

ted wrote:Why bother? You're going to have to prove that your python implementation is identical to the original hoc implementation. What's wrong with using the hoc implemented model from Python?

Good question. I was able to create the cell and run simulations in Python calling my Hoc code fairly easily. However, I have been having difficulties simulating synaptic inputs to the cell using 'NetCon' and 'Exp2Syn'. I have been able to run these simulations in Hoc but was having difficulty making the appropriate adjustments to call/execute them in Python. I was hoping that converting everything to Python would maybe make it easier to access all of the necessary sections and properties. It hasn't been too much work to convert my Hoc code to Python, but you are right I would need to show that my Python implementation is identical to the Hoc implementation. Maybe I will give it another try.

Whoa, I made a big mistake. I had only glanced briefly at the nmodl source, and thought that vshift and vtraub were range variables--but they're not. The example code in my last post uses syntax that works only for range variables, which is completely off the mark. Sorry about that.

NMODL parameters that are not declared to be RANGE in the NEURON block are NMODL globals, i.e. have the same value for all instances of an NMODL-specified mechanism. Consequently there's no need to specify either the section or the segment, and the correct syntax for dealing with a density mechanism's globals is
h.varname_suffix
which for your particular case would be
h.vshift_axnode75
and
h.vtraub_axnode75

I was able to create the cell and run simulations in Python calling my Hoc code fairly easily. However, I have been having difficulties simulating synaptic inputs to the cell using 'NetCon' and 'Exp2Syn'. I have been able to run these simulations in Hoc but was having difficulty making the appropriate adjustments to call/execute them in Python. I was hoping that converting everything to Python would maybe make it easier to access all of the necessary sections and properties.

If "almost everything" works correctly, it's generally easier to fix the bit that doesn't, rather than reimplement from scratch. And even if the reimplementation seemed to go without a hitch, the burden of proof would still be on you to establish that your reimplementation was identical to the original.

That said, by writing Python code you did learn some new stuff, including how to access NMODL range and global variables with Python. By the way, the only silly questions are the ones that go unasked.

After you have a chance to read this reply, I'm going to split these most recent posts off into a new discussion thread with a title something like "accessing NMODL range and global params from Python"

If you're running into problems with NetCon and Exp2Syn, please post your question(s) in a new thread.

The cell model that I have completely converted to Python seems to be working fine, but you're right and I am going to give the simulations with the original Hoc code another shot. If I can't figure out my problems with using 'NetCon', 'Exp2Syn', etc. from Python I will post my questions in a new thread.