13 return obs.
p.first != 0.0 || obs.
p.second != 0.0;
16static void append_schema_for_values(std::vector<std::string>& cols,
17 std::set<std::string>& seen,
20 const std::vector<ObservableValue>& vals)
22 auto add_col = [&](std::string key) {
23 if (seen.insert(key).second) {
24 cols.push_back(std::move(key));
33 if (!vals[0].bin.has_value()) {
38 for (
const auto& v :
vals) {
39 if (!
v.bin.has_value()) {
44 const auto& br =
v.bin.value();
45 add_col(
obs_key_bin(obs, ord, br.first, br.second));
49static void write_values(std::unordered_map<std::string, Value>& outY,
52 const std::vector<ObservableValue>& vals)
55 outY[
obs_key(obs, ord)] = std::numeric_limits<double>::quiet_NaN();
59 if (!vals[0].bin.has_value()) {
64 for (
const auto& v :
vals) {
65 if (!
v.bin.has_value()) {
70 const auto& br =
v.bin.value();
71 outY[
obs_key_bin(obs, ord, br.first, br.second)] =
v.value;
78 std::string k =
"OBS:";
90 std::string k =
obs_key(obs, ord);
92 k += std::to_string(bmin);
94 k += std::to_string(bmax);
100 std::vector<std::string> cols;
101 std::set<std::string> seen;
106 std::sort(current.begin(), current.end());
108 for (
const auto& obs : current) {
109 if (has_specific_bin(obs)) {
110 const auto key =
obs_key_bin(obs.s, ord_, obs.p.first, obs.p.second);
111 if (seen.insert(key).second) {
118 append_schema_for_values(cols, seen, obs.s, ord_, vals);
130 std::sort(current.begin(), current.end());
132 for (
const auto& obs : current) {
133 if (has_specific_bin(obs)) {
136 const auto br = v.bin.value_or(obs.p);
137 outY[
obs_key_bin(obs.s, ord_, br.first, br.second)] = v.value;
142 write_values(outY, obs.s, ord_, vals);
static std::string str(const IdOf< QCDOrderTag > &id)
Returns the string representation associated with an identifier.
std::vector< BinnedObservableId > get_current_observables()
Return the set of currently registered observables.
std::vector< ObservableValue > compute_observable(Observables obs) const
Compute a theory prediction for an observable (enum API).
void enable_obs()
Force enabling/re-enabling currently registered observables.
const std::string & str() const
Returns the underlying string.
Identifies an observable together with a numerical bin.
std::pair< double, double > p