Minor issue with changing parameter values while NEURON is running

Anything that doesn't fit elsewhere.
Post Reply
sbrich
Posts: 29
Joined: Tue May 08, 2018 2:08 pm

Minor issue with changing parameter values while NEURON is running

Post by sbrich »

Hi all,

I've generated a detailed multi-compartment cell model with three parameter sets, each one generated for a different distribution of a particular channel throughout the dendrite. I have my code setup so that, in my init.hoc file, I load the parameters with

Code: Select all

load_file("L5_Params_~.hoc)
and then initialize those parameters throughout my cell morphology with a second file,

Code: Select all

load_file("init_params_AddNa.hoc")
. Once I do that, along with loading some additional miscellany including my morphology and current clamps from within the same init.hoc file, I'm able to run the model fine with whatever set of parameters I chose (determined by the choice of ~).

Ideally, I'd like to be able to quickly switch between my parameter sets without having to quit NEURON and reload my init.hoc file with a different parameter set. I thought that I would be able to do this by simply calling the same two commands highlighted above from the command line, but with a different parameter set dictated by a different ~ choosing a different file. However, when I do this I get no changes in my model. The file has definitely been read (for instance, there is a particular parameter called "decay" in my model, and in the parameter files this is encoded as PARAM_decay... and if I look at that PARAM_decay value, it is updated), but there are no changes in the model itself (the "init_paramas_AddNa.hoc" file sets decay=PARAM_decay and uses the value of decay in the model... however, the value of decay doesn't change even though PARAM_decay has).

This is a relatively minor issue that is easy to work around, but I imagine that somewhere down the line being able to make a switch like this might be more necessary, especially when I begin running some automated in silico experiments on the model... not to mention understanding what's going on here will improve my understanding of NEURON. Any help here would be appreciated! I apologize for not posting full code, but as my model is essentially complete I don't feel comfortable posting the code in its entirety before it is published. I'm happy to post additional bits and pieces of the code as necessary, or perhaps communicate with anyone more directly.

Thanks!
Scott
ted
Site Admin
Posts: 5784
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Minor issue with changing parameter values while NEURON is running

Post by ted »

Changing parameters is dirt simple. I can't begin to guess what you are doing that makes it fail--whether it's in your hoc code, or your workflow, or both. Can you cook up a simple example that illustrates what you're doing and how it fails? Maybe on a ball & stick model--should be possible with no more than two sections, and at most two different density mechanisms. Zip up the example and email it to
ted dot carnevale at yale dot edu
and I'll tell you what I find out. It could be a bug in the version of NEURON you're using, or maybe there's something in the documentation that we need to fix.
sbrich
Posts: 29
Joined: Tue May 08, 2018 2:08 pm

Re: Minor issue with changing parameter values while NEURON is running

Post by sbrich »

Thanks Ted... That's part of why I was so surprised that I was running into this issue! I'll e-mail something over to you now.
Scott
ted
Site Admin
Posts: 5784
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Minor issue with changing parameter values while NEURON is running

Post by ted »

Don't forget to say which version of NEURON you're using.
nrniv --version
or
nrngui --version
sbrich
Posts: 29
Joined: Tue May 08, 2018 2:08 pm

Re: Minor issue with changing parameter values while NEURON is running

Post by sbrich »

nrngui --version
NEURON -- VERSION 7.6.5 master (f3dad62b) 2019-01-11
sbrich
Posts: 29
Joined: Tue May 08, 2018 2:08 pm

Re: Minor issue with changing parameter values while NEURON is running

Post by sbrich »

Hi Ted,

I just sent you an e-mail with a "toy" model that should replicate the issue I'm having. Looking forward to seeing what silly oversight of mine is causing this bug, haha.
ted
Site Admin
Posts: 5784
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Minor issue with changing parameter values while NEURON is running

Post by ted »

The problem was caused by trying to use load_file to re-read hoc files. It could be circumvented by using xopen to read those files (see Programmer's Reference documentation of xopen and load_file). However, a better approach is to put the parameter assignment statements into procedures. Then one can switch from one parameter set to another simply by executing the corresponding procedure.
Post Reply