File: syn_utils.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 (88 lines) | stat: -rw-r--r-- 1,705 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
83
84
85
86
87
88
// genesis

// Some utility functions for looking at synapse parameters


function showrates(start, stop)
  int start, stop
  int i
  for(i = start; i < stop; i = i + 1)
    showfield /retina/recplane/rec[{i}]/input rate
  end
end


function showsynfield(path,field)
  str path, field
  str name
  int num
  int i

  foreach name ({getelementlist {path}})
    num = {getfield {name} nsynapses}
    for (i = 0; i < num; i = i + 1)
      showfield {name} synapse[{i}].{field}
    end
  end

end

function getmaxsynfield(path,field)
  str path, field
  str name
  int num
  int i
  float max = -9999.9
  float temp

  foreach name ({getelementlist {path}})
    num = {getfield {name} nsynapses}
    for (i = 0; i < num; i = i + 1)
      temp = {getfield {name} synapse[{i}].{field}}
      if (temp > max)
        max = temp
      end
    end
  end

  return max 
end


function showmaxsynfield(path,field)
  str path, field
  float max

  max = {getmaxsynfield {path} {field}}
  echo Maximum {field} in {path} = {max}
end



function synapse_info(path)
  str path, src
  int i
  float weight, delay
  floatformat %.3g
  for(i = 0; i < {getsyncount {path}}; i = i + 1)
    src    = {getsynsrc {path} {i}}
    weight = {getfield {path} synapse[{i}].weight}
    delay  = {getfield {path} synapse[{i}].delay}
    echo synapse[{i}]: \
        src = {src} weight = {weight} delay = {delay}
  end
end

str name = "new"

function synapse_list
  int i
  for(i = 0; i < 100; i = i + 1)
    echo connections from: /retina/recplane/rec[{i}]/input >> synapse.list.{name}
    showmsg /retina/recplane/rec[{i}]/input | grep SPIKE >> synapse.list.{name}
    echo >> synapse.list.{name}
    echo . -n
  end
  echo DONE!
end