Commit b99f88ce authored by Lukas Weber's avatar Lukas Weber
Browse files

don’t include empty evalables to begin with

parent 3d9b4a5a
......@@ -42,10 +42,10 @@ class MCArchive:
o.error = np.zeros([self.num_tasks, len(value['error'])]) + np.nan
if o.mean.shape != o.error.shape:
raise 'observable "{}": dimension mismatch between mean and error'.format(obs)
raise Exception('observable "{}": dimension mismatch between mean and error'.format(obs))
else:
if len(value['mean']) != o.mean.shape[1] or len(value['error']) != o.error.shape[1]:
raise 'observable "{}": dimension mismatch between different tasks'.format(obs)
raise Exception('observable "{}": dimension mismatch between different tasks'.format(obs))
o.mean[i,:] = value['mean']
o.error[i,:] = value['error']
......
#include "evalable.h"
#include "measurements.h"
#include <fmt/format.h>
#include <map>
#include <iostream>
#include <map>
namespace loadl {
......@@ -28,7 +28,10 @@ void evalable::jackknife(const results &res, observable_result &obs_res) const {
size_t bin_count = -1; // maximal value
for(const auto &obs_name : used_observables_) {
if(res.observables.count(obs_name) <= 0) {
std::cerr << fmt::format("Warning: evalable '{}': used observable '{}' not found in Monte Carlo results. Skipping...", name_, obs_name);
std::cerr << fmt::format(
"Warning: evalable '{}': used observable '{}' not found in Monte Carlo results. "
"Skipping...",
name_, obs_name);
return;
}
const auto &obs = res.observables.at(obs_name);
......
......@@ -13,9 +13,13 @@ namespace loadl {
static void evaluate_evalables(results &res, const std::vector<evalable> &evalables) {
std::vector<observable_result> evalable_results;
for(auto &eval : evalables) {
evalable_results.emplace_back();
observable_result o;
eval.jackknife(res, o);
eval.jackknife(res, evalable_results.back());
// don’t include empty results
if(o.rebinning_bin_count > 0) {
evalable_results.emplace_back(o);
}
}
for(auto &eval : evalable_results) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment