// $Id: x_network.g,v 16.1 2000/03/02 14:43:39 ajay Exp $ // genesis // x_network.g // graphs to look at network activity. //------------------------------------- echo Setting up the XODUS i/o interface ... //------------------------------------- //================================================================= // code added to test output routines. Comment out after tests complete //================================================================= /* include constants setclock 0 {dt} randseed 34521 create neutral /pyr create compartment /pyr/soma create randomspike /pyr/soma/spike setfield ^ min_amp 1.0 max_amp 1.0 rate 400.0 \ reset 1 reset_value 0 abs_refract 1e-6 // Create a plane of pyramidal cells. createmap /pyr /pyr_layer \ {CA3_NX} {CA3_NY} \ -delta {CA3_SEPX} {CA3_SEPY} \ -origin {-CA3_NX * CA3_SEPX / 2} {-CA3_NY * CA3_SEPY / 2} create neutral /int_a create compartment /int_a/soma create randomspike /int_a/soma/spike setfield ^ min_amp 1.0 max_amp 1.0 rate 400.0 \ reset 1 reset_value 0 abs_refract 1e-6 // Create a plane of GABAa cells. createmap /int_a /int_a_layer \ {INTA_NX} {INTA_NY} \ -delta {INTA_SEPX} {INTA_SEPY} \ -origin {-INTA_NX * INTA_SEPX / 2} {-INTA_NY * INTA_SEPY / 2} create neutral /int_b create compartment /int_b/soma create randomspike /int_b/soma/spike setfield ^ min_amp 1.0 max_amp 1.0 rate 400.0 \ reset 1 reset_value 0 abs_refract 1e-6 // Create a plane of GABAb cells. createmap /int_b /int_b_layer \ {INTB_NX} {INTB_NY} \ -delta {INTB_SEPX} {INTB_SEPY} \ -origin {-INTB_NX * INTB_SEPX / 2} {-INTB_NY * INTB_SEPY / 2} */ //==========Comment out upto here after tests complete================== //================Default xform is /xout================= create xform /xout [312,0,600,600] ce /xout create xlabel /xout/label [0,0,50%,4%] \ -label "Pyramidal firing pattern" -bg cyan xcolorscale rainbow //**************************************************************** // Functions to view activity as raster plot //*************************************************************** function mk_graph(path, miny, maxy, celltype) // creates an xgraph str path float miny, maxy int celltype // 0=pyramidal, 1=GABAa, 2=GABAb int i if ({exists {path}/graph}) delete {path}/graph end create xgraph {path}/graph \ -xgeom 0 -ygeom 5% -wgeom 100% -hgeom 95% \ -XUnits time(s) -YUnits cell_# \ -xmax {tmax} \ -ymin {miny} \ -ymax {maxy+1} if ({celltype} == 0) setfield {path}/graph title "Pyramidal cell firing" for (i={miny}; i<={maxy}; i=i+1) addmsg /pyr_layer/pyr[{i}]/soma/spike {path}/graph \ PLOTSCALE state *" " *black 1 {i} end elif ({celltype} == 1) setfield {path}/graph title "GABAa cell firing" for (i={miny}; i<={maxy}; i=i+1) addmsg /int_a_layer/int_a[{i}]/soma/spike {path}/graph \ PLOTSCALE state *" " *black 1 {i} end elif ({celltype} == 2) setfield {path}/graph title "GABAb cell firing" for (i={miny}; i<={maxy}; i=i+1) addmsg /int_b_layer/int_b[{i}]/soma/spike {path}/graph \ PLOTSCALE state *" " *black 1 {i} end else echo Celltype not set properly! end // if end function make_raster(fdir) // main function str fdir // path of xform in which graph created int i float miny // start of range of cells to be displayed float maxy // end of above range // make dialogs to set and display range of cells to be plotted create xdialog {fdir}/start_cell_# \ -xgeom 0:label -ygeom 0 -wgeom 25% \ -script "reset_graph /xout/end_cell_#" \ -value 0 create xdialog /xout/end_cell_# \ -xgeom 0:start_cell_# -ygeom 0 -wgeom 25% \ -script "reset_graph /xout/start_cell_# " \ -value 10 // create plot miny = {getfield {fdir}/start_cell_# value} maxy = {getfield {fdir}/end_cell_# value} mk_graph {fdir} {miny} {maxy} 0 // default is pyramidal cell activity end //*******Note: reset_graph only works for default graph in /xout**** function reset_graph(w1, w2) // called from xdialogs to change range str w1, w2 int i float ymn = {getfield {w1} value} float ymx = {getfield {w2} value} mk_graph /xout {ymn} {ymx} 0 // default pyr cell and /xout reset end //************************************************************** //======Uncomment to view raster plot of activity================ make_raster /xout //************************************************************** xshow /xout ce / reset //****************************************************************** // Add dialog in mk_graph panel which creates another raster plot. // Note: This raster plot does not have reset_graph function // since one can't pass the pathname of the xform element in which // the graph will be created to the script function for reset_graph //****************************************************************** create xform /newgraph [0,250,300,200] create xlabel /newgraph/label -label "Make new raster plot" -bg cyan create xdialog /newgraph/start_cell_# -value 0 create xdialog /newgraph/end_cell_# -value 4 create xdialog /newgraph/celltype -label "0=pyr, 1=GABAa, 2=GABAb" \ -value 0 create xdialog /newgraph/MAKEPLOT -label "MAKEPLOT (xform): " \ -script "mk_r_plt " \ -value "/xout2" xshow /newgraph function mk_r_plt(path) str path pushe / if ({exists {path}}) echo {path} already exists return end create xform {path} [0,500,400,400] mk_graph {path} \ {getfield /newgraph/start_cell_# value} \ {getfield /newgraph/end_cell_# value} \ {getfield /newgraph/celltype value} reset xshow {path} end //********************************************************* // Function to view activity with xview //******************************************************** function make_view(form_dir) str form_dir float radius, dtheta, x, y int i //======Works best if NX=1 and NY=tot. number of cells============== //======If NX != 1, set xmin and xmax according to NX and not NY==== create xdraw {form_dir}/draw [0,3%,100%,96%] setfield {form_dir}/draw \ xmin {-CA3_NY * CA3_SEPX / 2} \ xmax {CA3_NY * CA3_SEPX / 2 } \ ymin {-CA3_NY * CA3_SEPY / 1.5} \ ymax {CA3_NY * CA3_SEPY / 1.5 } \ zmin -0.1 \ zmax 0.1 create xview {form_dir}/draw/view setfield {form_dir}/draw/view \ viewmode shape \ color_val 1 \ morph_val 0 \ value_min[0] 0 \ value_max[0] 1 pushe {form_dir}/draw/view // create circle for icon dtheta = 3.14159/10 radius = {CA3_SEPY / 2} for(i=0;i<=20;i=i+1) x = radius*{cos {i*dtheta}} y = radius*{sin {i*dtheta}} setfield shape[0] xpts->table[{i}] {x} setfield shape[0] ypts->table[{i}] {y} setfield shape[1] xpts->table[{i}] {x} setfield shape[1] ypts->table[{i}] {y} end setfield shape[0] npts 20 setfield shape[1] npts 20 setfield shape[0] fg 50 setfield shape[1] fg 0 pope // use addmsg to set VAL1 of xview pix addmsg /pyr_layer/pyr[]/soma/spike {form_dir}/draw/view \ COORDS x y z addmsg /pyr_layer/pyr[]/soma/spike {form_dir}/draw/view \ VAL1 state end //************************************************* // Uncomment to view changing activity in the network // make_view /xout //***********************************************