Paste in Fitting > Y-expr

Suggestions for improvements to the NEURON Forum.
Danko Georgiev
Posts: 7
Joined: Fri Oct 15, 2010 10:41 am
Location: Kanazawa University, Japan

Paste in Fitting > Y-expr

Dear authors,

I would like to say that NEURON is great once you get used to it. There are nice tutorials online, so I have learned the basics.

Here I would like to request if you could update the Fitting > Parameterized Function > Y-expr so that it can accept text to be pasted from the clipboard.

Briefly, I need to input long math expressions and although I have them properly formatted in txt file, the Y-expr does not allow me to Paste from the clipboard (I use Windows XP OS).

Is there a way to solve this problem?

Regards,

D. G.
ted
Posts: 5894
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Paste in Fitting > Y-expr

Here's a solution that works now, with any version of NEURON. And it has two advantages over copy & paste: it doesn't limit you to simple "one-liner" functions, and it allows you to easily test your function to make sure it's working properly. Create a new hoc file, and put inside it a single function that takes one argument. The body of the function can be anything you like. Then xopen() your hoc file, and when you configure the MRF, you can just enter the name of the function.

Example: suppose you want to adjust the parameters of a biexponential function so that the function matches an experimentally recorded waveform. You could just click on
Fitness / Expression with \$1
and then type
A*(exp(-k1*\$1) - (exp(-k2*\$1))
into the tool that requests the "Expresssion involving the independent variable, \$1".

But my suggestion would have you do this:
1. Use a text editor to create this function definition:

Code: Select all

``````func biexp() {
return A*(exp(-k1*\$1) - exp(-k2*\$1))
}``````
and save it to a file called myfunc.hoc.
2. At the oc> prompt type xopen("myfunc.hoc"). Now hoc knows a new function called biexp().
3. After clicking on
Fitness / Expression with \$1
just type
biexp(\$1)
into the tool that requests the "Expresssion involving the independent variable, \$1".
Danko Georgiev
Posts: 7
Joined: Fri Oct 15, 2010 10:41 am
Location: Kanazawa University, Japan

Re: Paste in Fitting > Y-expr

Dear Ted,
Thanks for your reply. I will try to define such useful one variable functions myself. Thanks for the code, it is very useful to have such code template.
ted