Commit 558cdef3 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

fix example specular / FitWithUncertainties

parent 79ec1d9a
......@@ -7,6 +7,7 @@ Fake experimental data are generated by gisas_fake1.
import gisas_model1 as model
import bornagain as ba
import ba_fitmonitor as bafim
import numpy as np
from matplotlib import pyplot as plt
......@@ -18,7 +19,9 @@ def run_fitting():
fit_objective.addSimulationAndData(model.get_simulation, real_data)
fit_objective.initPrint(10) # Print on every 10th iteration.
fit_objective.initPlot(10) # Plot on every 10th iteration. Slow!
plotter = bafim.PlotterGISAS()
10, plotter) # Plot every 10th, slow!
minimizer = ba.Minimizer()
params = model.start_parameters_1()
......@@ -14,6 +14,8 @@ and use genetic algorithm as the minimizer.
import numpy as np
import bornagain as ba
import ba_fitmonitor as bafim
import ba_plot
from matplotlib import pyplot as plt
from os import path
......@@ -121,7 +123,7 @@ def run_fitting():
fit_objective.addSimulationAndData(get_simulation, real_data,
plot_observer = ba_fitmonitor.PlotterSpecular(units=ba.Axes.RQ4)
plot_observer = bafim.PlotterSpecular(units=ba.Axes.RQ4)
fit_objective.initPlot(10, plot_observer)
fit_objective.setObjectiveMetric("Chi2", "L1")
......@@ -248,7 +248,7 @@ class PlotterSpecular(Plotter):
plt.ylim((0.5*np.min(real_values), 5*np.max(real_values)))
xlabel = ba_plot.get_axes_labels(real_data, self.units)[0]
xlabel = bp.get_axes_labels(real_data, self.units)[0]
legend = ['BornAgain', 'Data']
if unc_values is not None:
legend = ['BornAgain', 'Data', r'Data $\pm \sigma$']
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment