net_functions.hoc 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. //========================================================================================
  2. //=============================== intrinsic manipulations ================================
  3. //========================================================================================
  4. proc addTonicInhibition(){
  5. forsec $o1.somatic {
  6. insert tonic
  7. g_tonic = $2
  8. e_gaba_tonic = -75
  9. }
  10. forsec $o1.basal {
  11. insert tonic
  12. g_tonic = $2
  13. e_gaba_tonic = -75
  14. }
  15. if ((strcmp($o1.cell_name, "HL23PYR") == 0) || (strcmp($o1.cell_name, "HL4PYR") == 0) || (strcmp($o1.cell_name, "HL5PYR") == 0) || (strcmp($o1.cell_name, "HL5PN1y") == 0) || (strcmp($o1.cell_name, "HL5PN1o") == 0)){
  16. forsec $o1.apical {
  17. insert tonic
  18. g_tonic = $3
  19. e_gaba_tonic = -75
  20. }
  21. }
  22. }
  23. //========================================================================================
  24. //============================== synapse related functions ===============================
  25. //========================================================================================
  26. // double siteVec[2]
  27. proc createArtificialSyn() {local sitenum,OUni,i localobj sl, postcell, sref
  28. strdef treename
  29. postcell = $o2
  30. treename = "dend"
  31. relpos = 0.5
  32. sl = postcell.locateSites(treename,relpos*postcell.getLongestBranch(treename))
  33. for (i=0;i<sl.count();i+=1){
  34. postcell.siteVec[0] = sl.o[i].x[0]
  35. postcell.siteVec[1] = sl.o[i].x[1]
  36. access postcell.dend[postcell.siteVec[0]]
  37. postcell.dend[postcell.siteVec[0]] sref = new SectionRef()
  38. sref {
  39. postcell.OUprocess.append(new Gfluct2(postcell.siteVec[1]))
  40. OUni = postcell.OUprocess.count()-1 // OU object index
  41. // Set OU parameters
  42. postcell.OUprocess.o[OUni].E_e = 0// time constant of excitatory conductance
  43. postcell.OUprocess.o[OUni].E_i = -80 // time constant of inhibitory conductance
  44. postcell.OUprocess.o[OUni].g_e0 = $3*exp(relpos) //0.001*exp(relpos) // average excitatory conductance
  45. postcell.OUprocess.o[OUni].g_i0 = 0//0.015*exp(relpos) // average inhibitory conductance
  46. postcell.OUprocess.o[OUni].tau_e = 65 // time constant of excitatory conductance
  47. postcell.OUprocess.o[OUni].tau_i = 20 // time constant of inhibitory conductance
  48. postcell.OUprocess.o[OUni].std_e = $3*exp(relpos) //0.001*exp(relpos) // standard dev of excitatory conductance
  49. postcell.OUprocess.o[OUni].std_i = 0//0.015*exp(relpos) // standard dev of inhibitory conductance
  50. // OUprocess.o[OUni].new_seed($1*10+i) // This appears to not be threadsafe
  51. postcell.roulist.append(new Random($1*10+i+5))
  52. postcell.roulist.o[OUni].normal(0,1)
  53. postcell.OUprocess.o[OUni].noiseFromRandom(postcell.roulist.o[OUni])
  54. }
  55. }
  56. // Apply 5 OUs along apical trunk (if PN)
  57. if ((strcmp(postcell.cell_name, "HL23PYR") == 0) || (strcmp(postcell.cell_name, "HL4PYR") == 0) || (strcmp(postcell.cell_name, "HL5PYR") == 0) || (strcmp(postcell.cell_name, "HL5PN1y") == 0) || (strcmp(postcell.cell_name, "HL5PN1o") == 0)){
  58. for (i=0; i<5; i+=1){
  59. treename = "apic"
  60. relpos = i*0.2 + 0.1 // [0.1, 0.3, 0.5, 0.7, 0.9]
  61. sl = postcell.locateSites(treename,relpos*postcell.getLongestBranch(treename))
  62. maxdiam = 0
  63. for (i1=0; i1<sl.count(); i1+=1){
  64. dd1 = sl.o[i1].x[1]
  65. dd = postcell.apic[sl.o[i1].x[0]].diam(dd1)
  66. if (dd > maxdiam){
  67. j = i1
  68. maxdiam = dd
  69. }
  70. }
  71. postcell.siteVec[0] = sl.o[j].x[0]
  72. postcell.siteVec[1] = sl.o[j].x[1]
  73. access postcell.apic[postcell.siteVec[0]]
  74. postcell.apic[postcell.siteVec[0]] sref = new SectionRef()
  75. sref {
  76. postcell.OUprocess.append(new Gfluct2(postcell.siteVec[1]))
  77. OUni = postcell.OUprocess.count()-1 // OU object index
  78. // Set OU parameters
  79. postcell.OUprocess.o[OUni].E_e = 0// time constant of excitatory conductance
  80. postcell.OUprocess.o[OUni].E_i = -80 // time constant of inhibitory conductance
  81. postcell.OUprocess.o[OUni].g_e0 = $3*exp(relpos) //0.001*exp(relpos) // average excitatory conductance
  82. postcell.OUprocess.o[OUni].g_i0 = 0//0.015*exp(relpos) // average inhibitory conductance
  83. postcell.OUprocess.o[OUni].tau_e = 65 // time constant of excitatory conductance
  84. postcell.OUprocess.o[OUni].tau_i = 20 // time constant of inhibitory conductance
  85. postcell.OUprocess.o[OUni].std_e = $3*exp(relpos) //0.001*exp(relpos) // standard dev of excitatory conductance
  86. postcell.OUprocess.o[OUni].std_i = 0//0.015*exp(relpos) // standard dev of inhibitory conductance
  87. // OUprocess.o[OUni].new_seed($1*10+i) // This appears to not be threadsafe
  88. postcell.roulist.append(new Random($1*10+i))
  89. postcell.roulist.o[OUni].normal(0,1)
  90. postcell.OUprocess.o[OUni].noiseFromRandom(postcell.roulist.o[OUni])
  91. }
  92. }
  93. }
  94. }