19#ifndef OBSERVABLES_PROFILEOBSERVABLE_HPP
20#define OBSERVABLES_PROFILEOBSERVABLE_HPP
39 std::array<std::pair<double, double>, 3> m_limits;
41 std::array<std::size_t, 3> m_n_bins;
45 double max_x,
double min_y,
double max_y,
double min_z,
47 : m_limits{{std::make_pair(min_x, max_x), std::make_pair(min_y, max_y),
48 std::make_pair(min_z, max_z)}},
49 m_n_bins{{
static_cast<std::size_t
>(n_x_bins),
50 static_cast<std::size_t
>(n_y_bins),
51 static_cast<std::size_t
>(n_z_bins)}} {
53 throw std::runtime_error(
"max_x has to be > min_x");
55 throw std::runtime_error(
"max_y has to be > min_y");
57 throw std::runtime_error(
"max_z has to be > min_z");
59 throw std::domain_error(
"n_x_bins has to be >= 1");
61 throw std::domain_error(
"n_y_bins has to be >= 1");
63 throw std::domain_error(
"n_z_bins has to be >= 1");
66 std::vector<std::size_t>
shape()
const override {
67 return {m_n_bins[0], m_n_bins[1], m_n_bins[2]};
70 auto n_bins()
const {
return m_n_bins; }
72 auto limits()
const {
return m_limits; }
75 std::array<std::vector<double>, 3>
edges()
const {
76 std::array<std::vector<double>, 3> profile_edges = {
77 {std::vector<double>(m_n_bins[0u] + 1u),
78 std::vector<double>(m_n_bins[1u] + 1u),
79 std::vector<double>(m_n_bins[2u] + 1u)}};
80 for (
auto i = 0u; i < 3u; ++i) {
84 profile_edges[i].begin());
Base class for observables.
Cartesian profile observable.
std::array< std::vector< double >, 3 > edges() const
Calculate the bin edges for each dimension.
std::vector< std::size_t > shape() const override
ProfileObservable(int n_x_bins, int n_y_bins, int n_z_bins, double min_x, double max_x, double min_y, double max_y, double min_z, double max_z)
auto make_lin_space(T start, T stop, std::size_t number, bool endpoint=true)
Equally spaced values in interval.