// functions to bin spiking activity of pyr cells that code input pyr[0-74]. function make_bin_table(tot_simtime, bin_width) // create bin table float tot_simtime // number in sec giving total simulation time float bin_width // number in sec giving bin interval int xdivs = 74 // pyr[0 - 74] int ydivs = {tot_simtime}/{bin_width} + 1 // enough bins for total sim float xmin = 0 float xmax = {xdivs} float ymin = 0 float ymax = {ydivs} int i,j create table2D /bins // row = cell#, col = bin # call /bins TABCREATE {xdivs} {xmin} {xmax} {ydivs} {ymin} {ymax} echo Created bin table. Number of cols = {ydivs} for (i={xmin}; i<={xmax}; i=i+1) for (j={ymin}; j<={ymax}; j=j+1) setfield /bins table->table[{i}][{j}] {0} end end end function bin_pyr_spikes(bin_width) // add info to bin table float bin_width // number in sec giving bin interval int i int rownum,colnum int num_cells_to_bin = 74 int spike_cnt for (i=0; i <= {num_cells_to_bin}; i=i+1) rownum = {i} colnum = {getstat -t} / {bin_width} if ({getfield /pyr_layer/pyr[{i}]/soma/spike state} == 1) spike_cnt = {getfield /bins table->table[{rownum}][{colnum}]} setfield /bins table->table[{rownum}][{colnum}] {spike_cnt + 1} end end end // in learn_sequence, above functions are called as below. // 'for' loop slows down simulation dramatically make_bin_table {tot_simtime} { bin_width} // create bin table numsteps = {recall_time} / {dt} for (i = 0; i <= numsteps; i=i+1) step bin_pyr_spikes {bin_width} echo {i} end