ChrisR wrote:I don't see how .ses and the normal hoc configuration plays together.
ses files are merely machine-written hoc code. hoc and ses files play together extremely well. It is even possible to edit ses files, e.g. if you want to change the name of a variable that is plotted in a graph, or to steal code from ses files that you can then reuse in your own hoc programs (for an example see
How to use hoc to plot a variable vs. time
https://www.neuron.yale.edu/phpBB2/viewtopic.php?t=552).
Is it possible to combine a hoc neuron model with a linear circuit from the Linear Circuit Builder to create a hoc file that can be run by a script?
Absolutely. Start NEURON and make sure that an instance of your model cell exists. Start the Linear Circuit Builder, and every time you spawn one of those "cell thingies" on its canvas you are actually getting a tool that allows you to attach an electrode to any section of any cell that existed before you started the Linear Circuit Builder. When you're finished setting up
your circuit, use the Print & File Window Manager to save the Linear Circuit Builder, and any graphs or other GUI tools that you created with it, to a ses file. Then you can reuse it in the future by writing an init.hoc file that contains the following:
Code: Select all
load_file("celldef.hoc") // hoc (or ses) file that specifies properties your model cell(s)
load_file("circuit.ses") // ses file saved from your Linear Circuit Builder and its associated GUI tools
For some practice, try this exercise
Introduction to the Linear Circuit Builder
http://www.neuron.yale.edu/course/lincir1/lincir1.html
How can I play a current from an external file into a current source in the Linear Circuit Builder? Does this work with "External Stim Pattern"
Yep. On the LCB's Simulate page, click on the Source f(t) button and select the name of the current souce. This brings up a parameter panel called something like "f(t) for I1 of Lin...bla..." Click on the "External Stim Pattern" button and the parameter panel disappers.
Next click on the Source f(t) button again, and select the name of the current souce. This time you get a panel with a message that says something like "External Stim Pattern ... should play into the alias LinearCircuit[0].I1"
So create a pair of vectors called tvec and ivec. Fill ivec with the series of current values, and tvec with the corresponding time values. Then execute
ivec.play(&LinearCircuit[0].i, tvec)
and every time you run a simulation, the current source will deliver the desired current waveform.
You should be able to accomplish same results with the GUI's Vector/Play tool, but setting up "vector play" with hoc is such a convenient idiom that you'll learn it by heart if you just write the code a few times.
I couldn't load the external file. How does it have to be formatted?
Here's how to discover for yourself:
Run neurondemo
Select the hh model.
Run a simulation.
Use the v graph's "Pick vector" to select the displayed waveform (click on the graph's menu box, then select "Pick vector" from the dropdown menu, and finally click on the voltage trace).
Then click on NEURON Main Menu / Vector / Save to File
Finalliy, examine the file with any text editor (not MSWord or WordPad or any WYSIWYG program).
BTW the Vector class has very convenient methods for reading data from files.