| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 
 | // genesis
create xform /xconn [312,0,800,480]
ce /xconn
// Creating a view to look at the input pattern
float ret_xscale = 0.7
float ret_yscale = 0.8
float ret_xoffset = REC_SEPX/2
float ret_yoffset = REC_SEPX/2
create xlabel /xconn/"Retinal cells" [2%,2%,45%,30] 
create xdraw /xconn/draw [2%,10%,45%,300] 
setfield     /xconn/draw \
	     xmin {ret_xmin / ret_xscale} \
	     xmax {ret_xmax / ret_xscale} \
	     ymin {ret_ymin / ret_yscale} \
	     ymax {ret_ymax / ret_yscale}
function showprojfield(widget)
    str widget
    str value = {getfield {widget} value}
    str dest
    int index
    echo showing projective field for {value}
    int syncount = {getsyncount {value}}
    int i
    for (i = 0; i < {syncount}; i = i + 1)
	dest = {getsyndest {value} {i}}
	index = {getsyndest {value} {i} -index}
        echo {dest} synapse {index} \
	     weight: {getfield {dest} synapse[{i}].weight} \
	     delay:  {getfield {dest} synapse[{i}].delay}
//        addmsg {dest} /xconn/draw2/horiz VAL1 
    end
end
create xview /xconn/draw/retina 
setfield     /xconn/draw/retina \
	     tx {ret_xoffset}   \
	     ty {ret_yoffset}   \
	     sizescale {REC_SEPX * 30}         \  
	     morph_val 0                       \
	     path /retina/recplane/rec[]/input \
	     script "showprojfield <w>"
// Creating a pair of views in the same draw to look at the V1 cells.
float V1_xscale  = 0.7
float V1_yscale  = 0.8
float V1_xoffset = 3 * V1_SEPX
float V1_yoffset = V1_SEPX/2
create xlabel /xconn/"V1 cells" [52%,2%,45%,30]
create xdraw /xconn/draw2 [52%,10%,45%,300] 
setfield     /xconn/draw2  \
    xmin     -0.000559    \
    xmax      0.000457    \
    ymin     -0.00044435  \
    ymax      0.00044465  \
    zmin     -0.0807691   \
    zmax      0.08077     \
    vx       -0.211083    \
    vy       -0.779934    \
    vz        0.589192    \
    transform ortho3d     
function showrecfield(widget)
    str widget
    str value = {getfield {widget} value} @ "/exc_syn"
    str src
    echo showing receptive field for {value}
    int syncount = {getsyncount {value}}
    int i
    for (i = 0; i < {syncount}; i = i + 1)
	src = {getsynsrc {value} {i}}
        echo {src} weight {getfield {value} synapse[{i}].weight} \
		   delay  {getfield {value} synapse[{i}].delay}
//        addmsg {src} /xconn/draw2/horiz VAL1 
    end
end
// create labels for the xview widgets corresponding to V1 cells
create xshape /xconn/draw2/horiz_label -text horiz  -tx -0.00028 -ty -0.0003
create xshape /xconn/draw2/vert_label  -text vert   -tx  0.0002  -ty -0.0003
// Creating the horiz cells to the left of the vert cells.
create xview /xconn/draw2/horiz 
setfield     /xconn/draw2/horiz                 \
             tx {-V1_xoffset}                   \  
             ty { V1_yoffset}                   \
	     value_min[0] -0.090                \
	     value_max[0]  0.060                \
             sizescale {V1_SEPX * 30.0}         \
	     morph_val 0                        \
	     path /V1/horiz/soma[]              \
	     script "showrecfield <w>"
// Creating the vert cells to the right of the horiz cells 
create xview /xconn/draw2/vert
setfield     /xconn/draw2/vert            \
             tx {V1_xoffset}              \
             ty {V1_yoffset}              \
	     value_min[0] -0.090          \
	     value_max[0]  0.060          \
             sizescale {V1_SEPX * 30.0}   \
	     morph_val 0                  \
	     path /V1/vert/soma[]         \
	     script "showrecfield <w>"
//================================================
// old stuff...
//================================================
function set_conns 
//    execute ExpWeight /retina/recplane/rec[]/axon \
//	{{getfield /xconn/"Weight decay"   value} / V1_SEPX } \
//	{getfield /xconn/"Set max weight" value} 0.0
end
function field_toggle(widget)
    str widget
    if ({getfield {widget} state} == 1)
//	setfield /xconn/draw/rec_conn field weight
//	setfield /xconn/draw/V1_conn field weight
	echo field is weight
    else
//	setfield /xconn/draw/rec_conn field delay
//	setfield /xconn/draw/V1_conn field delay
	echo field is delay
    end
end
//create xtoggle /xconn/"delay | weight"  [0,80%,100%,30] -script "field_toggle <w>"
create xtoggle /xconn/delay_weight  [0,80%,100%,30] -label0 "Displaying delays" \
        -label1 "Displaying weights" -script "field_toggle <w>"
create xdialog /xconn/"Set max weight" -script "set_conns" -value  10000.0
create xdialog /xconn/"Weight decay"   -script "set_conns" -value -1.0000
 |