-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLIF_spike.h
103 lines (86 loc) · 3.1 KB
/
LIF_spike.h
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#ifndef LIF_SPIKE_H
#define LIF_SPIKE_H
#include "LIF_constants.h"
class LIF_spike {
public:
LIF_spike(int N = 5);
~LIF_spike();
// Create a matrix of spikes of size Tstop*N
// where N corresponds to the number of neurons
// and Tstop corresponds to the time/time_bins
void create_XIF_data(double gamma, double lambda, double sigma,
std::string neuron_model);
void seed_ran_gen(int seed);
// Zeros all data. This needs to be called each time when you are
// intending to re-use a LIF_spike.
void zero_LIF_data();
void print_statistics();
void print_statistics_to_file(std::string preamble, double identifier,
int loop_iteration, int i, int j);
private:
void num_of_neurons(int N);
void DG_gen_spike_matrix();
void LIF_gen_spike_matrix();
void EIF_gen_spike_matrix();
void count_double_spikes();
void calculate_spike_statistics();
void calculate_probability_dist();
void calc_coeff_of_var();
// Number of neurons.
int N;
// Input statistics:
// gamma = mean of input
// lambda = correlation strength of gaussian.
double gamma, lambda, sigma;
// Output statistics:
// mu = mean firing rate of output
// rho = correlation coefficient of output
// cv = coefficient of variation
double mu, rho, cv;
// To keep track of times when there are multiple
// spikes in the same bin.
double double_count;
// The probability distribution P(x).
std::vector<double> *P;
// The matrix to hold the spikes.
// It will have TSTOP rows and N columns.
boost::numeric::ublas::matrix<int> spikes;
// For the GSL random number generator.
gsl_rng *r;
};
typedef struct {
double gamma;
double lambda;
double sigma;
double upper_lim;
double lower_lim;
} parameters_t;
// Helper functions:
char progress_bar(int percentage);
// Each of these gives ones of the curves in the Macke figures.
void figure_1a_components(const parameters_t& XIF_params,
std::string neuron_model, int loop_iteration);
void figure_1b_components(const parameters_t& XIF_params,
std::string neuron_model, double subplot, int loop_iteration);
void figure_2a_components(const parameters_t& XIF_params,
std::string neuron_model, double subplot, int loop_iteration, int num_neurons);
void fig_2mu_comps(const parameters_t& XIF_params, std::string neuron_model,
double subplot, int loop_iteration, int num_neurons);
// Each of these creates the figures in Macke 2011.
void create_figure_1a(double subplot, std::string neuron_model,
int loop_iteration);
void create_figure_1b(double subplot, std::string neuron_model,
int loop_iteration);
void create_figure_2a(double subplot, std::string neuron_model,
int loop_iteration);
void create_custom(double subplot, std::string neuron_model,
int loop_iteration);
void paper_fig_2_const_mu(double subplot, std::string neuron_model,
int loop_iteration, int num_neurons);
void paper_fig_2_const_rho(double subplot, std::string neuron_model,
int loop_iteration, int num_neurons);
void figure_control(std::string figure_name, double subplot,
std::string neuron_model, int loop_iteration);
void paper_figure_control(std::string figure_name, double subplot,
std::string neuron_model, int loop_iteration, int num_neurons);
#endif