26 " start >= end is not allowed.");
28 double start_sin = std::sin(start);
29 double end_sin = std::sin(end);
30 double step = (end_sin - start_sin) / (m_nbins - 1);
32 m_bin_centers.resize(m_nbins, 0.0);
33 for (
size_t i = 0; i < m_bin_centers.size(); ++i) {
34 m_bin_centers[i] = std::asin(start_sin + i * step);
37 std::vector<double> bin_boundaries;
38 bin_boundaries.resize(m_nbins + 1, 0.0);
39 for (
size_t i = 0; i < bin_boundaries.size(); ++i) {
40 bin_boundaries[i] = std::asin(start_sin - step / 2. + step * i);
42 setBinBoundaries(bin_boundaries);
55 Bin1D result(m_bin_centers[index], m_bin_centers[index]);
59 std::vector<double> CustomBinAxis::getBinCenters()
const
70 void CustomBinAxis::print(std::ostream& ostr)
const
72 ostr <<
"CustomBinAxis(\"" <<
getName() <<
"\", " <<
size() <<
", "
73 << std::setprecision(std::numeric_limits<double>::digits10 + 2) << m_start <<
", " << m_end
77 bool CustomBinAxis::equals(
const IAxis& other)
const
79 if (!IAxis::equals(other))
82 if (
size() != otherAxis->size())
Defines and implements namespace algo with some algorithms.
Defines class CustomBinAxis.
Defines many exception classes in namespace Exceptionss.
Axis with fixed bin size in sin(angle) space used for numerical comparison with IsGisaxs.
CustomBinAxis * createClippedAxis(double left, double right) const
Creates a new clipped axis.
CustomBinAxis * clone() const
clone function
CustomBinAxis(const std::string &name, size_t nbins, double start, double end)
CustomBinAxis constructor.
Bin1D getBin(size_t index) const
retrieve a 1d bin for the given index
Interface for one-dimensional axes.
std::string getName() const
retrieve the label of the axis
Axis with variable bin size.
size_t size() const
retrieve the number of bins
bool almostEqual(double a, double b)
Returns true if two doubles agree within machine epsilon.