16 #include "Fit/Kernel/Minimizer.h"
17 #include "Fit/Minimizer/IMinimizer.h"
27 #include "Sim/Fitting/FitObjective.h"
28 #include "Sim/Fitting/ObjectiveMetric.h"
29 #include "Sim/Simulation/ISimulation.h"
47 fit_observer_t plot_observer = [&](
const FitObjective& obj) {
m_observer->update(&obj); };
52 const bool requires_residuals = minimizer_impl->requiresResiduals();
54 mumufit::Minimizer minimizer;
55 minimizer.setMinimizer(minimizer_impl.release());
57 auto result = requires_residuals ? minimizer.minimize(
58 [&](
const mumufit::Parameters& params) {
63 [&](
const mumufit::Parameters& params) {
72 auto result = std::make_unique<FitObjective>();
74 simulation_builder_t builder = [&](
const mumufit::Parameters& params) {
81 const DataItem* intensity_item = realDataItem->dataItem();
82 ASSERT(intensity_item);
85 std::unique_ptr<Datafield> data(intensity_item->
getDatafield()->clone());
87 result->execAddSimulationAndData(builder, *data,
nullptr, 1.0);
112 std::unique_ptr<ISimulation>
115 static std::mutex build_simulation_mutex;
116 std::unique_lock<std::mutex> lock(build_simulation_mutex);
125 QVector<double> values = QVector<double>::fromStdVector(params.values());
Defines class FitObjectiveBuilder.
Defines class FitParameterContainerItem.
Defines class FitSuiteItem.
Implements class GUIFitObserver.
Defines MinimizerItem class.
Defines class RealDataItem.
Defines namespace GUI::Transform::ToCore.
Abstract base class for IntensityDataItem and SpecularDataItem. Owns one simulated data set of type D...
Datafield * getDatafield()
void attachObserver(std::shared_ptr< GUIFitObserver > observer)
std::unique_ptr< ISimulation > buildSimulation(const mumufit::Parameters ¶ms) const
std::unique_ptr< IMinimizer > createMinimizer() const
FitObjectiveBuilder(JobItem *jobItem)
std::shared_ptr< GUIFitObserver > m_observer
std::unique_ptr< FitObjective > createFitObjective() const
mumufit::Parameters createParameters() const
std::unique_ptr< FitObjective > m_fit_objective
void update_fit_parameters(const mumufit::Parameters ¶ms) const
mumufit::Parameters createParameters() const
void setValuesInParameterContainer(const QVector< double > &values, class ParameterContainerItem *parameterContainer)
Propagate values to the corresponding parameter tree items of parameterContainer.
MinimizerContainerItem * minimizerContainerItem()
FitParameterContainerItem * fitParameterContainerItem()
const SimulationOptionsItem & simulationOptionsItem() const
MultiLayerItem * sampleItem()
FitParameterContainerItem * fitParameterContainerItem()
FitSuiteItem * fitSuiteItem()
InstrumentItem * instrumentItem() const
RealDataItem * realDataItem()
ParameterContainerItem * parameterContainerItem()
std::unique_ptr< IMinimizer > createMinimizer() const override
std::unique_ptr< ObjectiveMetric > createMetric() const