24 throw std::runtime_error(
"CustomBinAxis::CustomBinAxis() -> Error."
25 " start >= end is not allowed.");
27 double start_sin = std::sin(start);
28 double end_sin = std::sin(end);
29 double step = (end_sin - start_sin) / (
m_nbins - 1);
36 std::vector<double> bin_boundaries;
37 bin_boundaries.resize(
m_nbins + 1, 0.0);
38 for (
size_t i = 0; i < bin_boundaries.size(); ++i) {
39 bin_boundaries[i] = std::asin(start_sin - step / 2. + step * i);
52 throw std::runtime_error(
"CustomBinAxis::bin() -> Error. Wrong index.");
65 throw std::runtime_error(
"VariableBinAxis::CustomBinAxis() -> Error."
71 ostr <<
"CustomBinAxis(\"" <<
getName() <<
"\", " <<
size() <<
", "
72 << std::setprecision(std::numeric_limits<double>::digits10 + 2) <<
m_start <<
", " <<
m_end
81 if (
size() != otherAxis->size())
Defines and implements namespace algo with some algorithms.
Defines class CustomBinAxis.
Axis with fixed bin size in sin(angle) space used for numerical comparison with IsGisaxs.
Bin1D bin(size_t index) const
retrieve a 1d bin for the given index
CustomBinAxis * createClippedAxis(double left, double right) const
Creates a new clipped axis.
void print(std::ostream &ostr) const
CustomBinAxis * clone() const
clone function
bool equals(const IAxis &other) const
CustomBinAxis(const std::string &name, size_t nbins, double start, double end)
CustomBinAxis constructor.
std::vector< double > m_bin_centers
std::vector< double > binCenters() const
Interface for one-dimensional axes.
virtual bool equals(const IAxis &other) const
std::string getName() const
retrieve the label of the axis
Axis with variable bin size.
size_t size() const
retrieve the number of bins
void setBinBoundaries(const std::vector< double > &bin_boundaries)
QString const & name(EShape k)
bool almostEqual(double a, double b)
Returns true if two doubles agree within machine epsilon.