File: tools.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 (56 lines) | stat: -rw-r--r-- 1,858 bytes parent folder | download | duplicates (10)
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
//genesis - tools.g for CPG 2.0 version

// ===========================================
// links together two asymmetric compartments
// ===========================================
function link_compartment(comp1,comp2)
    addmsg   {comp1}   {comp2}  RAXIAL Ra previous_state
    addmsg   {comp2}   {comp1}  AXIAL  previous_state
end

// ===========================================
// links a channel which computes channel current
// (e.g. ChannelC2 or synchan) with a compartment
// ===========================================
function link_channel2(channel,compartment)
    addmsg   {channel}   {compartment} CHANNEL	Gk Ek 
    addmsg   {compartment}   {channel} VOLTAGE 	Vm 
end

/* Functions for getting and setting synchan weights given the source
   element and the number of the SPIKE message
*/

function getweight(src_element, spikemsg)
    str src_element, dest_element
    int spikemsg, synindex
    dest_element = {getsyndest {src_element} {spikemsg}}
    synindex = {getsyndest {src_element} {spikemsg} -index}
    return {getfield {dest_element} synapse[{synindex}].weight}
end

function setweight(src_element, spikemsg, weight)
    str src_element, dest_element
    int spikemsg, synindex
    float weight
    dest_element = {getsyndest {src_element} {spikemsg}}
    synindex = {getsyndest {src_element} {spikemsg} -index}
    setfield {dest_element} synapse[{synindex}].weight {weight}
end

// Not used in this simulation, but is available:
// ===========================================
// sets up data file output of either binary or ascii type
// ===========================================
function disk_output(path,type)
    str path,type
    if(type == "binary")
	create 		disk_out		{path}
    end
    if(type == "ascii")
	create 		asc_file		{path}
    end
    setfield	 {path}		flush			1 \
			leave_open		1
    useclock {path} 1
end