"Linear Circuits Builder" programmatically (Python)

When Python is the interpreter, what is a good
design for the interface to the basic NEURON
concepts.

Moderator: hines

Post Reply
mgiugliano
Posts: 9
Joined: Fri Aug 18, 2006 12:08 pm
Location: Trieste, Italy
Contact:

"Linear Circuits Builder" programmatically (Python)

Post by mgiugliano »

Dear All,

a (very) long time ago, I used the "Linear Circuit Builder" for simulating a (fancy) extracellular electrode (https://senselab.med.yale.edu/ModelDB/s ... eadme.html).

Today, I would love to expand on that idea and make a more sophisticated linear circuit, extracellularly. I am however searching for the **programmatic** definition of the components and their connections, avoiding if possible the use of the Neuron GUI as using Neuron-Python. The automated conversion of Comsol or Spice simulators code would make a "translation" smooth, if I could program Neuron in Python (i.e. generating its code by another script).

However, at the very basic level would you point me to any example (Neuron-Python) I could (re)start with?
I know I should perhaps reverse engineer my old *.ses files, but so far I failed to go beyond the following

Code: Select all

h.load_file("lincir.hoc", "LinearCircuit")
h.extracellular.insert(.....)                    # wherever I need it 
:
h.extracellular.insert(.....)                    # wherever I need it
Where is the documentation for **mkelm(. . . . .)**?
How do I create a Resistor or a Capacitor and connect their terminals to this or that node (within a soma or among themselves)?
How do I specify their value and type?

Perhaps starting from scratch would be more helpful. Thanks immensely for any feedback.

This was my original *.ses code.

Code: Select all

//Begin LinearCircuit[0]
{
load_file("lincir.hoc", "LinearCircuit")
}
{
ocbox_ = new LinearCircuit(1)
}
{object_push(ocbox_)}
{mkelm(8, 80, 155, 1.5, -1.5708)}
{mklabel(0, "dend[1](0.5)", 8.9559, 25.17)}
{sel.extra_info.set("dend[1]", 0.5) sel.extra_info.name(sel)}
{mkelm(5, 80, 50, 2, 0)}
{mkelm(1, 80, 90, 2, 1.5708)}
50
{mklabel(0, "Rseal", -16.8946, -7.1491)}
{mkelm(0, 80, 125, 1.5, -1.5708)}
{mkelm(1, 135, 110, 1.5, 0)}
1
{mklabel(0, "Rsp", -3.467, -15.7445)}
{mklabel(2, "VV", 15, 15)}
{mkelm(2, 170, 110, 2, 0)}
0.01
{mklabel(0, "Ce", -9.575, -16.5049)}
{mklabel(2, "Vout", 57.1, 13.907)}
{mkelm(1, 230, 90, 2, -1.5708)}
1000
{mklabel(0, "R8", 10.721, -13.9919)}
{mkelm(5, 230, 50, 2, 0)}
{mkelm(2, 270, 90, 2, -1.5708)}
0.01
{mklabel(0, "C10", 14.819, -16.2728)}
{mkelm(5, 270, 50, 2, 0)}
{mkelm(0, 250, 110, 2, 0)}
{mkelm(1, 210, 110, 2, 0)}
1e-06
{mklabel(0, "Rm", -7.758, -14.2239)}
{mkelm(0, 100, 110, 2, 0)}
{parasitic_ = 0  noconsist_ = 0}
{graphlist.append(new LincirGraph(this, 1))}
1
Vout (mV)
1 1 0.8 0.9 2
0 930 -0.029 0.03 // graph size
385 475 631.8 332.1 // box size
// end info
{g.exec_menu("Simulate")  tool(2)}
{sel = nil}
{object_pop()}
{
{
save_window_=ocbox_.g
save_window_.size(0,300,0,200)
scene_vector_[6] = save_window_
ocbox_.g = save_window_
save_window_.save_name("ocbox_.g")
save_window_.label(88.9559, 180.17, "dend[1](0.5)", 1, 1, 0.5, 0.5, 1)
save_window_.label(63.1054, 82.8509, "Rseal", 1, 1, 0.5, 0.5, 1)
save_window_.label(131.533, 94.2555, "Rsp", 1, 1, 0.5, 0.5, 1)
save_window_.label(165, 125, "VV", 1, 1, 0.5, 0.5, 1)
save_window_.label(160.425, 93.4951, "Ce", 1, 1, 0.5, 0.5, 1)
save_window_.label(247.1, 123.907, "Vout", 1, 1, 0.5, 0.5, 1)
save_window_.label(240.721, 76.0081, "R8", 1, 1, 0.5, 0.5, 1)
save_window_.label(284.819, 73.7272, "C10", 1, 1, 0.5, 0.5, 1)
save_window_.label(202.242, 95.7761, "Rm", 1, 1, 0.5, 0.5, 1)
}
ocbox_.map("LinearCircuit[0]", 663, -3, 425.7, 381.6)
}
objref ocbox_
//End LinearCircuit[0]
Post Reply