SNABSuite
0.x
Spiking Neural Architecture Benchmark Suite
|
Collection of usefull Utilities not directly related to spiking networks. More...
#include <utilities.hpp>
Static Public Member Functions | |
static std::vector< std::string > & | split (const std::string &s, char delim, std::vector< std::string > &elems) |
Splits a string s into parts devided by delim and stores the result in elems and returns it. More... | |
static std::vector< std::string > | split (const std::string &s, char delim) |
The same as Utilities::split, but only returning the vector. More... | |
static void | progress_callback (double p) |
Funtion for generating a progress bar on terminal. More... | |
template<typename T > | |
static void | calculate_statistics (const std::vector< T > &data, T &min, T &max, double &avg, double &std_dev) |
Calculating statistics of a vector, using an estimator for std_dev (sample covariance) More... | |
template<typename T > | |
static void | write_vector_to_csv (T &data, std::string file_name) |
Writes a vector to a csv. More... | |
template<typename T > | |
static void | write_vector2_to_csv (T &data, std::string file_name, std::string first_line="") |
Writes a 2D vector to a csv. More... | |
static Json | merge_json (const Json &a, const Json &b) |
Merge two json objects. Note: Values already included in a will be overwritten! See github for source. More... | |
static Json | manipulate_backend_string (std::string &backend, Json &json) |
Merge the backend strings with a provided json object. Note: options already included in backend will not be overwritten! More... | |
static void | plot_spikes (std::string filename, std::string simulator) |
Given a filename of a csv with list of spikes this will produce a raster plot. More... | |
static void | plot_histogram (std::string filename, std::string simulator, bool normalized, int n_bins, std::string title) |
Plotting a histogram a one dimensional data in a csv. More... | |
static void | plot_voltages_spikes (std::string filename, std::string simulator, size_t mem_col=1, size_t t_col=0, std::string spikes_file="", size_t spikes_col=0) |
Plotting membrane voltage and (optional) plotting vertical lines for spikes on top. More... | |
static void | plot_1d_curve (std::string filename, std::string simulator, size_t x_col, size_t y_col, int std_dev_vol=-1) |
Plotting a curve with optional standard deviation. More... | |
Collection of usefull Utilities not directly related to spiking networks.
Definition at line 43 of file utilities.hpp.
|
inlinestatic |
Calculating statistics of a vector, using an estimator for std_dev (sample covariance)
data | contains sample data |
min | object for minimal value |
max | object for maximal value |
avg | object for sample average |
std_dev | object for smaple covariance |
Definition at line 82 of file utilities.hpp.
|
static |
Merge the backend strings with a provided json object. Note: options already included in backend will not be overwritten!
backend | string containig "[backend]" (+ "={setup options}"), will contain combined setup after execution |
json | Object containig additional options for backend |
|
static |
Merge two json objects. Note: Values already included in a will be overwritten! See github for source.
a | target json, keys will b overwritten |
b | source json, will be copied into a |
|
static |
Plotting a curve with optional standard deviation.
filename | file containing data |
simulator | the (unshortened) backend/simulator string |
x_col | column of x values |
y_col | column of y values |
std_dev_vol | column of standard deviation values |
|
static |
Plotting a histogram a one dimensional data in a csv.
filename | File and path to the csv |
simulator | simulator string, options will be stripped insider |
normalized | flag whether histogram should be normalized |
n_bins | number of bins for the histogram, negative values use 'auto' in pyplot |
title | title to be plotted on top of histogram |
|
static |
Given a filename of a csv with list of spikes this will produce a raster plot.
filename | name and path to a csv |
simulator | simulator string, simulator options will be stripped inside |
|
static |
Plotting membrane voltage and (optional) plotting vertical lines for spikes on top.
filename | name of the file containing membrane voltage, csv style |
simulator | the (unshortened) backend/simulator string |
mem_col | column containing the membrane potential (default = 1) |
t_col | column containing the time values (default = 0) |
spikes_file | (optional) file containing spikes of the same neuron |
spikes_col | column of spike data in spikes_file |
|
static |
Funtion for generating a progress bar on terminal.
p | value between 0 and 1 representing current progress |
|
static |
Splits a string s into parts devided by delim and stores the result in elems and returns it.
s | string to be splitted |
delim | char which seperated the strings |
elems | container in which result is appended at the end |
|
static |
The same as Utilities::split, but only returning the vector.
s | string to be splitted |
delim | char which seperated the strings |
|
inlinestatic |
Writes a 2D vector to a csv.
T | Type of data e.g. vector of a vector of ints, iterator musst support '<<' for output |
data | Reference to the data |
file_name | string containing filename, make sure folders already exists |
Definition at line 147 of file utilities.hpp.
|
inlinestatic |
Writes a vector to a csv.
T | Type of data e.g. vector of ints, iterator musst support '<<' for output |
data | Reference to the data |
file_name | string containing filename, make sure folders already exists |
Definition at line 121 of file utilities.hpp.