Modification of parameter through a window

The basics of how to develop, test, and use models.
Post Reply
freddy09
Posts: 17
Joined: Tue Mar 18, 2008 6:06 am
Location: LIRMM

Modification of parameter through a window

Post by freddy09 »

I trie to do a structure which enable to select the axone's parameters with the selection of the fiber's diameter. But when i make some modification on the window, i don't see any change.
Someone could help me.
I post only a part of the programs
(excuse me if i made some mistake)

Code: Select all

	//definition parametre du grand axone

create axon_grand
access axon_grand


axon_grand{
	nseg=1
	diam=18.8
	L=18.8
	Ra=123
	insert hh
	gnabar_hh=0.25
	gl_hh=0.0001666
	el_hh=-60
	celsius=37
	istim=2
	delay=1
	pw=0.1
	axonnodes=21
	paranodes1=40
	paranodes2=40
	axoninter=120
	axontotal=221
	fiberD_grand=5.6
	paralength1=3
	nodelength=1.0
	space_p1=0.002
	space_p2=0.004
	space_i=0.004
	rhoa=0.7e6
	mycm=0.1
	mygm=0.001}

//pas d'evolution
D = 0.1



//fonction pour faire evoluer


proc setD_grand(){
	fiberD1_grand = fiberD_grand + D
	fiberD_grand = fiberD1_grand}

//titre du tableau
xpanel("Fibres Grand Axon", 0)

//case pour regler le retard
xvalue("Diametre Grande Fibre", "fiberD_grand", 1, "setD_grand()",  0, 0)

//position de la fenetre
xpanel(38,890)

//case selon la taille de la fibre
if (fiberD_grand==5.7){
		axon_grand{
			g=0.605
			axonD=3.4
			nodeD=1.9
			paraD1=1.9
			paraD2=3.4
			deltax=500
			paralength2=35
			nl=80
			}
		}


if (fiberD_grand==7.3){
		axon_grand{
			g=0.630
			axonD=4.6
			nodeD=2.4
			paraD1=2.4
			paraD2=4.6
			deltax=750
			paralength2=38
			nl=100
			}
		}

if (fiberD_grand==8.7){
		axon_grand{
			g=0.661
			axonD=5.8
			nodeD=2.8
			paraD1=2.8
			paraD2=5.8
			deltax=1000
			paralength2=40
			nl=110
			}
		}

if (fiberD_grand==10.0){
		axon_grand{
			g=0.690
			axonD=6.9
			nodeD=3.3
			paraD1=3.3
			paraD2=6.9
			deltax=1150
			paralength2=46
			nl=120
			}
		}


if (fiberD_grand==11.5){
		axon_grand{
			g=0.700
			axonD=8.1
			nodeD=3.7
			paraD1=3.7
			paraD2=8.1
			deltax=1250
			paralength2=50
			nl=130
			}
		}

if (fiberD_grand==12.8){
		axon_grand{
			g=0.719
			axonD=9.2
			nodeD=4.2
			paraD1=4.2
			paraD2=9.2
			deltax=1350
			paralength2=54
			nl=135
			}
		}

if (fiberD_grand==14.0){
		axon_grand{
			g=0.739
			axonD=10.4
			nodeD=4.7
			paraD1=4.7
			paraD2=10.4
			deltax=1400
			paralength2=56
			nl=140
			}
		}

if (fiberD_grand==15.0){
		axon_grand{
			g=0.767
			axonD=11.5
			nodeD=5.0
			paraD1=5.0
			paraD2=11.5
			deltax=1450
			paralength2=58
			nl=145
			}
		}

if (fiberD_grand==16.0){
		axon_grand{
			g=0.791
			axonD=12.7
			nodeD=5.5
			paraD1=5.5
			paraD2=12.7
			deltax=1500
			paralength2=60
			nl=150
			}
		}
I have some other programs which create a stimulus and trace a graph
ted
Site Admin
Posts: 5869
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

A GUI menu for selecting parameter sets

Post by ted »

First, a suggestion that will make it much easier for people to read code included in your
messages on the Forum--please read this:
Preserving code and text formatting
https://www.neuron.yale.edu/phpBB2/viewtopic.php?t=493
I fixed it for you this time.

Now to try to answer your question:
It looks like you want an xpanel with "radio buttons," so that clicking on a radio button will
cause your model's parameters to get new values. Here's a toy example of a way to do
this:

Code: Select all

load_file("nrngui.hoc")

create axon
access axon

// create parameter vectors

NUMVALS = 3
objref vL, vdiam

vL = new Vector(NUMVALS)
vL.x[0] = 100
vL.x[1] = 190
vL.x[2] = PI*100

vdiam = new Vector(NUMVALS)
vdiam.x[0] = 2
vdiam.x[1] = exp(1)
vdiam.x[2] = sqrt(11)

proc setparms() {
  axon {
    L = vL.x[$1]
    diam = vdiam.x[$1]
  }
  // report parameters
  print " "
  print "Parameters:"
  axon {
    print "L ", L, " diam ", diam
  }
}

setparms(0) // assign default values to model


// GUI for selecting parameter sets

objref lbl[NUMVALS]
for ii=0,NUMVALS-1 {
  lbl[ii] = new String()
  sprint(lbl[ii].s, "Set %d -- L = %4.1f", ii, vL.x[ii])
}

xpanel("Parameter Sets")
xradiobutton(lbl[0].s, "setparms(0)", 1)
xradiobutton(lbl[1].s, "setparms(1)")
xradiobutton(lbl[2].s, "setparms(2)")
xpanel(100, 150)
For documentation about the hoc keywords used in this example, see the Programmer's
Reference
ted
Site Admin
Posts: 5869
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: A GUI menu for selecting parameter sets

Post by ted »

There is no need to use the String class to create the menu. In my previous example,
replace all the stuff below the line

Code: Select all

// GUI for selecting parameter sets
with this:

Code: Select all

strdef prompt, action

xpanel("Parameter Sets")
for ii=0,NUMVALS-1 {
  sprint(prompt, "Set %d -- L = %4.1f", ii, vL.x[ii])
  sprint(action, "setparms(%d)", ii)
  xradiobutton(prompt, action, ii==0)
}
xpanel(100, 150)
This takes fewer lines of code, and, since it doesn't use objects, consumes less memory.
freddy09
Posts: 17
Joined: Tue Mar 18, 2008 6:06 am
Location: LIRMM

thank you

Post by freddy09 »

I thank you for your help
ted
Site Admin
Posts: 5869
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

Thank you for using NEURON in your research.
Post Reply