summaryrefslogtreecommitdiff
path: root/core/all_spikes.cpp
blob: 5307e8b10b075141a2b72be0a2911b40cdd822d8 (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
47
48
49
#include <assert.h>
#include <errno.h>
#include <iostream>
#include <stdlib.h>

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

#include "mempool.hpp"

using namespace std;

int main(int argc, char **argv) {
  // read cmd line params
  assert(argc == 3);

  errno = 0;
  char *tail;
  Time start(strtod( argv[1], &tail)); assert(*tail == 0);
  Time stop( strtod( argv[2], &tail)); assert(*tail == 0);
  assert(errno == 0);

  assertSimDir();

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

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

    // output
    cout << "# time\tneuron" << endl;
    while (cur <= idx.last() && idx.time(cur) <= stop) {
      if (idx.src(cur) < numActualNeurons) // don't plot pseudo neurons
	// cout << idx.eventTime(cur) << "\t" << idx.src(cur) << endl;
	cout << idx.time(cur) << "\t" << idx.src(cur) << endl;
      ++cur;
    }
  }

  return 0;
}
contact: Jan Huwald // Impressum