Thinking forward to correlator fits: we would eventually like to be able to make stability plots where we vary the (1) number of states, (2) the starting time, and (3) the ending time. Fortunately all of these variables can be specified in the meta_args, as well as their minimum and maximum values.
(Ideally we'd like to make stability plots like those in Fig 10 of hep-lat/2011.12166, but I doubt we could generalize this behavior to any lsqfit.nonlinear_fit object.)
Some ideas on how we could implement this feature:
- Automatically make stability plots for all keys in the posterior
- Require an argument to FitGUI (eg,
stability_param='E0')
Additional goals:
- Show statistics under value (reduced chi square, Q-value)
- Show Bayes factors when applicable (ie,
fit1.y == fit2.y)
- Cache fits rather than regenerate each fit every time the layout is updated (I'll include some example code below).
- Show stability for extrapolations (eg, for a chiral fit, it might be desirable to have a stability plot where we compare the extrapolated values to the physical point while varying the order of xpt corrections)
Cached fit dictionary (haven't tested this, but you get the idea; also, doesn't account for updating priors!)
class FitsDict(dict):
def __init__(self, fit, fit_setup_function=None, fit_setup_kwargs=None):
self.data = fit.data
self.prior = fit.prior
self.fit_setup_kwargs = fit_setup_kwargs
self.fit_setup_function = fit_setup_function
def __str__(self):
output = ''
for key in list(self):
output += '\n---\nFit: '+str(key)+'\n\n'
output += str(self.__getitem__(key))
return output
def __getitem__(self, meta_args): # eg, meta_args = {'n_states' : 3}
key = tuple((k, meta_args[k]) for k in sorted(meta_args))
if key not in self:
super().__setitem__(key, self._make_fit(meta_args))
return super().__getitem__(key)
else:
return super().__getitem__(key)
def _make_fit(self, meta_args):
# ... process meta_args, maybe not exactly correct
setup = {key: meta_args.get(key) or val for key, val in self.fit_setup_kwargs.items()}
fit = self.fit_setup_function(**setup)
return fit
Thinking forward to correlator fits: we would eventually like to be able to make stability plots where we vary the (1) number of states, (2) the starting time, and (3) the ending time. Fortunately all of these variables can be specified in the
meta_args, as well as their minimum and maximum values.(Ideally we'd like to make stability plots like those in Fig 10 of hep-lat/2011.12166, but I doubt we could generalize this behavior to any
lsqfit.nonlinear_fitobject.)Some ideas on how we could implement this feature:
stability_param='E0')Additional goals:
fit1.y == fit2.y)Cached fit dictionary (haven't tested this, but you get the idea; also, doesn't account for updating priors!)