test_HL23VIP.hoc 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. // Based on ../simulationcode/Step_current_firing.hoc
  2. load_file("nrngui.hoc")
  3. //objref cvode
  4. //cvode = new CVode()
  5. //cvode.active(1)
  6. dt = 0.01
  7. //======================== settings ===================================
  8. v_init = -80
  9. //step 1: 0.619
  10. //step 2: 0.793
  11. //step 3: 1.507
  12. step_amp = 0.2
  13. tstop = 300
  14. //tstop = 800
  15. celsius = 34
  16. //=================== creating cell object ===========================
  17. load_file("import3d.hoc")
  18. objref HL23VIP
  19. strdef morphology_file
  20. morphology_file = "../../L23Net/morphologies/HL23VIP.swc"
  21. load_file("../../L23Net/models/biophys_HL23VIP.hoc")
  22. load_file("../../L23Net/models/NeuronTemplate.hoc")
  23. HL23VIP = new NeuronTemplate(morphology_file)
  24. biophys_HL23VIP(HL23VIP)
  25. //==================== stimulus settings ===========================
  26. objref st1
  27. st1 = new IClamp(0.5)
  28. st1.dur = 200
  29. st1.del = 50
  30. st1.amp = step_amp
  31. HL23VIP.soma st1
  32. //==================== recording settings ==========================
  33. objref vvec, tvec
  34. vvec = new Vector()
  35. tvec = new Vector()
  36. access HL23VIP.soma
  37. cvode.record(&v(0.5),vvec,tvec)
  38. objref apcvec, apc
  39. apcvec = new Vector()
  40. apc = new APCount(0.5)
  41. apc.thresh= -10
  42. apc.record(apcvec)
  43. objref v_time
  44. objref f_time
  45. v_time = new Vector()
  46. { v_time.record(&t) }
  47. f_time = new File()
  48. objref Soma_v
  49. { Soma_v = new Vector() }
  50. { Soma_v.record(&HL23VIP.soma.v(0.5))}
  51. objref Soma_ca
  52. { Soma_ca = new Vector() }
  53. { Soma_ca.record(&HL23VIP.soma.cai(0.5))}
  54. //======================= plot settings ============================
  55. //objref gV
  56. //gV = new Graph()
  57. //gV.size(0,tstop,-80,40)
  58. //graphList[0].append(gV)
  59. //access L5PC.axon
  60. //access L5PC.soma
  61. //gV.addvar("soma","v(0.5)",1,1)
  62. //============================= simulation ================================
  63. nrnpython("from neuron import h")
  64. nrnpython("import time")
  65. nrnpython("print('Starting simulation of %s ms (dt: %s ms)'%(h.tstop,h.dt))")
  66. nrnpython("start_time = time.time()")
  67. init()
  68. run()
  69. nrnpython("end_time = time.time()")
  70. nrnpython("print('Finished simulation in %s s'%(end_time-start_time))")
  71. print "spikes = ", apcvec.printf("%.8f\t")
  72. print "spike count = ", apcvec.size()
  73. objref f_Soma_si
  74. f_Soma_si = new File()
  75. { f_Soma_si.wopen("Soma.vip.v.dat") }
  76. for i=0, Soma_v.size()-1 {
  77. f_Soma_si.printf("%f\t%f\n", v_time.x[i]/1000, Soma_v.x[i]/1000)
  78. }
  79. { f_Soma_si.close() }
  80. objref f_Soma_ca
  81. f_Soma_ca = new File()
  82. { f_Soma_ca.wopen("Soma.vip.ca.dat") }
  83. for i=0, Soma_ca.size()-1 {
  84. f_Soma_ca.printf("%f\t%f\n", v_time.x[i]/1000, Soma_ca.x[i])
  85. }
  86. { f_Soma_ca.close() }