Skip to content
Snippets Groups Projects
Commit 85115f29 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

convert fit example find_background to using addFitPair

parent 8ac12173
No related branches found
No related tags found
1 merge request!1967Base fit examples on Datafield (except last 2)
......@@ -24,7 +24,7 @@ def get_simulation(P):
return simulation
def create_real_data():
def fake_data():
"""
Generating "real" data by adding noise, background and scale
to the simulated data.
......@@ -43,17 +43,17 @@ def create_real_data():
result = simulation.simulate()
# retrieving simulated data in the form of numpy array
return result.npArray()
return result
if __name__ == '__main__':
real_data = create_real_data()
data = fake_data()
fit_objective = ba.FitObjective()
fit_objective.addSimulationAndData(get_simulation, real_data, 1)
fit_objective.addFitPair(get_simulation, data, 1)
fit_objective.initPrint(10)
observer = ba_fitmonitor.PlotterGISAS()
observer = ba_fitmonitor.PlotterGISAS()
fit_objective.initPlot(10, observer)
P = ba.Parameters()
......
......@@ -24,7 +24,7 @@ def get_simulation(P):
return simulation
def create_real_data():
def fake_data():
"""
Generating "real" data by adding noise, background and scale
to the simulated data.
......@@ -43,17 +43,17 @@ def create_real_data():
result = simulation.simulate()
# retrieving simulated data in the form of numpy array
return result.npArray()
return result
if __name__ == '__main__':
real_data = create_real_data()
data = fake_data()
fit_objective = ba.FitObjective()
fit_objective.addSimulationAndData(get_simulation, real_data, 1)
fit_objective.addFitPair(get_simulation, data, 1)
fit_objective.initPrint(10)
observer = ba_fitmonitor.PlotterGISAS()
observer = ba_fitmonitor.PlotterGISAS()
plt.close() # (hide plot) fit_objective.initPlot(10, observer)
P = ba.Parameters()
......
......@@ -24,7 +24,7 @@ def get_simulation(P):
return simulation
def create_real_data():
def fake_data():
"""
Generating "real" data by adding noise, background and scale
to the simulated data.
......@@ -43,17 +43,17 @@ def create_real_data():
result = simulation.simulate()
# retrieving simulated data in the form of numpy array
return result.npArray()
return result
if __name__ == '__main__':
real_data = create_real_data()
data = fake_data()
fit_objective = ba.FitObjective()
fit_objective.addSimulationAndData(get_simulation, real_data, 1)
fit_objective.addFitPair(get_simulation, data, 1)
fit_objective.initPrint(10)
observer = ba_fitmonitor.PlotterGISAS()
observer = ba_fitmonitor.PlotterGISAS()
<%= sm ? "plt.close() # (hide plot) " :"" %>fit_objective.initPlot(10, observer)
P = ba.Parameters()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment