7#ifndef GOOSEEYE_ENSEMBLE_HPP
8#define GOOSEEYE_ENSEMBLE_HPP
15 : m_periodic(periodic), m_variance(variance), m_shape_orig(roi)
19 m_first = xt::atleast_3d(xt::zeros<double>(m_shape_orig));
20 m_second = zeros_like(m_first);
21 m_norm = zeros_like(m_first);
22 m_shape = std::vector<size_t>(m_first.shape().begin(), m_first.shape().end());
23 m_pad = detail::pad_width(m_shape);
30 if (m_stat == Type::heightheight) {
31 ret = xt::pow(ret, 0.5);
34 return ret.reshape(m_shape_orig);
43 if (m_stat == Type::heightheight) {
44 ret = xt::pow(ret, 0.5);
46 else if (m_stat != Type::mean) {
47 throw std::runtime_error(
"Not implemented");
50 return ret.reshape(m_shape_orig);
56 return ret.reshape(m_shape_orig);
62 return ret.reshape(m_shape_orig);
68 return ret.reshape(m_shape_orig);
74 axis = detail::atleast_3d_axis(m_shape_orig.size(), axis);
79 -1.0 *
static_cast<double>(m_pad[axis][0]),
80 static_cast<double>(m_pad[axis][1]),
83 for (
size_t h = 0; h < m_shape[0]; ++h) {
84 for (
size_t i = 0; i < m_shape[1]; ++i) {
85 for (
size_t j = 0; j < m_shape[2]; ++j) {
100 return ret.reshape(m_shape_orig);
107 for (
size_t i = 0; i < m_shape_orig.size(); ++i) {
108 ret += xt::pow(this->
distance(i), 2.0);
111 return xt::pow(ret, 0.5);
120 for (
size_t i = 0; i < m_shape_orig.size(); ++i) {
121 ret += xt::pow(this->
distance(i) * h[i], 2.0);
124 return xt::pow(ret, 0.5);
130 return this->
distance(axis) * h[axis];
array_type::array< double > data_second() const
Get raw-data: ensemble sum of the second moment: x_1^2 + x_2^2 + ...
Ensemble()=default
Constructor.
array_type::array< double > variance() const
Get ensemble variance.
array_type::array< double > data_first() const
Get raw-data: ensemble sum of the first moment: x_1 + x_2 + ...
array_type::array< double > distance() const
Get the relative distance of each pixel in the 'region-of-interest' to its center.
array_type::array< double > result() const
Get ensemble average.
array_type::array< double > norm() const
Get raw-data: normalisation (number of measurements per pixel).
#define GOOSEEYE_ASSERT(expr, assertion)
All assertions are implemented as:
xt::xtensor< T, N > tensor
Fixed (static) rank array.
Toolbox to compute statistics.