File: field.g

package info (click to toggle)
genesis 2.1-1.1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 14,288 kB
  • ctags: 10,667
  • sloc: ansic: 111,959; makefile: 2,240; yacc: 1,797; lex: 976; csh: 54; sh: 13
file content (82 lines) | stat: -rw-r--r-- 2,651 bytes parent folder | download | duplicates (5)
1
2
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
//genesis

function field_electrode(channel_current, path, target, layer, x, y, z,  \
    r, rz)
str path
str target
float x, y, z, r, rz
int channel_currrent
    create efield {path}
    setfield ^ scale -3.33e4 x {x} y {y} z {z}
    if (channel_current == 1)
	    addmsg  \
	        {target}/{layer}[x>={x - r}][y>={y - r}][x<={x + r}][y<={y + r}] \
	         {path} CURRENT Ik 0.0
    else
	    addmsg  \
	        {target}/#[TYPE=compartment][x>={x - r}][y>={y - r}][x<={x + r}][y<={y + r}] \
	         {path} CURRENT Im 0.0
    end
    call ^ RECALC
end

function move_electrode(path, x, y, z)
str path
float x, y, z
    setfield {path} x {x} y {y} z {z}
    call {path} RECALC
end

function electrode_array(path, xmin, ymin, xmax, ymax, xspacing,  \
    yspacing, z)
str path
float xmin, ymin
float xmax, ymax
float xspacing, yspacing
float z
float x, y
int count = 0

    create neutral /field
    for (y = ymin; y < ymax; y = y + yspacing)
	for (x = xmin; x < xmax; x = x + xspacing)
	    field_electrode 1 /field/efield_soma[{count}] {path}  \
	        soma/Cl_channel {x} {y} {z} {{abs z} + 0.5} 1
	    field_electrode 1 /field/efield_Ia_Na[{count}] {path}  \
	        soma/Ia_dend/Aff_Na_channel {x} {y} {z} {{abs z} + 0.5}  \
	        1
	    field_electrode 1 /field/efield_Ia_K[{count}] {path}  \
	        soma/Ia_dend/K_channel {x} {y} {z} {{abs z} + 0.5} 1
	    field_electrode 1 /field/efield_supIb[{count}] {path}  \
	        soma/supIb_dend/CA_Na_channel {x} {y} {z}  \
	        {{abs z} + 0.5} 1
            field_electrode 1 /field/efield_deepIb[{count}] {path}  \
                soma/deepIb_dend/RA_Na_channel {x} {y} {z}  \
                {{abs z} + 0.5} 1
            field_electrode 1 /field/efield_III[{count}] {path}  \
                soma/III_dend/Local_Na_channel {x} {y} {z}  \
                {{abs z} + 0.5} 1
            field_electrode 0 /field/efield_total[{count}] {path} soma  \
                {x} {y} {z} {{abs z} + 0.5} 1
	    echo . -nonewline
	    count = count + 1
	end
    end
    echo
    return (count)
end

if ({FIELD} && {MULTI})
    // construct a 10x6mm electrode array
    echo setting up {CORTEX_X} x {CORTEX_Y}mm field electrode array
    float dxtrodes = {round {1.0/{PYR_DX}}}*{PYR_DX}
    int nxtrodes = {trunc {{CORTEX_X}/dxtrodes}}
    float dytrodes = {round {1.0/{PYR_DY}}}*{PYR_DY}
    int nytrodes = {trunc {{CORTEX_Y}/dytrodes}}
    echo dxtrodes: {dxtrodes} dytrodes: {dytrodes}
    echo {nxtrodes} x {nytrodes} electrode array
    echo  \
        {electrode_array /pyr/pyramidal[] {{PYR_DX}/2.0} {{PYR_DY}/2.0} {CORTEX_X} {CORTEX_Y} {dxtrodes} {dytrodes} 0} \
         electrodes
end