use_mcell_ran4(1)
tstop=500
dt = 0.1
v_init=-60
steps_per_ms = 10
cell=new celltemplate(0,0)
Sim_repeatsPer_Input=100
InputRepeats=10
insertHH=01
insertHHdend=0
layer5dend1=0
Voff_glutamate=0
countRS=20
randomseed=1
Input_NOISE_type=0
proc SetNoise(){
Input_AM=(Input_NOISE_type==1)*1.5
Input_DM=(Input_NOISE_type==2)*45
Input_CE=(Input_NOISE_type==3)*15
}
SetNoise()
Sim_Global=0
Sim_Bias=0
Sim_Global_L1=Sim_Global
proc SetNumberSyn(){
Input_numberFocalSynapses=8*(Sim_Global==0)-2*(CellNum-1)
if(layer5dend1*(CellNum==2)){Input_numberFocalSynapses=30}
Input_numberGlobalSynapses=Sim_Global*(200)
if(Voff_glutamate) {
Input_numberFocalSynapses=100*(Sim_Global==0)
Input_numberGlobalSynapses=100*Sim_Global
}
Input_numberDend=1*(CellNum==1)+(CellNum==2)*(5*(layer5dend1==0)+layer5dend1)
Input_biasnumberSynapses=Sim_Bias*400
Input_biasGABAnumberSynapses=Sim_Bias*CellNum*400/5
Input_biasnumberSynapsesCV=0
Input_gNMDAmaxG=Voff_glutamate
Input_Background=250*(1+3*Voff_glutamate)
}
SetNumberSyn()
objref RandObj,SynList,NetList,NetConList,RanList,NetEventList,BiasList,NetBiasList,NetBiasConList,RanBiasList,RanBackgroundList,NetBackgroundList,NetBackgroundConList
SynList=new List()
BiasList=new List()
NetList=new List()
NetConList=new List()
RanList=new List()
RanBiasList=new List()
RanBackgroundList=new List()
NetEventList=new List()
NetBiasList=new List()
RandObj=new Random()
RandObj.ACG(0)
Input_Width=90
Input_WidthSD=0
Input_Exp=4
Input_AngleInitSD=045
Input_Number=4
Input_DSI=0.5
Input_DSIsd=0
Input_Angle=0
Input_gNMDAmaxF=1
Input_gAMPAmax=1
Input_biasgNMDAmax=0
Input_biasgAMPAmax=1
Input_biasgGABAmax=1
Input_Center=200+100*Sim_Bias
Input_Interval=15
Input_biasISI=100
Input_Noise=1
Input_Noise_Background=1
Input_PreCells=1000
Input_biasNoise=0.5
Noiser_Level=10
tau_ampa_glutamate=1
tau2_glutamate=2
tau1_glutamate=100
Pr_glutamate=1
na_s=0.2+(CellNum==2)*0.1
k_s=0.03+(CellNum==2)*.05
km_s=0.001+(CellNum==2)*.0005
na_d=0.005
k_d=0.001
km_d=0
vshift_HH=-8
NF_HH=1
rpas=10000
epas=-60
countR=0
objref syn,pre,ncl,nr,outinFile
countR=1
double Dend_List[6]
objref dendV[6]
if(CellNum==1){
Dend_List[0]=25
Dend_List[1]=19
Dend_List[2]=12
Dend_List[3]=2
Dend_List[4]=7
Dend_List[5]=8
}
if(CellNum==2){
Dend_List[0]=29
Dend_List[1]=14
Dend_List[2]=37
Dend_List[3]=56
Dend_List[4]=71
Dend_List[5]=4
}
if(layer5dend1){Dend_List[0]=10}
for i=0,5{
dendV[i]=new Vector()
dendV[i].record(&cell.dend[Dend_List[i]].v(0.9))
if(insertHHdend){
access cell.dend[Dend_List[i]]
insert HH
gnabar_HH=0
gkbar_HH=0
gkmbar_HH=0
}
}
if(insertHH){
access cell.soma
insert HH
gnabar_HH=0
gkbar_HH=0
gkmbar_HH=0
}
forall {
insert pas
nseg=7
}
objref outinVecList,outinVec,outinSynList,outinSyn,outinMat,tuning
objref swapvec,noisefreevec,noisefreevecD,orthogonalvec,tuningD,noisefreevecTest
proc PlaceSynFull(){
length=0
forsec cell.dends{length+=L}
for numsyn=1,Input_numberGlobalSynapses{
newloc=RandObj.uniform(0,length)
newpos=RandObj.uniform(0,1)
length=0
forsec cell.dends{
if( (length<=newloc)&&(length+L>=newloc)){
SynList.append(new glutamate(newpos))
SynList.o(SynList.count()-1).locx=x3d(int(n3d()*newpos))
SynList.o(SynList.count()-1).locy=y3d(int(n3d()*newpos))
}
length+=L
}
}
}
proc PlaceSynDend(){
if(layer5dend1==0){
for dend=0,Input_numberDend-1{
for numsyn=1,Input_numberFocalSynapses{
dendnum=dend
access cell.dend[Dend_List[dendnum]]
newpos=RandObj.uniform(0.7,1)
newpos=RandObj.uniform(0.5,1)
SynList.append(new glutamate(newpos))
SynList.o(SynList.count()-1).locx=x3d(int(n3d()*newpos))
SynList.o(SynList.count()-1).locy=y3d(int(n3d()*newpos))
}
}
}else{
access cell.dend[Dend_List[0]]
for numsyn=1,Input_numberFocalSynapses{
SynList.append(new glutamate(.7))
SynList.o(SynList.count()-1).locx=x3d(int(n3d()*newpos))
SynList.o(SynList.count()-1).locy=y3d(int(n3d()*newpos))
}
}
}
objref biasdends
double noBiasList[5]
noBiasList[0]=25
noBiasList[1]=24
noBiasList[2]=23
noBiasList[3]=17
noBiasList[4]=16
objref BiasRandObj
proc PlaceSyn(){
SynList=new List()
BiasList=new List()
NetList=new List()
NetConList=new List()
BiasRandObj=new Random(countRS)
Input_numberGlobalSynapsesS=Input_numberGlobalSynapses
Input_numberFocalSynapsesS=Input_numberFocalSynapses
PlaceSynDend()
PlaceSynFull()
Input_numberGlobalSynapses=Input_numberGlobalSynapsesS
Input_numberFocalSynapses=Input_numberFocalSynapsesS
biasdends=new SectionList()
forsec cell.all{
biasdends.append()
}
for i=0,4{
access cell.dend[noBiasList[i]]
biasdends.remove()
}
length=0
forsec biasdends{length+=L}
VarSyn=int(BiasRandObj.normal(Input_biasnumberSynapses,(Input_biasnumberSynapses*Input_biasnumberSynapsesCV)^2))
for numsyn=1,Input_biasGABAnumberSynapses+VarSyn{
newloc=BiasRandObj.uniform(0,length)
newpos=BiasRandObj.uniform(0,1)
length=0
forsec biasdends{
if( (length<=newloc)&&(length+L>=newloc)){
if(numsyn<=VarSyn){
BiasList.append(new glutamate(newpos))
BiasList.o(BiasList.count()-1).dend=0
}else{
BiasList.append(new gabaA(newpos))
BiasList.o(BiasList.count()-1).dend=1
}
BiasList.o(BiasList.count()-1).locx=x3d(int(n3d()*newpos))
BiasList.o(BiasList.count()-1).locy=y3d(int(n3d()*newpos))
}
length+=L
}
}
}
PlaceSyn()
access cell.soma
objref f1,somav,f2,caDend,fSpike
somav=new Vector()
somav.record(&cell.soma.v(0.5))
objref somaAP,netcon,nil
somaAP=new Vector()
netcon=new NetCon(&cell.soma.v(0.5),nil)
netcon.record(somaAP)
netcon.threshold=-10
Sim_Read_File=0
objref gVmain
gVmain=new Graph(0)
gVmain.view(0,-60,tstop,60,950,280,500,230)
gVmain.addexpr("cell.soma.v(0.5)",1,1)
for i=0,(Input_numberDend-1){
strdef st
sprint(st,"cell.dend[%d].v(0.5)",Dend_List[i])
gVmain.addexpr(st,9,1)
}
graphList[0].append(gVmain)
gVmain = new PlotShape(0)
gVmain.size(-173.946,185.946,-89.5612,270.331)
gVmain.variable("v")
gVmain.view(-173.946, -89.5612, 359.892, 359.892, 187, 187, 200.7, 200.8)
fast_flush_list.append(gVmain)
gVmain.save_name("fast_flush_list.")
proc init_plots_panels(){
xpanel("Input")
xlabel("Signal synapses")
xbutton("Focal Synapses","Sim_Global=0 SetNumberSyn() PlaceSyn() Update()")
xvalue("# Focal Synapses","Input_numberFocalSynapses", 1," PlaceSyn() Update()")
xbutton("Global Synapses","Sim_Global=1 SetNumberSyn() PlaceSyn() Update()")
xvalue("# Global Synapses","Input_numberGlobalSynapses", 1," PlaceSyn() Update()")
xlabel("Background synapses")
xvalue("# bias Synapses","Input_biasnumberSynapses", 1," PlaceSyn() Update()")
xvalue("# bias GABA Synapses","Input_biasGABAnumberSynapses", 1," PlaceSyn() Update()")
xbutton("Preferred signal","Input_Angle=180 Update()")
xbutton("Null signal","Input_Angle=0 Update()")
xvalue("Stimulation angle","Input_Angle", 1,"Update()")
xlabel("Noise")
xvalue("Stochastic noise","Input_AM", 1,"Update()")
xbutton("Preset=1.5","Input_AM=1.5")
xvalue("Classification errors (degrees, DS)","Input_DM", 1,"Update()")
xbutton("Preset=45","Input_DM=45")
xvalue("Classification errors (%)","Input_CE", 1,"Update()")
xbutton("Preset=15","Input_CE=15")
xpanel(140,500)
xpanel("RUN")
xvalue("Init","v_init", 1,"stdinit()", 1, 1 )
xbutton("Init & Run","Update() run()")
xbutton("Stop","stoprun=1")
xvalue("Tstop","tstop", 1,"tstop_changed()", 0, 1 )
xpanel(540,500)
}
init_plots_panels()