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/cells/$modelname.ndf" ];
057: 
058:     # instantiate a scheduler
059: 
060:     my $scheduler
061:         = SSP->new(
062:                    {
063:                     apply => {
064:                               simulation => [
065:                                              {
066:                                               arguments => [ 40000, { verbose => 2, }, ],
067:                                               method => 'steps',
068:                                              },
069:                                             ],
070:                              },
071:                     models => [
072:                                {
073:                                 modelname => "/$modelname",
074:                                 granular_parameters => [
075:                                                         {
076:                                                          component_name => "/$modelname/segments/soma",
077:                                                          field => 'INJECT',
078:                                                          value => 3e-10,
079:                                                         },
080:                                                        ],
081:                                 solverclass => "heccer",
082:                                },
083:                               ],
084:                     name => $modelname,
085:                     outputclasses => {
086:                                       double_2_ascii => {
087:                                                          options => {
088:                                                                      filename => '/tmp/output',
089:                                                                      output_mode => 'steps',
090:                                                                     },
091:                                                          module_name => 'Heccer',
092:                                                          package => 'Heccer::Output',
093:                                                         },
094:                                      },
095:                     outputs => [
096:                                 {
097:                                  component_name => "/$modelname/segments/soma",
098:                                  field => 'Vm',
099:                                  outputclass => 'double_2_ascii',
100:                                 },
101:                                ],
102:                     services => {
103:                                  model_container => {
104:                                                  initializers => [
105:                                                                   {
106:                                                                    arguments => [ $args, ],
107:                                                                    method => 'read',
108:                                                                   },
109:                                                                  ],
110:                                                  module_name => 'Neurospaces',
111:                                                 },
112:                                 },
113:                     solverclasses => {
114:                                       heccer => {
115:                                                  constructor_settings => {
116:                                                                           configuration => {
117:                                                                                             reporting => {
118:                                                                                                           granularity => 10000,
119:                                                                                                           tested_things => (
120:                                                                                                                             $SwiggableHeccer::HECCER_DUMP_VM_COMPARTMENT_MATRIX
121:                                                                                                                             | $SwiggableHeccer::HECCER_DUMP_VM_COMPARTMENT_MATRIX_DIAGONALS
122:                                                                                                                             | $SwiggableHeccer::HECCER_DUMP_VM_COMPARTMENT_OPERATIONS
123:                                                                                                                             | $SwiggableHeccer::HECCER_DUMP_VM_MECHANISM_DATA
124:                                                                                                                             | $SwiggableHeccer::HECCER_DUMP_VM_MECHANISM_OPERATIONS
125:                                                                                                                             | $SwiggableHeccer::HECCER_DUMP_VM_SUMMARY
126:                                                                                                                            ),
127:                                                                                                          },
128:                                                                                            },
129:                                                                           dStep => 5e-7,
130:                                                                          },
131:                                                  module_name => 'Heccer',
132:                                                  service_name => 'model_container',
133:                                                 },
134:                                      },
135:                    },
136:                   );
137: 
138:     use YAML;
139: 
140:     my $scheduler_yaml;
141: 
142:     {
143:         local $/;
144: 
145:         if (-e "./yaml/$modelname.yml")
146:         {
147:             $scheduler_yaml = Load(`cat ./yaml/$modelname.yml`);
148:         }
149:     }
150: 
151:     # run the schedule
152: 
153:     $scheduler->run();
154: 
155:     system 'cat /tmp/output';
156: }
157: 
158: 
159: main();
160: 
161: 
162: exit 0;
163: 
164: 
165: