diff options
Diffstat (limited to 'core/spike_out.cpp')
-rw-r--r-- | core/spike_out.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/core/spike_out.cpp b/core/spike_out.cpp new file mode 100644 index 0000000..2626353 --- /dev/null +++ b/core/spike_out.cpp @@ -0,0 +1,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; +} |