Commit 724d90ce authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

repair basic gisas fit example

parent 558cdef3
......@@ -7,7 +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 ba_fitmonitor
import numpy as np
from matplotlib import pyplot as plt
......@@ -19,9 +19,8 @@ def run_fitting():
fit_objective.addSimulationAndData(model.get_simulation, real_data)
fit_objective.initPrint(10) # Print on every 10th iteration.
plotter = bafim.PlotterGISAS()
fit_objective.initPlot(
10, plotter) # Plot every 10th, slow!
observer = ba_fitmonitor.PlotterGISAS()
fit_objective.initPlot(10, observer) # Plot every 10th, slow!
minimizer = ba.Minimizer()
params = model.start_parameters_1()
......
......@@ -6,6 +6,7 @@ Fit progress is plotted using lmfit iteration calbback function.
import numpy as np
from matplotlib import pyplot as plt
import bornagain as ba
import ba_fitmonitor
from bornagain import deg, angstrom, nm
import lmfit
......
......@@ -45,6 +45,9 @@ class Plotter:
self._units = units
self._aspect = aspect
def __call__(self, fit_objective):
self.plot(fit_objective)
def reset(self):
self._fig.clf()
......@@ -147,9 +150,6 @@ class PlotterSpecular(Plotter):
self.gs = gridspec.GridSpec(1, 2, width_ratios=[2.5, 1], wspace=0)
self.units = units
def __call__(self, fit_objective):
self.plot(fit_objective)
@staticmethod
def as_si(val, ndp):
"""
......
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