-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathactivitySimulator.hpp
62 lines (50 loc) · 1.27 KB
/
activitySimulator.hpp
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
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef SIMUL_H
#define SIMUL_H
#include <boost/python.hpp>
#include <boost/variant.hpp>
#include "tools/convertor.hpp"
namespace py = boost::python;
typedef boost::variant<double, std::string, int, bool> var;
typedef std::map<std::string, var>::iterator it_mapParam;
/*
***
* Simulator class
***********************/
class Simulator {
public:
Simulator();
Simulator(int numNeurons, std::vector<size_t> vecIndPtr, std::vector<int> vecIndices, std::vector<double> vecData, std::map<std::string, var> mapParam);
~Simulator();
// set parameters
void setParam();
// start simulation
void start();
// get results
py::object get_results();
double m_rTimeStep;
private:
Convertor m_convertor;
// simulation
void runSimulation();
// main objects
std::map<std::string, var> m_mapParam;
std::vector<size_t> m_vecIndPtr;
std::vector<int> m_vecIndices;
std::vector<double> m_vecData;
// network parameters
std::vector<double> initPotential();
std::vector<double> initRestPotential();
bool m_bRunning;
int m_nNeurons;
// the neuron parameters
double m_rThreshold;
double m_rLeak;
double m_rRefrac;
int m_nRefrac;
// the simulation parameters
double m_rSimulTime;
double m_rSqrtStep;
int m_nTotStep;
double m_rNoiseStdDev;
};
#endif