001: #!/usr/bin/perl -w
002: #!/usr/bin/perl -d:ptkdb -w
003: #
004: 
005: use strict;
006: 
007: 
008: $| = 1;
009: 
010: 
011: BEGIN
012: {
013:     #! make check
014: 
015:     push @INC, '../perl';
016: 
017:     #! make distcheck
018: 
019:     push @INC, '../../perl';
020: 
021:     #! normal run
022: 
023:     push @INC, './perl';
024: 
025:     #! after install
026: 
027:     push @INC, '/usr/local/glue/swig/perl';
028: }
029: 
030: 
031: use SwiggableHeccer;
032: 
033: use SSP;
034: 
035: 
036: $SIG{__DIE__}
037:     = sub {
038:         use Carp;
039: 
040:         confess @_;
041:     };
042: 
043: $ENV{NEUROSPACES_NMC_MODELS} = '/usr/local/neurospaces/models/library';
044: 
045: 
046: sub main
047: {
048:     # model specification array
049: 
050:     my $modelname = $0;
051: 
052:     $modelname =~ s/.*\///;
053: 
054:     $modelname =~ s/-/_/g;
055: 
056:     my $args = [ "$0", "-P", "tests/networks/$modelname.ndf" ];
057: 
058:     # instantiate a scheduler
059: 
060:     my $scheduler
061:         = SSP->new(
062:                    {
063:                     apply => {
064:                               simulation => [
065:                                              {
066:                                               arguments => [ 10000, { verbose => 2, }, ],
067:                                               method => 'steps',
068:                                              },
069: #                                            {
070: #                                             arguments => [ 0.1, ],
071: #                                             method => 'advance',
072: #                                            },
073:                                             ],
074:                              },
075:                     models => [
076:                                {
077:                                 granular_parameters => [
078:                                                         {
079:                                                          component_name => "/$modelname/source/soma",
080:                                                          field => 'INJECT',
081:                                                          value => 2e-9,
082:                                                         },
083:                                                        ],
084:                                 modelname => "/$modelname/source",
085:                                 solverclass => "heccer",
086:                                },
087:                                {
088:                                 modelname => "/$modelname/target1",
089:                                 solverclass => "heccer",
090:                                },
091:                                {
092:                                 modelname => "/$modelname/target2",
093:                                 solverclass => "heccer",
094:                                },
095:                                {
096:                                 modelname => "/$modelname/projection1",
097:                                 solverclass => "des",
098:                                },
099:                               ],
100:                     name => $modelname,
101:                     outputclasses => {
102:                                       double_2_ascii => {
103:                                                          module_name => 'Heccer',
104:                                                          package => 'Heccer::Output',
105:                                                         },
106:                                       event_2_ascii => {
107:                                                         module_name => 'Heccer',
108:                                                         options => {
109:                                                                     filename => "/tmp/output_spike",
110:                                                                    },
111:                                                         package => 'Heccer::Event::Output',
112:                                                        },
113:                                      },
114:                     outputs => [
115:                                 {
116:                                  component_name => "/$modelname/source/soma",
117:                                  field => 'Vm',
118:                                  outputclass => 'double_2_ascii',
119:                                 },
120:                                 {
121:                                  component_name => "/$modelname/source/soma/spikegen",
122:                                  field => 'spike',
123:                                  outputclass => 'event_2_ascii',
124:                                 },
125:                                ],
126:                     services => {
127:                                  model_container => {
128:                                                      initializers => [
129:                                                                       {
130:                                                                        arguments => [ $args, ],
131:                                                                        method => 'read',
132:                                                                       },
133:                                                                      ],
134:                                                      module_name => 'Neurospaces',
135:                                                     },
136:                                 },
137:                     solverclasses => {
138:                                       heccer => {
139:                                                  compilation_priority => 'numerical',
140:                                                  constructor_settings => {
141:                                                                           dStep => (1e-6),
142:                                                                           configuration => {
143:                                                                                             reporting => {
144:                                                                                                           granularity => 10000,
145:                                                                                                           tested_things => (
146:                                                                                                                             $SwiggableHeccer::HECCER_DUMP_VM_COMPARTMENT_MATRIX
147: #                                                                                                                           | $SwiggableHeccer::HECCER_DUMP_VM_COMPARTMENT_DATA
148:                                                                                                                             | $SwiggableHeccer::HECCER_DUMP_VM_COMPARTMENT_OPERATIONS
149:                                                                                                                             | $SwiggableHeccer::HECCER_DUMP_VM_MECHANISM_DATA
150:                                                                                                                             | $SwiggableHeccer::HECCER_DUMP_VM_MECHANISM_OPERATIONS
151:                                                                                                                             | $SwiggableHeccer::HECCER_DUMP_VM_SUMMARY
152: #                                                                                                                           | $SwiggableHeccer::iHECCER_DUMP_ALL_EXTENDED
153:                                                                                                                            ),
154:                                                                                                          },
155:                                                                                            },
156:                                                                          },
157:                                                  module_name => 'Heccer',
158:                                                  service_name => 'model_container',
159:                                                 },
160: #                                     event_distributor => {
161: #                                                           compilation_priority => 'events',
162: #                                                           initializers => [
163: #                                                                            {
164: #                                                                             arguments => [],
165: #                                                                             method => 'add_distributor',
166: #                                                                            },
167: #                                                                           ],
168: #                                                           module_name => 'Heccer',
169: #                                                           package => 'Heccer::DES',
170: #                                                          },
171: #                                     event_queuer => {
172: #                                                      compilation_priority => 'events',
173: #                                                      initializers => [
174: #                                                                       {
175: #                                                                        arguments => [],
176: #                                                                        method => 'add_queuer',
177: #                                                                       },
178: #                                                                      ],
179: #                                                      module_name => 'Heccer',
180: #                                                      package => 'Heccer::DES',
181: #                                                     },
182:                                       des => {
183:                                               compilation_priority => 'events',
184:                                               module_name => 'Heccer',
185:                                               package => 'Heccer::DES',
186:                                               service_name => 'model_container',
187:                                              },
188:                                      },
189:                    },
190:                   );
191: 
192:     use YAML;
193: 
194:     my $scheduler_yaml;
195: 
196:     {
197:         local $/;
198: 
199:         if (-e "./yaml/$modelname.yml")
200:         {
201:             $scheduler_yaml = Load(`cat ./yaml/$modelname.yml`);
202:         }
203:     }
204: 
205:     # run the schedule
206: 
207:     $scheduler->run();
208: }
209: 
210: 
211: main();
212: 
213: 
214: exit 0;
215: 
216: 
217: