summaryrefslogtreecommitdiff
path: root/core/spike_out.cpp
blob: 2626353ad92dcbbf2afee2ca54e5387b0731d75f (plain)
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
#include <assert.h>
#include <errno.h>
#include <iostream>
#include <stdlib.h>

#include "everything_else.hpp"
#include "index.hpp"
#include "index_spike.hpp"

#include "mempool.hpp"

using namespace std;

int main(int argc, char **argv) {
  // read cmd line params
  assert(argc == 4);
  errno = 0;
  char *tail;
  Ptr<Neuron> addr(strtoul(argv[1], &tail, 10)); assert(*tail == 0);
  Time       start(strtod( argv[2], &tail));     assert(*tail == 0);
  Time        stop(strtod( argv[3], &tail));     assert(*tail == 0);
  assert(errno == 0);
  assert(addr() < Ptr<Neuron>::numInstances());

  assertSimDir();

  {
    // go to first spike with time >= start
    Index<Spike> idx;
    Ptr<Spike>::ptr_t cur(idx.first(start, addr));

    // no spike found?
    if (cur == idx.nil())
      return 0;

    // output
    cout << "# time of outgoing spikes from neuron " << addr() 
	 << " between " << start()  << " and " << stop() << endl;
    while (cur != idx.nil() && idx.time(cur) <= stop) {
      cout << idx.time(cur) << endl;
      cur = idx.next(cur);
    }
  }

  return 0;
}
contact: Jan Huwald // Impressum