diff --git a/Core/Fitting/FitObjective.cpp b/Core/Fitting/FitObjective.cpp index 16b667afdf6316d33e92c177d8d51a0c9ab5bf92..92b4286d0e8294ee2a21d0f60fb05a93c6073b78 100644 --- a/Core/Fitting/FitObjective.cpp +++ b/Core/Fitting/FitObjective.cpp @@ -68,19 +68,19 @@ FitObjective::~FitObjective() = default; //! Constructs simulation/data pair for later fit. //! @param builder: simulation builder capable of producing simulations //! @param data: experimental data array -//! @param uncertainties: data uncertainties array +//! @param stdv: data uncertainties array //! @param weight: weight of dataset in metric calculations void FitObjective::addSimulationAndData(simulation_builder_t builder, const OutputData<double>& data, - std::unique_ptr<OutputData<double>> uncertainties, + std::unique_ptr<OutputData<double>>&& stdv, double weight) { - m_fit_objects.emplace_back(builder, data, std::move(uncertainties), weight); + m_fit_objects.emplace_back(builder, data, std::move(stdv), weight); } double FitObjective::evaluate(const mumufit::Parameters& params) { - run_simulations(params); + execSimulations(params); const double metric_value = m_metric_module->compute(m_fit_objects, params.size()); m_fit_status->update(params, metric_value); return metric_value; @@ -225,17 +225,17 @@ bool FitObjective::isFirstIteration() const return iterationInfo().iterationCount() == 1; } -void FitObjective::run_simulations(const mumufit::Parameters& params) +void FitObjective::execSimulations(const mumufit::Parameters& params) { if (m_fit_status->isInterrupted()) throw std::runtime_error("Fitting was interrupted by the user."); if (m_fit_objects.empty()) - throw std::runtime_error("FitObjective::run_simulations() -> Error. " + throw std::runtime_error("FitObjective::execSimulations() -> Error. " "No simulation/data defined."); for (auto& obj : m_fit_objects) - obj.runSimulation(params); + obj.execSimulation(params); } void FitObjective::setChiSquaredModule(const IChiSquaredModule& module) diff --git a/Core/Fitting/FitObjective.h b/Core/Fitting/FitObjective.h index 143edb0b0248443206cc7ec74b2485cea3adf91f..c0be95b08d26035bc5f8acdd3b2c2aeb6e6de0f6 100644 --- a/Core/Fitting/FitObjective.h +++ b/Core/Fitting/FitObjective.h @@ -27,7 +27,10 @@ class ObjectiveMetric; class PyBuilderCallback; class PyObserverCallback; -//! Holds vector of `SimDataPair`s (experimental data and simulation results) for use in fitting. +//! Holds vector of SimDataPair%s (experimental data and simulation results) for use in fitting. +//! Thereby supports simultaneous fitting of several data sets and model functions, +//! as demonstrated in example fit52/multiple_datasets. + //! @ingroup fitting_internal class FitObjective { @@ -39,7 +42,7 @@ public: #ifndef SWIG void addSimulationAndData(simulation_builder_t builder, const OutputData<double>& data, - std::unique_ptr<OutputData<double>> uncertainties, + std::unique_ptr<OutputData<double>>&& stdv, double weight = 1.0); #endif //! Constructs simulation/data pair for later fit. @@ -56,14 +59,14 @@ public: //! Constructs simulation/data pair for later fit. //! @param callback: simulation builder capable of producing simulations //! @param data: experimental data array - //! @param uncertainties: data uncertainties array + //! @param stdv: data uncertainties array //! @param weight: weight of dataset in metric calculations template <class T> - void addSimulationAndData(PyBuilderCallback& callback, const T& data, const T& uncertainties, + void addSimulationAndData(PyBuilderCallback& callback, const T& data, const T& stdv, double weight = 1.0) { addSimulationAndData(simulationBuilder(callback), *ArrayUtils::createData(data), - ArrayUtils::createData(uncertainties), weight); + ArrayUtils::createData(stdv), weight); } virtual double evaluate(const mumufit::Parameters& params); @@ -93,12 +96,12 @@ public: mumufit::MinimizerResult minimizerResult() const; - //! Should be explicitely called on last iteration to notify all observers. + //! Should be explicitly called on last iteration to notify all observers. void finalize(const mumufit::MinimizerResult& result); unsigned fitObjectCount() const; - void run_simulations(const mumufit::Parameters& params); + void execSimulations(const mumufit::Parameters& params); void setChiSquaredModule(const IChiSquaredModule& module); diff --git a/Core/Fitting/FitStatus.h b/Core/Fitting/FitStatus.h index 27aa2cda6ceb9f82f9608b57365ca00c1fa21a09..4468b8d112e74c7d5642b42768d20c5b300d5a3d 100644 --- a/Core/Fitting/FitStatus.h +++ b/Core/Fitting/FitStatus.h @@ -54,7 +54,7 @@ public: mumufit::MinimizerResult minimizerResult() const; - //! Should be explicitely called on last iteration to notify all observers. + //! Should be explicitly called on last iteration to notify all observers. void finalize(const mumufit::MinimizerResult& result); private: diff --git a/Core/Fitting/ObjectiveMetric.cpp b/Core/Fitting/ObjectiveMetric.cpp index fa5801c5490dbafc80e19a6b083999c726d1425c..45714c4a2355ce632435ee3592c5eb168d281b04 100644 --- a/Core/Fitting/ObjectiveMetric.cpp +++ b/Core/Fitting/ObjectiveMetric.cpp @@ -45,10 +45,10 @@ void checkIntegrity(const std::vector<double>& sim_data, const std::vector<doubl } void checkIntegrity(const std::vector<double>& sim_data, const std::vector<double>& exp_data, - const std::vector<double>& uncertainties, + const std::vector<double>& exp_stdv, const std::vector<double>& weight_factors) { - if (sim_data.size() != uncertainties.size()) + if (sim_data.size() != exp_stdv.size()) throw std::runtime_error("Error in ObjectiveMetric: input arrays have different sizes"); checkIntegrity(sim_data, exp_data, weight_factors); @@ -86,16 +86,16 @@ Chi2Metric* Chi2Metric::clone() const } double Chi2Metric::computeFromArrays(std::vector<double> sim_data, std::vector<double> exp_data, - std::vector<double> uncertainties, + std::vector<double> exp_stdv, std::vector<double> weight_factors) const { - checkIntegrity(sim_data, exp_data, uncertainties, weight_factors); + checkIntegrity(sim_data, exp_data, exp_stdv, weight_factors); double result = 0.0; auto norm_fun = norm(); for (size_t i = 0, sim_size = sim_data.size(); i < sim_size; ++i) - if (exp_data[i] >= 0.0 && weight_factors[i] > 0.0 && uncertainties[i] > 0.0) - result += norm_fun((exp_data[i] - sim_data[i]) / uncertainties[i]) * weight_factors[i]; + if (exp_data[i] >= 0.0 && weight_factors[i] > 0.0 && exp_stdv[i] > 0.0) + result += norm_fun((exp_data[i] - sim_data[i]) / exp_stdv[i]) * weight_factors[i]; return std::isfinite(result) ? result : double_max; } @@ -152,20 +152,20 @@ LogMetric* LogMetric::clone() const } double LogMetric::computeFromArrays(std::vector<double> sim_data, std::vector<double> exp_data, - std::vector<double> uncertainties, + std::vector<double> exp_stdv, std::vector<double> weight_factors) const { - checkIntegrity(sim_data, exp_data, uncertainties, weight_factors); + checkIntegrity(sim_data, exp_data, exp_stdv, weight_factors); double result = 0.0; auto norm_fun = norm(); for (size_t i = 0, sim_size = sim_data.size(); i < sim_size; ++i) { - if (weight_factors[i] <= 0.0 || exp_data[i] < 0.0 || uncertainties[i] <= 0.0) + if (weight_factors[i] <= 0.0 || exp_data[i] < 0.0 || exp_stdv[i] <= 0.0) continue; const double sim_val = std::max(double_min, sim_data[i]); const double exp_val = std::max(double_min, exp_data[i]); double value = std::log10(sim_val) - std::log10(exp_val); - value *= exp_val * ln10 / uncertainties[i]; + value *= exp_val * ln10 / exp_stdv[i]; result += norm_fun(value) * weight_factors[i]; } diff --git a/Core/Fitting/ObjectiveMetric.h b/Core/Fitting/ObjectiveMetric.h index 37dc185ea9df7a4eac8bc09b50e3da88a0e5c598..62bfb93a203f2d58cf2c3fe90b001114e4c28213 100644 --- a/Core/Fitting/ObjectiveMetric.h +++ b/Core/Fitting/ObjectiveMetric.h @@ -44,11 +44,11 @@ public: //! All arrays involved in the computation must be of the same size. //! @param sim_data: array with simulated intensities. //! @param exp_data: array with intensity values obtained from an experiment. - //! @param uncertainties: array with experimental data uncertainties. + //! @param exp_stdv: array with experimental data uncertainties. //! @param weight_factors: user-defined weighting factors. Used linearly, no matter which norm //! is chosen. virtual double computeFromArrays(std::vector<double> sim_data, std::vector<double> exp_data, - std::vector<double> uncertainties, + std::vector<double> exp_stdv, std::vector<double> weight_factors) const = 0; //! Computes metric value from data arrays. Negative values in exp_data @@ -84,11 +84,11 @@ public: //! All arrays involved in the computation must be of the same size. //! @param sim_data: array with simulated intensities. //! @param exp_data: array with intensity values obtained from an experiment. - //! @param uncertainties: array with experimental data uncertainties. + //! @param exp_stdv: array with experimental data uncertainties. //! @param weight_factors: user-defined weighting factors. Used linearly, no matter which norm //! is chosen. double computeFromArrays(std::vector<double> sim_data, std::vector<double> exp_data, - std::vector<double> uncertainties, + std::vector<double> exp_stdv, std::vector<double> weight_factors) const override; //! Computes metric value from data arrays. Negative values in exp_data @@ -142,11 +142,11 @@ public: //! All arrays involved in the computation must be of the same size. //! @param sim_data: array with simulated intensities. //! @param exp_data: array with intensity values obtained from an experiment. - //! @param uncertainties: array with experimental data uncertainties. + //! @param exp_stdv: array with experimental data uncertainties. //! @param weight_factors: user-defined weighting factors. Used linearly, no matter which norm //! is chosen. double computeFromArrays(std::vector<double> sim_data, std::vector<double> exp_data, - std::vector<double> uncertainties, + std::vector<double> exp_stdv, std::vector<double> weight_factors) const override; //! Computes metric value from data arrays. Negative values in exp_data diff --git a/Core/Fitting/SimDataPair.cpp b/Core/Fitting/SimDataPair.cpp index ab70d32228b7c2af93deb255559f90ca2c27c4bd..b906381042338e5935450466902963f904a9c07f 100644 --- a/Core/Fitting/SimDataPair.cpp +++ b/Core/Fitting/SimDataPair.cpp @@ -35,22 +35,23 @@ std::unique_ptr<OutputData<double>> initUserWeights(const OutputData<double>& sh } } // namespace -SimDataPair::SimDataPair(simulation_builder_t builder, const OutputData<double>& data, - std::unique_ptr<OutputData<double>> uncertainties, double user_weight) + +SimDataPair::SimDataPair(simulation_builder_t builder, const OutputData<double>& raw_data, + std::unique_ptr<OutputData<double>>&& raw_stdv, double user_weight) : m_simulation_builder(builder) - , m_raw_data(data.clone()) - , m_raw_uncertainties(std::move(uncertainties)) + , m_raw_data(raw_data.clone()) + , m_raw_uncertainties(std::move(raw_stdv)) { m_raw_user_weights = initUserWeights(*m_raw_data, user_weight); validate(); } -SimDataPair::SimDataPair(simulation_builder_t builder, const OutputData<double>& data, - std::unique_ptr<OutputData<double>> uncertainties, - std::unique_ptr<OutputData<double>> user_weights) +SimDataPair::SimDataPair(simulation_builder_t builder, const OutputData<double>& raw_data, + std::unique_ptr<OutputData<double>>&& raw_stdv, + std::unique_ptr<OutputData<double>>&& user_weights) : m_simulation_builder(builder) - , m_raw_data(data.clone()) - , m_raw_uncertainties(std::move(uncertainties)) + , m_raw_data(raw_data.clone()) + , m_raw_uncertainties(std::move(raw_stdv)) , m_raw_user_weights(std::move(user_weights)) { if (!m_raw_user_weights) @@ -74,13 +75,30 @@ SimDataPair::SimDataPair(SimDataPair&& other) SimDataPair::~SimDataPair() = default; -void SimDataPair::runSimulation(const mumufit::Parameters& params) +void SimDataPair::execSimulation(const mumufit::Parameters& params) { m_simulation = m_simulation_builder(params); m_simulation->runSimulation(); m_sim_data = m_simulation->result(); - initResultArrays(); + if (m_exp_data.size() != 0 && m_uncertainties.size() != 0 && m_user_weights.size() != 0) + return; + + if (!m_simulation || m_sim_data.size() == 0) + throwInitializationException("initResultArrays"); + + m_exp_data = m_simulation->convertData(*m_raw_data, true); + + if (containsUncertainties()) { + m_uncertainties = m_simulation->convertData(*m_raw_uncertainties, true); + } else { + const IUnitConverter& converter = m_sim_data.converter(); + std::unique_ptr<OutputData<double>> dummy_array = + UnitConverterUtils::createOutputData(converter, converter.defaultUnits()); + m_uncertainties = SimulationResult(*dummy_array, converter); + } + + m_user_weights = m_simulation->convertData(*m_raw_user_weights, true); } bool SimDataPair::containsUncertainties() const @@ -176,28 +194,6 @@ std::vector<double> SimDataPair::user_weights_array() const return m_user_weights.data()->getRawDataVector(); } -void SimDataPair::initResultArrays() -{ - if (m_exp_data.size() != 0 && m_uncertainties.size() != 0 && m_user_weights.size() != 0) - return; - - if (!m_simulation || m_sim_data.size() == 0) - throwInitializationException("initResultArrays"); - - m_exp_data = m_simulation->convertData(*m_raw_data, true); - - if (containsUncertainties()) { - m_uncertainties = m_simulation->convertData(*m_raw_uncertainties, true); - } else { - const IUnitConverter& converter = m_sim_data.converter(); - std::unique_ptr<OutputData<double>> dummy_array = - UnitConverterUtils::createOutputData(converter, converter.defaultUnits()); - m_uncertainties = SimulationResult(*dummy_array, converter); - } - - m_user_weights = m_simulation->convertData(*m_raw_user_weights, true); -} - void SimDataPair::validate() const { if (!m_simulation_builder) diff --git a/Core/Fitting/SimDataPair.h b/Core/Fitting/SimDataPair.h index ee8b6dcf1be73e4e1ef66272c34f9e24edac002c..5cb38313613de22571df9c1f6076dc979d8acfa1 100644 --- a/Core/Fitting/SimDataPair.h +++ b/Core/Fitting/SimDataPair.h @@ -29,18 +29,18 @@ template <class T> class OutputData; class SimDataPair { public: - SimDataPair(simulation_builder_t builder, const OutputData<double>& data, - std::unique_ptr<OutputData<double>> uncertainties, double user_weight = 1.0); + SimDataPair(simulation_builder_t builder, const OutputData<double>& raw_data, + std::unique_ptr<OutputData<double>>&& raw_stdv, double user_weight = 1.0); - SimDataPair(simulation_builder_t builder, const OutputData<double>& data, - std::unique_ptr<OutputData<double>> uncertainties, - std::unique_ptr<OutputData<double>> user_weights); + SimDataPair(simulation_builder_t builder, const OutputData<double>& raw_data, + std::unique_ptr<OutputData<double>>&& raw_stdv, + std::unique_ptr<OutputData<double>>&& user_weights); SimDataPair(SimDataPair&& other); ~SimDataPair(); - void runSimulation(const mumufit::Parameters& params); + void execSimulation(const mumufit::Parameters& params); bool containsUncertainties() const; @@ -83,7 +83,6 @@ public: std::vector<double> user_weights_array() const; private: - void initResultArrays(); void validate() const; //! ISimulation builder from the user to construct simulation for given set of parameters. diff --git a/Device/Data/CumulativeValue.h b/Device/Data/CumulativeValue.h index 4900b0edac936efd45434978cd14b9112639fdb3..528a7e9693d099a8a93494e3bf1df44ec8a9a9f4 100644 --- a/Device/Data/CumulativeValue.h +++ b/Device/Data/CumulativeValue.h @@ -20,7 +20,7 @@ #ifndef BORNAGAIN_DEVICE_DATA_CUMULATIVEVALUE_H #define BORNAGAIN_DEVICE_DATA_CUMULATIVEVALUE_H -//! The cumulative value with average and rms on-the-flight calculations. +//! The cumulative value, with on-the-flight calculation of average and root mean square. //! @ingroup tools class CumulativeValue { diff --git a/Device/Data/LLData.h b/Device/Data/LLData.h index 888a2cffd97707b8e27f87bb4793d125cca9e19f..2de4772cc2a0c7d616aedc0321fa76fb61952a76 100644 --- a/Device/Data/LLData.h +++ b/Device/Data/LLData.h @@ -41,8 +41,6 @@ public: // accessors T& operator[](size_t i); const T& operator[](size_t i) const; - T& atCoordinate(int* coordinate); - const T& atCoordinate(int* coordinate) const; // arithmetic operations LLData<T>& operator+=(const LLData<T>& right); @@ -64,7 +62,6 @@ private: void allocate(size_t rank, const int* dimensions); void clear(); bool checkDimensions(size_t rank, const int* dimensions) const; - size_t convertCoordinate(int* coordinate) const; void swapContents(LLData<T>& other); T getZeroElement() const; @@ -95,9 +92,8 @@ inline LLData<T>::LLData(size_t rank, const int* dimensions) : m_rank(0), m_dims template <class T> LLData<T>::LLData(const LLData<T>& right) : m_rank(0), m_dims(0), m_data_array(0) { allocate(right.rank(), right.dimensions()); - for (size_t i = 0; i < getTotalSize(); ++i) { + for (size_t i = 0; i < getTotalSize(); ++i) m_data_array[i] = right[i]; - } } template <class T> LLData<T>::~LLData() @@ -124,24 +120,13 @@ template <class T> inline const T& LLData<T>::operator[](size_t i) const return m_data_array[i]; } -template <class T> inline T& LLData<T>::atCoordinate(int* coordinate) -{ - return m_data_array[convertCoordinate(coordinate)]; -} - -template <class T> inline const T& LLData<T>::atCoordinate(int* coordinate) const -{ - return m_data_array[convertCoordinate(coordinate)]; -} - template <class T> LLData<T>& LLData<T>::operator+=(const LLData<T>& right) { if (!HaveSameDimensions(*this, right)) throw std::runtime_error( "Operation += on LLData requires both operands to have the same dimensions"); - for (size_t i = 0; i < getTotalSize(); ++i) { + for (size_t i = 0; i < getTotalSize(); ++i) m_data_array[i] += right[i]; - } return *this; } @@ -150,9 +135,8 @@ template <class T> LLData<T>& LLData<T>::operator-=(const LLData& right) if (!HaveSameDimensions(*this, right)) throw std::runtime_error( "Operation -= on LLData requires both operands to have the same dimensions"); - for (size_t i = 0; i < getTotalSize(); ++i) { + for (size_t i = 0; i < getTotalSize(); ++i) m_data_array[i] -= right[i]; - } return *this; } @@ -161,9 +145,8 @@ template <class T> LLData<T>& LLData<T>::operator*=(const LLData& right) if (!HaveSameDimensions(*this, right)) throw std::runtime_error( "Operation *= on LLData requires both operands to have the same dimensions"); - for (size_t i = 0; i < getTotalSize(); ++i) { + for (size_t i = 0; i < getTotalSize(); ++i) m_data_array[i] *= right[i]; - } return *this; } @@ -212,9 +195,9 @@ template <class T> T LLData<T>::getTotalSum() const template <class T> void LLData<T>::allocate(size_t rank, const int* dimensions) { clear(); - if (!checkDimensions(rank, dimensions)) { + if (!checkDimensions(rank, dimensions)) throw std::runtime_error("LLData<T>::allocate error: dimensions must be > 0"); - } + m_rank = rank; if (m_rank) { m_dims = new int[m_rank]; @@ -244,17 +227,6 @@ template <class T> inline bool LLData<T>::checkDimensions(size_t rank, const int [](const int& dim) -> bool { return dim > 0; }); } -template <class T> inline size_t LLData<T>::convertCoordinate(int* coordinate) const -{ - size_t offset = 1; - size_t result = 0; - for (size_t i = m_rank; i > 0; --i) { - result += offset * coordinate[i - 1]; - offset *= m_dims[i - 1]; - } - return result; -} - template <class T> void LLData<T>::swapContents(LLData<T>& other) { std::swap(this->m_rank, other.m_rank); diff --git a/Device/Data/OutputData.h b/Device/Data/OutputData.h index 94e67df8458f2409cc3952acaa3acd1fa259e153..7924913a22f79d43fd040d7ac543c00de2add798 100644 --- a/Device/Data/OutputData.h +++ b/Device/Data/OutputData.h @@ -544,9 +544,8 @@ template <class T> void OutputData<T>::allocate() delete m_ll_data; size_t rank = m_value_axes.size(); int* dims = new int[rank]; - for (size_t i = 0; i < rank; ++i) { + for (size_t i = 0; i < rank; ++i) dims[i] = (int)axis(i).size(); - } m_ll_data = new LLData<T>(rank, dims); T default_value = {}; m_ll_data->setAll(default_value); diff --git a/Device/Detector/SimpleUnitConverters.cpp b/Device/Detector/SimpleUnitConverters.cpp index 78602cc11bb46105a8af0efb3a869e9b108f755e..6ec4b5f46bd0fc9094c123a07f05adadb43bab50 100644 --- a/Device/Detector/SimpleUnitConverters.cpp +++ b/Device/Detector/SimpleUnitConverters.cpp @@ -125,10 +125,7 @@ void UnitConverterSimple::addDetectorAxis(const IDetector& detector, size_t i_ax SphericalConverter::SphericalConverter(const SphericalDetector& detector, const Beam& beam) : UnitConverterSimple(beam) { - if (detector.dimension() != 2) - throw std::runtime_error("Error in SphericalConverter constructor: " - "detector has wrong dimension: " - + std::to_string(static_cast<int>(detector.dimension()))); + ASSERT(detector.dimension() == 2); addDetectorAxis(detector, 0); addDetectorAxis(detector, 1); } @@ -209,10 +206,7 @@ std::vector<std::map<Axes::Units, std::string>> SphericalConverter::createNameMa RectangularConverter::RectangularConverter(const RectangularDetector& detector, const Beam& beam) : UnitConverterSimple(beam) { - if (detector.dimension() != 2) - throw std::runtime_error("Error in RectangularConverter constructor: " - "detector has wrong dimension: " - + std::to_string(static_cast<int>(detector.dimension()))); + ASSERT(detector.dimension() == 2); addDetectorAxis(detector, 0); addDetectorAxis(detector, 1); m_detector_pixel.reset(detector.regionOfInterestPixel()); @@ -307,9 +301,7 @@ double RectangularConverter::axisAngle(size_t i_axis, kvector_t k_f) const return k_f.phi(); if (i_axis == 1) return M_PI_2 - k_f.theta(); - throw std::runtime_error("Error in RectangularConverter::axisAngle: " - "incorrect axis index: " - + std::to_string(static_cast<int>(i_axis))); + ASSERT(0); } // ************************************************************************************************ @@ -320,10 +312,7 @@ OffSpecularConverter::OffSpecularConverter(const IDetector2D& detector, const Be const IAxis& alpha_axis) : UnitConverterSimple(beam) { - if (detector.dimension() != 2) - throw std::runtime_error("Error in OffSpecularConverter constructor: " - "detector has wrong dimension: " - + std::to_string(static_cast<int>(detector.dimension()))); + ASSERT(detector.dimension() == 2); addAxisData(axisName(0), alpha_axis.lowerBound(), alpha_axis.upperBound(), defaultUnits(), alpha_axis.size()); addDetectorYAxis(detector); @@ -391,10 +380,8 @@ void OffSpecularConverter::addDetectorYAxis(const IDetector2D& detector) const double alpha_f_min = P_new_axis->lowerBound(); const double alpha_f_max = P_new_axis->upperBound(); addAxisData(axis_name, alpha_f_min, alpha_f_max, defaultUnits(), P_new_axis->size()); - } else { - throw std::runtime_error("Error in OffSpecularConverter::addDetectorYAxis: " - "wrong detector type"); - } + } else + ASSERT(0); } // ************************************************************************************************ diff --git a/Examples/fit52_Advanced/multiple_datasets.py b/Examples/fit52_Advanced/multiple_datasets.py index d4698f71099371c33c98607bd04e3c98844d0852..932cfbf74f190f914cfb0320158f402fc54f9ac9 100755 --- a/Examples/fit52_Advanced/multiple_datasets.py +++ b/Examples/fit52_Advanced/multiple_datasets.py @@ -44,12 +44,9 @@ def get_simulation(params): """ incident_angle = params["incident_angle"] - simulation = ba.GISASSimulation() - simulation.setDetectorParameters(50, -1.5*deg, 1.5*deg, 50, 0, 2*deg) - simulation.setBeamParameters(0.1*nm, incident_angle, 0) - simulation.beam().setIntensity(1e+08) - simulation.setSample(get_sample(params)) - return simulation + beam = ba.Beam(1e8, 0.1*nm, ba.Direction(incident_angle, 0)) + detector = ba.SphericalDetector(50, -1.5*deg, 1.5*deg, 50, 0, 2*deg) + return ba.GISASSimulation(beam, get_sample(params), detector) def simulation1(params): diff --git a/Sample/SoftParticle/FormFactorSphereLogNormalRadius.h b/Sample/SoftParticle/FormFactorSphereLogNormalRadius.h index ab35018c438b6f8c57be8de8d7fcf5fc70626987..3dad5806cdcbe95d949f45319c23260267f32075 100644 --- a/Sample/SoftParticle/FormFactorSphereLogNormalRadius.h +++ b/Sample/SoftParticle/FormFactorSphereLogNormalRadius.h @@ -15,7 +15,6 @@ #ifndef BORNAGAIN_SAMPLE_SOFTPARTICLE_FORMFACTORSPHERELOGNORMALRADIUS_H #define BORNAGAIN_SAMPLE_SOFTPARTICLE_FORMFACTORSPHERELOGNORMALRADIUS_H -#include "Base/Types/SafePointerVector.h" #include "Sample/Scattering/IBornFF.h" #include <memory> diff --git a/Tests/UnitTests/Core/Data/LLDataTest.cpp b/Tests/UnitTests/Core/Data/LLDataTest.cpp index 6939f7b853869c217ca30ca44f9ccabfad0efaf0..6f5012df2a567c9b610142d9fcedc6787726a643 100644 --- a/Tests/UnitTests/Core/Data/LLDataTest.cpp +++ b/Tests/UnitTests/Core/Data/LLDataTest.cpp @@ -357,41 +357,21 @@ TEST_F(LLDataTest, HaveSameDimensions) TEST_F(LLDataTest, Accessors) { - for (size_t i = 0; i < fl_data_1d->getTotalSize(); ++i) { + for (size_t i = 0; i < fl_data_1d->getTotalSize(); ++i) (*fl_data_1d)[i] = 0.5f * i; - } EXPECT_FLOAT_EQ((*fl_data_1d)[2], 1.0f); - int* coordinate = new int[1]; - coordinate[0] = 2; - EXPECT_FLOAT_EQ(fl_data_1d->atCoordinate(coordinate), 1.0f); EXPECT_FLOAT_EQ(fl_data_1d->getTotalSum(), 22.5f); - for (size_t i = 0; i < db_data_3d->getTotalSize(); ++i) { + for (size_t i = 0; i < db_data_3d->getTotalSize(); ++i) (*db_data_3d)[i] = 0.2 * i; - } EXPECT_DOUBLE_EQ((*db_data_3d)[2], 0.4); - int* coordinate3d = new int[3]; - coordinate3d[0] = 0; - coordinate3d[1] = 0; - coordinate3d[2] = 2; - EXPECT_DOUBLE_EQ(db_data_3d->atCoordinate(coordinate3d), 0.4); EXPECT_DOUBLE_EQ(db_data_3d->getTotalSum(), 899700.0); - for (size_t i = 0; i < matrix_data_2d->getTotalSize(); ++i) { + for (size_t i = 0; i < matrix_data_2d->getTotalSize(); ++i) (*matrix_data_2d)[i] = static_cast<double>(i) * Eigen::Matrix2d::Identity(); - } EXPECT_EQ((*matrix_data_2d)[2], 2 * Eigen::Matrix2d::Identity()); - int* coordinate2d = new int[2]; - coordinate2d[0] = 0; - coordinate2d[1] = 2; - - EXPECT_EQ(matrix_data_2d->atCoordinate(coordinate2d), 2 * Eigen::Matrix2d::Identity()); - - delete[] coordinate; - delete[] coordinate3d; - delete[] coordinate2d; } diff --git a/Tests/UnitTests/Core/Fitting/SimDataPairTest.cpp b/Tests/UnitTests/Core/Fitting/SimDataPairTest.cpp index a7e7511fc3430ba57b1f60adac23e30a77d37076..4f6c1602b8620a59e8df91379c54fb4405c1d3cf 100644 --- a/Tests/UnitTests/Core/Fitting/SimDataPairTest.cpp +++ b/Tests/UnitTests/Core/Fitting/SimDataPairTest.cpp @@ -30,7 +30,7 @@ TEST_F(SimDataPairTest, standardPair) // calling builder once mumufit::Parameters params; EXPECT_EQ(helper.m_builder_calls, 0u); - obj.runSimulation(params); + obj.execSimulation(params); EXPECT_EQ(helper.m_builder_calls, 1u); // checking simulated and experimental data @@ -48,7 +48,7 @@ TEST_F(SimDataPairTest, standardPair) EXPECT_DOUBLE_EQ(std::accumulate(array.begin(), array.end(), 0), expected_size * exp_value); // calling builder second time - obj.runSimulation(params); + obj.execSimulation(params); EXPECT_EQ(helper.m_builder_calls, 2u); // checking arrays @@ -75,7 +75,7 @@ TEST_F(SimDataPairTest, moveTest) // calling builder once mumufit::Parameters params; EXPECT_EQ(helper.m_builder_calls, 0u); - obj.runSimulation(params); + obj.execSimulation(params); EXPECT_EQ(helper.m_builder_calls, 1u); // checking simulated and experimental data @@ -97,7 +97,7 @@ TEST_F(SimDataPairTest, moveTest) EXPECT_EQ(moved.experimentalData().size(), expected_size); // calling clone's builder once - moved.runSimulation(params); + moved.execSimulation(params); EXPECT_EQ(helper.m_builder_calls, 2u); // checking simulated and experimental data diff --git a/auto/Wrap/doxygenCore.i b/auto/Wrap/doxygenCore.i index 53973c2d342c478688e931e0c4bc79123ae36936..50ccdc2bc1ae702b3534d773e567983605a127da 100644 --- a/auto/Wrap/doxygenCore.i +++ b/auto/Wrap/doxygenCore.i @@ -127,7 +127,7 @@ C++ includes: ObjectiveMetric.h %feature("docstring") Chi2Metric::clone "Chi2Metric * Chi2Metric::clone() const override "; -%feature("docstring") Chi2Metric::computeFromArrays "double Chi2Metric::computeFromArrays(std::vector< double > sim_data, std::vector< double > exp_data, std::vector< double > uncertainties, std::vector< double > weight_factors) const override +%feature("docstring") Chi2Metric::computeFromArrays "double Chi2Metric::computeFromArrays(std::vector< double > sim_data, std::vector< double > exp_data, std::vector< double > exp_stdv, std::vector< double > weight_factors) const override Computes metric value from data arrays. Negative values in exp_data are ignored as well as non-positive weight_factors and uncertainties. All arrays involved in the computation must be of the same size. @@ -140,7 +140,7 @@ array with simulated intensities. exp_data: array with intensity values obtained from an experiment. -uncertainties: +exp_stdv: array with experimental data uncertainties. weight_factors: @@ -458,7 +458,7 @@ C++ includes: DWBASingleComputation.h // File: classFitObjective.xml %feature("docstring") FitObjective " -Holds vector of SimDataPairs (experimental data and simulation results) for use in fitting. +Holds vector of SimDataPairs (experimental data and simulation results) for use in fitting. Thereby supports simultaneous fitting of several data sets and model functions, as demonstrated in example fit52/multiple_datasets. C++ includes: FitObjective.h "; @@ -469,7 +469,7 @@ C++ includes: FitObjective.h %feature("docstring") FitObjective::~FitObjective "FitObjective::~FitObjective() "; -%feature("docstring") FitObjective::addSimulationAndData "void FitObjective::addSimulationAndData(simulation_builder_t builder, const OutputData< double > &data, std::unique_ptr< OutputData< double >> uncertainties, double weight=1.0) +%feature("docstring") FitObjective::addSimulationAndData "void FitObjective::addSimulationAndData(simulation_builder_t builder, const OutputData< double > &data, std::unique_ptr< OutputData< double >> &&stdv, double weight=1.0) Constructs simulation/data pair for later fit. @@ -482,7 +482,7 @@ simulation builder capable of producing simulations data: experimental data array -uncertainties: +stdv: data uncertainties array weight: @@ -506,7 +506,7 @@ weight: weight of dataset in metric calculations "; -%feature("docstring") FitObjective::addSimulationAndData "void FitObjective::addSimulationAndData(PyBuilderCallback &callback, const T &data, const T &uncertainties, double weight=1.0) +%feature("docstring") FitObjective::addSimulationAndData "void FitObjective::addSimulationAndData(PyBuilderCallback &callback, const T &data, const T &stdv, double weight=1.0) Constructs simulation/data pair for later fit. @@ -519,7 +519,7 @@ simulation builder capable of producing simulations data: experimental data array -uncertainties: +stdv: data uncertainties array weight: @@ -598,13 +598,13 @@ Initializes observer callback to be called on every_nth fit iteration. %feature("docstring") FitObjective::finalize "void FitObjective::finalize(const mumufit::MinimizerResult &result) -Should be explicitely called on last iteration to notify all observers. +Should be explicitly called on last iteration to notify all observers. "; %feature("docstring") FitObjective::fitObjectCount "unsigned FitObjective::fitObjectCount() const "; -%feature("docstring") FitObjective::run_simulations "void FitObjective::run_simulations(const mumufit::Parameters ¶ms) +%feature("docstring") FitObjective::execSimulations "void FitObjective::execSimulations(const mumufit::Parameters ¶ms) "; %feature("docstring") FitObjective::setChiSquaredModule "void FitObjective::setChiSquaredModule(const IChiSquaredModule &module) @@ -756,7 +756,7 @@ C++ includes: FitStatus.h %feature("docstring") FitStatus::finalize "void FitStatus::finalize(const mumufit::MinimizerResult &result) -Should be explicitely called on last iteration to notify all observers. +Should be explicitly called on last iteration to notify all observers. "; @@ -1294,7 +1294,7 @@ C++ includes: ObjectiveMetric.h %feature("docstring") LogMetric::clone "LogMetric * LogMetric::clone() const override "; -%feature("docstring") LogMetric::computeFromArrays "double LogMetric::computeFromArrays(std::vector< double > sim_data, std::vector< double > exp_data, std::vector< double > uncertainties, std::vector< double > weight_factors) const override +%feature("docstring") LogMetric::computeFromArrays "double LogMetric::computeFromArrays(std::vector< double > sim_data, std::vector< double > exp_data, std::vector< double > exp_stdv, std::vector< double > weight_factors) const override Computes metric value from data arrays. Negative values in exp_data are ignored as well as non-positive weight_factors and uncertainties. All arrays involved in the computation must be of the same size. @@ -1307,7 +1307,7 @@ array with simulated intensities. exp_data: array with intensity values obtained from an experiment. -uncertainties: +exp_stdv: array with experimental data uncertainties. weight_factors: @@ -1385,7 +1385,7 @@ use_weights: boolean, defines if data uncertainties should be taken into account "; -%feature("docstring") ObjectiveMetric::computeFromArrays "virtual double ObjectiveMetric::computeFromArrays(std::vector< double > sim_data, std::vector< double > exp_data, std::vector< double > uncertainties, std::vector< double > weight_factors) const =0 +%feature("docstring") ObjectiveMetric::computeFromArrays "virtual double ObjectiveMetric::computeFromArrays(std::vector< double > sim_data, std::vector< double > exp_data, std::vector< double > exp_stdv, std::vector< double > weight_factors) const =0 Computes metric value from data arrays. Negative values in exp_data are ignored as well as non-positive weight_factors and uncertainties. All arrays involved in the computation must be of the same size. @@ -1398,7 +1398,7 @@ array with simulated intensities. exp_data: array with intensity values obtained from an experiment. -uncertainties: +exp_stdv: array with experimental data uncertainties. weight_factors: @@ -1554,7 +1554,7 @@ weight_factors: user-defined weighting factors. Used linearly, no matter which norm is chosen. "; -%feature("docstring") PoissonLikeMetric::computeFromArrays "double Chi2Metric::computeFromArrays(std::vector< double > sim_data, std::vector< double > exp_data, std::vector< double > uncertainties, std::vector< double > weight_factors) const override +%feature("docstring") PoissonLikeMetric::computeFromArrays "double Chi2Metric::computeFromArrays(std::vector< double > sim_data, std::vector< double > exp_data, std::vector< double > exp_stdv, std::vector< double > weight_factors) const override Computes metric value from data arrays. Negative values in exp_data are ignored as well as non-positive weight_factors and uncertainties. All arrays involved in the computation must be of the same size. @@ -1567,7 +1567,7 @@ array with simulated intensities. exp_data: array with intensity values obtained from an experiment. -uncertainties: +exp_stdv: array with experimental data uncertainties. weight_factors: @@ -1768,7 +1768,7 @@ weight_factors: user-defined weighting factors. Used linearly, no matter which norm is chosen. "; -%feature("docstring") RelativeDifferenceMetric::computeFromArrays "double Chi2Metric::computeFromArrays(std::vector< double > sim_data, std::vector< double > exp_data, std::vector< double > uncertainties, std::vector< double > weight_factors) const override +%feature("docstring") RelativeDifferenceMetric::computeFromArrays "double Chi2Metric::computeFromArrays(std::vector< double > sim_data, std::vector< double > exp_data, std::vector< double > exp_stdv, std::vector< double > weight_factors) const override Computes metric value from data arrays. Negative values in exp_data are ignored as well as non-positive weight_factors and uncertainties. All arrays involved in the computation must be of the same size. @@ -1781,7 +1781,7 @@ array with simulated intensities. exp_data: array with intensity values obtained from an experiment. -uncertainties: +exp_stdv: array with experimental data uncertainties. weight_factors: @@ -1876,10 +1876,10 @@ Holds pair of simulation/experimental data to fit. C++ includes: SimDataPair.h "; -%feature("docstring") SimDataPair::SimDataPair "SimDataPair::SimDataPair(simulation_builder_t builder, const OutputData< double > &data, std::unique_ptr< OutputData< double >> uncertainties, double user_weight=1.0) +%feature("docstring") SimDataPair::SimDataPair "SimDataPair::SimDataPair(simulation_builder_t builder, const OutputData< double > &raw_data, std::unique_ptr< OutputData< double >> &&raw_stdv, double user_weight=1.0) "; -%feature("docstring") SimDataPair::SimDataPair "SimDataPair::SimDataPair(simulation_builder_t builder, const OutputData< double > &data, std::unique_ptr< OutputData< double >> uncertainties, std::unique_ptr< OutputData< double >> user_weights) +%feature("docstring") SimDataPair::SimDataPair "SimDataPair::SimDataPair(simulation_builder_t builder, const OutputData< double > &raw_data, std::unique_ptr< OutputData< double >> &&raw_stdv, std::unique_ptr< OutputData< double >> &&user_weights) "; %feature("docstring") SimDataPair::SimDataPair "SimDataPair::SimDataPair(SimDataPair &&other) @@ -1888,7 +1888,7 @@ C++ includes: SimDataPair.h %feature("docstring") SimDataPair::~SimDataPair "SimDataPair::~SimDataPair() "; -%feature("docstring") SimDataPair::runSimulation "void SimDataPair::runSimulation(const mumufit::Parameters ¶ms) +%feature("docstring") SimDataPair::execSimulation "void SimDataPair::execSimulation(const mumufit::Parameters ¶ms) "; %feature("docstring") SimDataPair::containsUncertainties "bool SimDataPair::containsUncertainties() const diff --git a/auto/Wrap/doxygenDevice.i b/auto/Wrap/doxygenDevice.i index 69a0f490ff1c55caa5aa3e750324ea6aa5416e78..d6b0bd66cbe004cb536c7c81a8767d15b88d2356 100644 --- a/auto/Wrap/doxygenDevice.i +++ b/auto/Wrap/doxygenDevice.i @@ -189,7 +189,7 @@ Sets convolution mode. // File: classCumulativeValue.xml %feature("docstring") CumulativeValue " -The cumulative value with average and rms on-the-flight calculations. +The cumulative value, with on-the-flight calculation of average and root mean square. C++ includes: CumulativeValue.h "; @@ -1542,12 +1542,6 @@ C++ includes: LLData.h %feature("docstring") LLData::meanValues "LLData<double> LLData< T >::meanValues() const "; -%feature("docstring") LLData::atCoordinate "T & LLData< T >::atCoordinate(int *coordinate) -"; - -%feature("docstring") LLData::atCoordinate "const T & LLData< T >::atCoordinate(int *coordinate) const -"; - %feature("docstring") LLData::setAll "void LLData< T >::setAll(const T &value) "; diff --git a/auto/Wrap/libBornAgainCore.py b/auto/Wrap/libBornAgainCore.py index 840b498dcbb92aa1c6acff44cc8b11c6be979eaf..1df514b30942fe07db3196a1e3ce541bdc2698d3 100644 --- a/auto/Wrap/libBornAgainCore.py +++ b/auto/Wrap/libBornAgainCore.py @@ -2723,7 +2723,7 @@ class FitObjective(object): r""" - Holds vector of SimDataPairs (experimental data and simulation results) for use in fitting. + Holds vector of SimDataPairs (experimental data and simulation results) for use in fitting. Thereby supports simultaneous fitting of several data sets and model functions, as demonstrated in example fit52/multiple_datasets. C++ includes: FitObjective.h @@ -2898,7 +2898,7 @@ class FitObjective(object): finalize_cpp(FitObjective self, mumufit::MinimizerResult const & result) void FitObjective::finalize(const mumufit::MinimizerResult &result) - Should be explicitely called on last iteration to notify all observers. + Should be explicitly called on last iteration to notify all observers. """ return _libBornAgainCore.FitObjective_finalize_cpp(self, result) @@ -2911,13 +2911,13 @@ class FitObjective(object): """ return _libBornAgainCore.FitObjective_fitObjectCount(self) - def run_simulations(self, params): + def execSimulations(self, params): r""" - run_simulations(FitObjective self, mumufit::Parameters const & params) - void FitObjective::run_simulations(const mumufit::Parameters ¶ms) + execSimulations(FitObjective self, mumufit::Parameters const & params) + void FitObjective::execSimulations(const mumufit::Parameters ¶ms) """ - return _libBornAgainCore.FitObjective_run_simulations(self, params) + return _libBornAgainCore.FitObjective_execSimulations(self, params) def setChiSquaredModule(self, module): r""" @@ -2964,10 +2964,10 @@ class FitObjective(object): def addSimulationAndData_cpp(self, *args): r""" addSimulationAndData_cpp(FitObjective self, PyBuilderCallback callback, vdouble1d_t data, double weight=1.0) - addSimulationAndData_cpp(FitObjective self, PyBuilderCallback callback, vdouble1d_t data, vdouble1d_t uncertainties, double weight=1.0) + addSimulationAndData_cpp(FitObjective self, PyBuilderCallback callback, vdouble1d_t data, vdouble1d_t stdv, double weight=1.0) addSimulationAndData_cpp(FitObjective self, PyBuilderCallback callback, vdouble2d_t data, double weight=1.0) - addSimulationAndData_cpp(FitObjective self, PyBuilderCallback callback, vdouble2d_t data, vdouble2d_t uncertainties, double weight=1.0) - void FitObjective::addSimulationAndData(PyBuilderCallback &callback, const T &data, const T &uncertainties, double weight=1.0) + addSimulationAndData_cpp(FitObjective self, PyBuilderCallback callback, vdouble2d_t data, vdouble2d_t stdv, double weight=1.0) + void FitObjective::addSimulationAndData(PyBuilderCallback &callback, const T &data, const T &stdv, double weight=1.0) Constructs simulation/data pair for later fit. @@ -2980,7 +2980,7 @@ class FitObjective(object): data: experimental data array - uncertainties: + stdv: data uncertainties array weight: diff --git a/auto/Wrap/libBornAgainCore_wrap.cpp b/auto/Wrap/libBornAgainCore_wrap.cpp index 0f598d034f298a99df963518c426ee008d726167..0a41cb1676ea5232f13e8ba293c53da8c8fbba98 100644 --- a/auto/Wrap/libBornAgainCore_wrap.cpp +++ b/auto/Wrap/libBornAgainCore_wrap.cpp @@ -35768,7 +35768,7 @@ fail: } -SWIGINTERN PyObject *_wrap_FitObjective_run_simulations(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_FitObjective_execSimulations(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; FitObjective *arg1 = (FitObjective *) 0 ; mumufit::Parameters *arg2 = 0 ; @@ -35778,21 +35778,21 @@ SWIGINTERN PyObject *_wrap_FitObjective_run_simulations(PyObject *SWIGUNUSEDPARM int res2 = 0 ; PyObject *swig_obj[2] ; - if (!SWIG_Python_UnpackTuple(args, "FitObjective_run_simulations", 2, 2, swig_obj)) SWIG_fail; + if (!SWIG_Python_UnpackTuple(args, "FitObjective_execSimulations", 2, 2, swig_obj)) SWIG_fail; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_FitObjective, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FitObjective_run_simulations" "', argument " "1"" of type '" "FitObjective *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FitObjective_execSimulations" "', argument " "1"" of type '" "FitObjective *""'"); } arg1 = reinterpret_cast< FitObjective * >(argp1); res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_mumufit__Parameters, 0 | 0); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FitObjective_run_simulations" "', argument " "2"" of type '" "mumufit::Parameters const &""'"); + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FitObjective_execSimulations" "', argument " "2"" of type '" "mumufit::Parameters const &""'"); } if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FitObjective_run_simulations" "', argument " "2"" of type '" "mumufit::Parameters const &""'"); + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FitObjective_execSimulations" "', argument " "2"" of type '" "mumufit::Parameters const &""'"); } arg2 = reinterpret_cast< mumufit::Parameters * >(argp2); - (arg1)->run_simulations((mumufit::Parameters const &)*arg2); + (arg1)->execSimulations((mumufit::Parameters const &)*arg2); resultobj = SWIG_Py_Void(); return resultobj; fail: @@ -44296,7 +44296,7 @@ static PyMethodDef SwigMethods[] = { "FitObjective_finalize_cpp(FitObjective self, mumufit::MinimizerResult const & result)\n" "void FitObjective::finalize(const mumufit::MinimizerResult &result)\n" "\n" - "Should be explicitely called on last iteration to notify all observers. \n" + "Should be explicitly called on last iteration to notify all observers. \n" "\n" ""}, { "FitObjective_fitObjectCount", _wrap_FitObjective_fitObjectCount, METH_O, "\n" @@ -44304,9 +44304,9 @@ static PyMethodDef SwigMethods[] = { "unsigned FitObjective::fitObjectCount() const\n" "\n" ""}, - { "FitObjective_run_simulations", _wrap_FitObjective_run_simulations, METH_VARARGS, "\n" - "FitObjective_run_simulations(FitObjective self, mumufit::Parameters const & params)\n" - "void FitObjective::run_simulations(const mumufit::Parameters ¶ms)\n" + { "FitObjective_execSimulations", _wrap_FitObjective_execSimulations, METH_VARARGS, "\n" + "FitObjective_execSimulations(FitObjective self, mumufit::Parameters const & params)\n" + "void FitObjective::execSimulations(const mumufit::Parameters ¶ms)\n" "\n" ""}, { "FitObjective_setChiSquaredModule", _wrap_FitObjective_setChiSquaredModule, METH_VARARGS, "\n" @@ -44337,10 +44337,10 @@ static PyMethodDef SwigMethods[] = { { "FitObjective_availableMetricOptions", _wrap_FitObjective_availableMetricOptions, METH_NOARGS, "FitObjective_availableMetricOptions() -> std::string"}, { "FitObjective_addSimulationAndData_cpp", _wrap_FitObjective_addSimulationAndData_cpp, METH_VARARGS, "\n" "FitObjective_addSimulationAndData_cpp(FitObjective self, PyBuilderCallback callback, vdouble1d_t data, double weight=1.0)\n" - "FitObjective_addSimulationAndData_cpp(FitObjective self, PyBuilderCallback callback, vdouble1d_t data, vdouble1d_t uncertainties, double weight=1.0)\n" + "FitObjective_addSimulationAndData_cpp(FitObjective self, PyBuilderCallback callback, vdouble1d_t data, vdouble1d_t stdv, double weight=1.0)\n" "FitObjective_addSimulationAndData_cpp(FitObjective self, PyBuilderCallback callback, vdouble2d_t data, double weight=1.0)\n" - "FitObjective_addSimulationAndData_cpp(FitObjective self, PyBuilderCallback callback, vdouble2d_t data, vdouble2d_t uncertainties, double weight=1.0)\n" - "void FitObjective::addSimulationAndData(PyBuilderCallback &callback, const T &data, const T &uncertainties, double weight=1.0)\n" + "FitObjective_addSimulationAndData_cpp(FitObjective self, PyBuilderCallback callback, vdouble2d_t data, vdouble2d_t stdv, double weight=1.0)\n" + "void FitObjective::addSimulationAndData(PyBuilderCallback &callback, const T &data, const T &stdv, double weight=1.0)\n" "\n" "Constructs simulation/data pair for later fit.\n" "\n" @@ -44353,7 +44353,7 @@ static PyMethodDef SwigMethods[] = { "data: \n" "experimental data array\n" "\n" - "uncertainties: \n" + "stdv: \n" "data uncertainties array\n" "\n" "weight: \n" diff --git a/mvvm/model/mvvm/model/sessionitem.cpp b/mvvm/model/mvvm/model/sessionitem.cpp index 24de2f4d76f3ebc67f80a3d575c6118e259156c9..65c4fd39ca997363e76bc22711f9eff60171287b 100644 --- a/mvvm/model/mvvm/model/sessionitem.cpp +++ b/mvvm/model/mvvm/model/sessionitem.cpp @@ -331,7 +331,7 @@ SessionItem* SessionItem::setEditorType(const std::string& editor_type) bool SessionItem::set_data_internal(const Variant& value, int role, bool direct) { // If model is present, and undo stack is enabled, will forward request to the model - // (unless user explicitely asks for direct processing via direct=true flag). + // (unless user explicitly asks for direct processing via direct=true flag). const bool act_through_model = !direct && model() && model()->undoStack(); return act_through_model ? model()->setData(this, value, role) : p_impl->do_setData(value, role); diff --git a/mvvm/model/mvvm/model/sessionmodel.cpp b/mvvm/model/mvvm/model/sessionmodel.cpp index f8257d65c1f5160f9f0303e69f883bac0182320f..a822c930ec8cf508965d79e4c5183026869e3eac 100644 --- a/mvvm/model/mvvm/model/sessionmodel.cpp +++ b/mvvm/model/mvvm/model/sessionmodel.cpp @@ -72,7 +72,7 @@ SessionModel::SessionModel(std::string model_type, std::shared_ptr<ItemPool> poo SessionModel::~SessionModel() { - // Explicitely call root item's destructor. It uses p_impl pointer during own descruction + // Explicitly call root item's destructor. It uses p_impl pointer during own descruction // and we have to keep pimpl pointer intact. Without line below will crash on MacOS because // of pecularities of MacOS libc++. See explanations here: // http://ibob.github.io/blog/2019/11/07/dont-use-unique_ptr-for-pimpl/ diff --git a/mvvm/tests/testmodel/threadsafestack.test.cpp b/mvvm/tests/testmodel/threadsafestack.test.cpp index 08ecdbf24afb32cda002948d976537e9df5b6d16..79c014d771f0b3ae495b958af545d0884f8a663b 100644 --- a/mvvm/tests/testmodel/threadsafestack.test.cpp +++ b/mvvm/tests/testmodel/threadsafestack.test.cpp @@ -126,7 +126,7 @@ TEST_F(ThreadSafeStackTest, concurentPushAndPop) } } -//! Explicitely terminate waiting (concurrent mode). +//! Explicitly terminate waiting (concurrent mode). TEST_F(ThreadSafeStackTest, concurentStopWaiting) {