/* 
* Procedures for creating GUI panels for choosing parameters and launching cell model
* AUTHOR: Aman Aberra, Duke University
* CONTACT: aman.aberra@duke.edu
*/


proc createPanels(){ 
    celsius = 37 // default temp
    setParamsAdultHuman() // Set Adult Rat as default
    // Parameter panel
	
    xpanel("Choose parameters",0)
        xbutton("Set to Adult Rat", "setParamsAdultRat()")
        xbutton("Set to Adult Human", "setParamsAdultHuman()")
        xstatebutton("Myelinate axon",&myelinate_ax)
        //xvalue("Scale axon diameter","scale_axD","scale_axon_diam = scale_axD",1)
        xpvalue("Scale axon diameter",&scale_axon_diam,scale_axon_diam)
        xpvalue("Scale apical dendritic diameter",&scale_apic_diam,scale_apic_diam)
        xpvalue("Scale basal dendritic diameter",&scale_basal_diam,scale_basal_diam)
        xpvalue("Scale somatic surface area",&scale_soma_area,scale_soma_area)
        xpvalue("Scale basal dendritic length",&scale_basal_L,scale_basal_L)
        xpvalue("Minimum myelin diameter",&min_myelinD,min_myelinD)
        xpvalue("Maximum myelin branch order",&max_myelin_order,max_myelin_order)
        xpvalue("Temperature",&celsius,celsius)   
        xbutton("Reload Cell","cell_chooser(cell_id)")     
    xpanel(250,100)
    strdef cmd, cmd2            
    // Cell chooser panel
    xpanel("Choose Cell",0)
        for i = 0, cell_names.count() - 1 {
            sprint(cmd,"%g. %s",i+1,cell_names.o(i).s)
            sprint(cmd2,"cell_chooser(%g)",i+1)
            xbutton(cmd,cmd2)
        }
    xpanel(10,100)

}

proc setParamsAdultRat(){
    myelinate_ax = 1 // myelinate axon by default
    scale_axon_diam = 1.322 // Zhu 2000 L5 PC soma scaling
    scale_apic_diam = 1.248 // Romand 2011 L5 PC
    scale_basal_diam = 1.133 // Romand 2011 
    scale_soma_area = 1.322 // Zhu 2000
    scale_basal_L = 1.17 // Romand 2011
    min_myelinD = 0.2 // Waxman 1970
    max_myelin_order = 0
} 
  
proc setParamsAdultHuman(){
    myelinate_ax = 1 // myelinate axon by default
    scale_axon_diam = 2.453 // Zhu 2000 L5 PC soma scaling
    scale_apic_diam = 1.876 // Romand 2011 L5 PC
    scale_basal_diam = 1.946 // Romand 2011 
    scale_soma_area = 2.453 // Zhu 2000
    scale_basal_L = 1.17 // Romand 2011
    min_myelinD = 0.2 // Waxman 1970
    max_myelin_order = 0
}