Header file of the functions to read settings from file, launch the calculations and save the results.
More...
|
void | check_required_keys_presence (const json &settings, std::vector< std::string > list_of_keys) |
| Check that all keys in list_of_keys are present in settings, otherwise terminate the program with EXIT_FAILURE. More...
|
|
std::vector< double > | range_generator (const json &settings, std::string which) |
| If "which"_min, "which"_max and "which"_step parameter are present in settings, returns a vector of linearly spaced values from min to max (spaced by step). If "which"_min, "which"_max and "which"_step are not present but "which" is, returns a vector with the single value specified by the setting parameter "which". If both previous conditions are not satisfied, terminates the program with EXIT_FAILURE. More...
|
|
std::vector< double > | log_range_generator (const json &settings, std::string which) |
| If "which"_min, "which"_max and "which"_points_per_decade parameter are present in settings, returns a vector of log10-spaced values from min to max (with points_per_decade between each power of 10). If "which"_min, "which"_max and "which"_step are not present but "which" is, returns a vector with the single value specified by the setting parameter "which". If both previous conditions are not satisfied, terminates the program with EXIT_FAILURE. More...
|
|
void | print_progress_bar (double progress) |
| Prints a progress bar on standard output. More...
|
|
json | read_settings (std::string filename="settings.json") |
| Read settings for the simulation from json file, and returns them as a json dictionary-like object If file cannot be opened, or it is not correctly parsed, or the "CALC_TYPE" key is missing, terminates the program with EXIT_FAILURE. More...
|
|
void | single_run (const json &settings) |
| Perform a single run for the given parameters in setting, printing a summary of the results on standard output. More...
|
|
void | sweep (const json &settings) |
| Perform multiple runs for different values of the beta, H and GAMMA parameters, sweeping the range between the min and max values indicated in settings, with the step value also specified in settings. If min/max/step values for more than one parameter are provided, all combinations are calculated. The results are written in a csv file, with each row corresponding to a single run. More...
|
|
void | convergence_test (const json &settings) |
| Perform a convergence test on the number of steps for the MCMC algorithm, by performing multiple runs for different number of steps (keeping the same seed), to avoid random fluctuations that could make the result unclear. The values of the N_total_steps are taken the range between the min and max values indicated in settings, in log10-scale, with the specified "points_per_decade". The results are written in a csv file, with each row corresponding to a single run. More...
|
|
void | launch_calculations (std::string settings_filename) |
| Call the read_settings function to read settings from file, and select which calculation to run. More...
|
|
Header file of the functions to read settings from file, launch the calculations and save the results.
- Author
- Enrico Pedretti
- Date
- 2023-09-03
Definition in file setup.h.
void convergence_test |
( |
const json & |
settings | ) |
|
Perform a convergence test on the number of steps for the MCMC algorithm, by performing multiple runs for different number of steps (keeping the same seed), to avoid random fluctuations that could make the result unclear. The values of the N_total_steps are taken the range between the min and max values indicated in settings, in log10-scale, with the specified "points_per_decade". The results are written in a csv file, with each row corresponding to a single run.
- Parameters
-
settings | dictionary-like nlohmann::json object, with the settings for running the algorithm |
std::vector< double > log_range_generator |
( |
const json & |
settings, |
|
|
std::string |
which |
|
) |
| |
If "which"_min, "which"_max and "which"_points_per_decade parameter are present in settings, returns a vector of log10-spaced values from min to max (with points_per_decade between each power of 10). If "which"_min, "which"_max and "which"_step are not present but "which" is, returns a vector with the single value specified by the setting parameter "which". If both previous conditions are not satisfied, terminates the program with EXIT_FAILURE.
- Parameters
-
settings | dictionary-like nlohmann::json object, with the settings for running the algorithm |
which | Name of the parameter for the algorithm, e.g. "N_total_steps" |
- Returns
- std::vector<double> containing a the (one or more) values of the 'which' parameter
std::vector< double > range_generator |
( |
const json & |
settings, |
|
|
std::string |
which |
|
) |
| |
If "which"_min, "which"_max and "which"_step parameter are present in settings, returns a vector of linearly spaced values from min to max (spaced by step). If "which"_min, "which"_max and "which"_step are not present but "which" is, returns a vector with the single value specified by the setting parameter "which". If both previous conditions are not satisfied, terminates the program with EXIT_FAILURE.
- Parameters
-
settings | dictionary-like nlohmann::json object, with the settings for running the algorithm |
which | Name of the parameter for the algorithm, e.g. "H", or "GAMMA" |
- Returns
- std::vector<double> containing a the (one or more) values of the 'which' parameter
void sweep |
( |
const json & |
settings | ) |
|
Perform multiple runs for different values of the beta, H and GAMMA parameters, sweeping the range between the min and max values indicated in settings, with the step value also specified in settings. If min/max/step values for more than one parameter are provided, all combinations are calculated. The results are written in a csv file, with each row corresponding to a single run.
- Parameters
-
settings | dictionary-like nlohmann::json object, with the settings for running the algorithm |