// $Id: learn.g,v 16.1 2000/03/02 14:43:39 ajay Exp $ // genesis // learn.g Hippo Model -GW // Stuff used for the Hebbian learning... float N_AFF = 25 function fix_weights echo Fixing the weights.... int i, isyn for(i = 0; i <= {N_AFF}; i = i + 1) setfield /pyr_layer/pyr[{i}]/apical_5/NMDA_channel \ change_weights 0 showfield /pyr_layer/pyr[{i}]/apical_5/NMDA_channel \ change_weights end echo The weights are now fixed.... end function free_weights echo Freeing the weights.... int i, isyn for(i = 0; i <= {N_AFF}; i = i + 1) setfield /pyr_layer/pyr[{i}]/apical_5/NMDA_channel \ change_weights 1 end echo The weights are now free.... end function show_weights int c, imes, i for(c = 0; c <= {N_AFF}; c = c + 1) imes = {getfield /pyr_layer/pyr[{c}]/apical_5/NMDA_channel nsynapses} - 1 for(i = 0; i <= imes; i = i + 1) echo Cell[{c}] - Synapse[{i}]: \ {getfield /pyr_layer/pyr[{c}]/apical_5/NMDA_channel \ synapse[{i}].weight} end end end // septal driving - both cholinergic and GABAergic. function ach(val) float val int i for(i = 0; i <= {N_AFF}; i = i + 1) setfield /pyr_layer/pyr[{i}]/apical_5 inject {val} end end function gaba(val) float val int i for(i = 0; i <= 4; i = i + 1) setfield /int_a_layer/int_a[{i}]/soma inject {val} end end function init_weights int c, imes, i for(c = 0; c <= {N_AFF}; c = c + 1) imes = {getfield /pyr_layer/pyr[{c}]/apical_5/NMDA_channel nsynapses} - 1 for(i = 0; i <= imes; i = i + 1) setfield /pyr_layer/pyr[{c}]/apical_5/NMDA_channel \ synapse[{i}].weight .00001 end imes = {getfield /pyr_layer/pyr[{c}]/apical_4/GABAa_channel nsynapses} - 1 for(i = 0; i <= imes; i = i + 1) setfield /pyr_layer/pyr[{c}]/apical_4/GABAa_channel \ synapse[{i}].weight .0001 end imes = {getfield /pyr_layer/pyr[{c}]/basal_2/GABAa_channel nsynapses} - 1 for(i = 0; i <= imes; i = i + 1) setfield /pyr_layer/pyr[{c}]/basal_2/GABAa_channel \ synapse[{i}].weight .0001 end imes = {getfield /pyr_layer/pyr[{c}]/soma/GABAa_channel nsynapses} - 1 for(i = 0; i <= imes; i = i + 1) setfield /pyr_layer/pyr[{c}]/soma/GABAa_channel \ synapse[{i}].weight .0001 end end for(c = 0; c <= 4; c = c + 1) imes = {getfield /int_a_layer/int_a[{c}]/basal_2/GABAa_channel nsynapses} - 1 for(i = 0; i <= imes; i = i + 1) setfield /int_a_layer/int_a[{c}]/basal_2/GABAa_channel \ synapse[{i}].weight .00001 end imes = {getfield /int_a_layer/int_a[{c}]/apical_4/GABAa_channel nsynapses} - 1 for(i = 0; i <= imes; i = i + 1) setfield /int_a_layer/int_a[{c}]/apical_4/GABAa_channel \ synapse[{i}].weight .00001 end imes = {getfield /int_a_layer/int_a[{c}]/soma/GABAa_channel nsynapses} - 1 for(i = 0; i <= imes; i = i + 1) setfield /int_a_layer/int_a[{c}]/apical_4/GABAa_channel \ synapse[{i}].weight .00001 end imes = {getfield /int_a_layer/int_a[{c}]/soma/AMPA_channel nsynapses} - 1 for(i = 0; i <= imes; i = i + 1) setfield /int_a_layer/int_a[{c}]/soma/AMPA_channel \ synapse[{i}].weight 100 end end end function weights_file(file) int c, imes, i str file for(c = 0; c <= {N_AFF}; c = c + 1) imes = {getfield /pyr_layer/pyr[{c}]/apical_5/NMDA_channel nsynapses} - 1 for(i = 0; i <= imes; i = i + 1) echo Cell[{c}] - Synapse[{i}]: \ {getfield /pyr_layer/pyr[{c}]/apical_5/NMDA_channel \ synapse[{i}].weight} >> {file} end end end function pattern(val) float val int i for(i = 0; i <= 9; i = i + 1) setfield /pyr_layer/pyr[{i}]/apical_5 inject {val} end for(i = 40; i <= 49; i = i + 1) setfield /pyr_layer/pyr[{i}]/apical_5 inject {val} end end function full(val) float val int i for(i = 0; i <= {N_AFF}; i = i + 1) setfield /pyr_layer/pyr[{i}]/apical_5 inject {val} end end function pata(val) float val int i for(i = 0; i <= 9; i = i + 1) setfield /pyr_layer/pyr[{i}]/apical_5 inject {val} end end function patb(val) float val int i for(i = 40; i <= 49; i = i + 1) setfield /pyr_layer/pyr[{i}]/apical_5 inject {val} end end function hyper(val) float val int i for(i = 0; i <= {N_AFF}; i = i + 1) setfield /pyr_layer/pyr[{i}]/soma inject {val} end end function hyper_rem(val) float val int i for(i = 40; i <= 49; i = i + 1) setfield /pyr_layer/pyr[{i}]/apical_5 inject {val} end end function partial_pattern int i for(i = 40; i <= 49; i = i + 1) setfield /pyr_layer/pyr[{i}]/soma inject {0.0} end end function petite_pattern(val) float val int i for(i = 0; i <= 3; i = i + 1) setfield /pyr_layer/pyr[{i}]/soma inject {val} end for(i = 4; i <= 49; i = i + 1) setfield /pyr_layer/pyr[{i}]/soma inject {0.0} end end function full_pattern echo Presenting the full pattern.... int i for(i = 0; i <= 9; i = i + 1) setfield /aff_layer/aff[{i}]/input rate 400.0 end for(i = 40; i <= 49; i = i + 1) setfield /aff_layer/aff[{i}]/input rate 400.0 end echo O.K., here it comes.... end function do_disk_out(diskpath,srcpath,field) str diskpath, srcpath, field float val val = {getfield /int_b_layer/int_b[2]/apical_4/GABAb_channel Gk} * 1e16 create asc_file /output/{diskpath} setfield /output/{diskpath} leave_open 1 flush 1 notime 1 \ filename {diskpath} addmsg {srcpath} /output/{diskpath} SAVE {field} useclock /output/{diskpath} 0 echo {diskpath} end //do_disk_out pyr_45.gnu /pyr_layer/pyr[45]/soma Vm //do_disk_out pyr_25.gnu /pyr_layer/pyr[25]/soma Vm //do_disk_out pyr_5.gnu /pyr_layer/pyr[5]/soma Vm //do_disk_out pyr_somavm.gnu /pyr_layer/pyr[5]/soma Vm //do_disk_out pyr_somana.gnu /pyr_layer/pyr[5]/soma/Na Ik //do_disk_out pyr_somakdr.gnu /pyr_layer/pyr[5]/soma/K_DR Ik //do_disk_out pyr_apical5_ca.gnu /pyr_layer/pyr[5]/apical_5/Ca Ik //do_disk_out pyr_apical4_ahp.gnu /pyr_layer/pyr[5]/apical_4/K_AHP Ik //do_disk_out pyr_basal2_kc.gnu /pyr_layer/pyr[5]/basal_2/K_C Ik //do_disk_out pyr_basal1_ca.gnu /pyr_layer/pyr[5]/basal_1/Ca Ik //do_disk_out gabab.gnu /int_b_layer/int_b[0]/apical_4/GABAb_channel Gk // ACh modulation. // This includes: // (1) Suppression of intrinsic synaptic transmission by changing // g(max) in the AMPA currents in pyr[] at both basal_1 and // apical_5. // gmax of AMPA is: SOMA_A * 50 // (2) Suppression of adaptation currents I_K(AHP) and I_K(Ca), by // changing the g(max) in the soma of each pyr[]. // Gbar of I_K(AHP) is: 8 function ach_on(per) int i float per echo Adjusting ACh effects.... for(i = 0; i <= {N_AFF}; i = i + 1) /* setfield /pyr_layer/pyr[{i}]/basal_1/AMPA_channel \ gmax {(SOMA_A * 50) * {per}} setfield /pyr_layer/pyr[{i}]/apical_5/AMPA_channel \ gmax {(SOMA_A * 50) * {per}} */ setfield /pyr_layer/pyr[{i}]/soma/K_AHP \ Gbar {(SOMA_A * 8) * {per}} end echo ACh modulation - currents reduced to {per * 100.0} percent echo of initial values.... end function ach_syn(per) int i float per echo Adjusting ACh effects.... for(i = 0; i <= {N_AFF}; i = i + 1) setfield /pyr_layer/pyr[{i}]/basal_1/AMPA_channel \ gmax {AMPACON * {per}} setfield /pyr_layer/pyr[{i}]/apical_5/AMPA_channel \ gmax {AMPACON * {per}} end echo ACh modulation - currents reduced to {per * 100.0} percent echo of initial values.... end function ach_ahp(per) int i float per echo Adjusting ACh effects.... for(i = 0; i <= {N_AFF}; i = i + 1) setfield /pyr_layer/pyr[{i}]/soma/K_AHP \ Gbar {AHPCON * {per}} end echo ACh modulation - currents reduced to {per * 100.0} percent echo of initial values.... end function set_tau(val) float val int i for(i = 0; i <= {N_AFF}; i = i + 1) setfield /pyr_layer/pyr[{i}]/apical_5/NMDA_channel \ post_tau {val} end end function set_thresh(preval, postval) float preval, postval int i for(i = 0; i <= {N_AFF}; i = i + 1) setfield /pyr_layer/pyr[{i}]/apical_5/NMDA_channel \ pre_thresh_hi {preval} setfield /pyr_layer/pyr[{i}]/apical_5/NMDA_channel \ post_thresh_hi {postval} end end function set_rate(val) float val int i for(i = 0; i <= {N_AFF}; i = i + 1) setfield /pyr_layer/pyr[{i}]/apical_5/NMDA_channel \ weight_change_rate {val} end end function lern(tv1, tv2, file) float tv1, tv2 str file reset init_weights fix_weights // set_thresh {tv1} {tv2} pattern 0.45e-9 hyper -1.0e-9 step 1000 free_weights step 1000 // weights_file {file} end // ********************************************************* // L E A R N & R E C A L L // ********************************************************* // Here is the learn and recall sequence. function lr(perc, file1, file2) float perc str file1, file2 echo LEARNING.... free_weights ach_on {perc} reset step 600 kill_pattern step 1000 full_pattern step 600 save_voltages {file1} fix_weights partial_pattern ach_on 1.0 // This removes the ACh modulation. reset echo RECALLING.... step 600 kill_pattern step 1000 partial_pattern step 600 save_voltages {file2} end // Some patterns to be used in the sequence. function pat1(val) float val int i for(i = 0; i <= {N_AFF}; i = i + 5) setfield /pyr_layer/pyr[{i}]/apical_5 inject {val} end end function pat2(val) float val int i for(i = 1; i <= {N_AFF}; i = i + 5) setfield /pyr_layer/pyr[{i}]/apical_5 inject {val} end end function pat3(val) float val int i for(i = 2; i <= {N_AFF}; i = i + 5) setfield /pyr_layer/pyr[{i}]/apical_5 inject {val} end end function pat4(val) float val int i for(i = 3; i <= {N_AFF}; i = i + 5) setfield /pyr_layer/pyr[{i}]/apical_5 inject {val} end end function pat5(val) float val int i for(i = 4; i <= {N_AFF}; i = i + 5) setfield /pyr_layer/pyr[{i}]/apical_5 inject {val} end end function store_sequence init_weights hyper -0.1e-9 fix_weights step 1000 pat1 0.4e-9 step 600 free_weights step 1000 pat1 -0.1e-9 hyper -0.1e-9 fix_weights step 1000 pat2 0.4e-9 step 600 free_weights step 1000 pat2 -0.1e-9 hyper -0.1e-9 fix_weights step 1000 pat3 0.4e-9 step 600 free_weights step 1000 pat3 -0.1e-9 hyper -0.1e-9 fix_weights step 1000 pat4 0.4e-9 step 600 free_weights step 1000 pat4 -0.1e-9 hyper -0.1e-9 fix_weights step 1000 pat5 0.4e-9 step 600 free_weights step 1000 pat5 -0.1e-9 fix_weights end function recall_sequence reset hyper 0.0 step 1000 pat1 0.2e-9 step 500 pat1 0.0 step 2500 end function septal reset gaba 0.125e-9 step 400 gaba 0.0 step 1700 gaba 0.125e-9 step 400 gaba 0.0 step 1700 gaba 0.125e-9 step 400 gaba 0.0 step 1700 gaba 0.125e-9 step 400 gaba 0.0 step 1700 gaba 0.125e-9 step 400 gaba 0.0 step 1700 gaba 0.125e-9 step 400 gaba 0.0 step 1700 gaba 0.125e-9 step 400 gaba 0.0 step 1700 gaba 0.125e-9 step 400 gaba 0.0 step 1700 gaba 0.125e-9 step 400 gaba 0.0 step 1700 gaba 0.125e-9 step 400 gaba 0.0 step 1700 gaba 0.125e-9 step 400 gaba 0.0 step 1700 gaba 0.125e-9 step 400 gaba 0.0 step 1700 end // synapse_info /pyr_layer/pyr[10]/apical_5/NMDA_channel > weights.txt