Index
Single run single group calib fit
This is the flow of information in mujpy to produce the fit.
Back to Fit Types
The first component in model name must be "al", e.g. "almg".
In dashboard, a json file containing a dict like that in A1),
- key "model_guess" contains a list, in the order of their appearance in the model-name string of
- component dicts, each with keys "name", component two letter name (first must be "al"), "label", specific name suffix, "pardicts", a dict of
- parameter dicts, each with keys
- "name", standard parameter name,
- "value", guess value,
- "error", the initial step,
- "flag", any of "~","!","~",
- "function", a string to evaluate parameter value vs p = Minuit parameter array
- "limits", a list [maxvalue,minvalue] (json's null is automatically translated to None)
For example model "almgml" contains three components, "al" for alpha, "mg", a Gaussian-relaxing precession, and "ml" a Lorentzian-relaxing precession, each with four parameters. If "mg" "label" is "_fast", its parameters have "_fast" appended to their names.
aux int2min produces the minuit list of guess parameter values by scanning the model components, in the order in which they appear in "mgml". It takes care, for instance, of the case when the field and phases of component "ml" are shared with those of component "mg". In this case the total number of dashboard parameters, also called internal, is 8 (4 per component) but the number of Minuit parameters is only 6. The way this happens is common with the next method.
aux int2_method_key takes care of passing the right parameter to the right component method. It produces a list of [method, keys], one per method, where
- method is the python function from mucomponents mumodel that calculates the component
keys
is a list of lambda functions, typically key_as_lambda = eval('lambda p:'+pardict["function"])
, used as follows
f = method(t,*argv)
, where t is the 1-d time array, argv is a list of the dashboard parameter values for that component, and f is an array with the same shape as t
- argv is calculated as
[key(p) for key in keys]
, assuming that p
is the array of parameter values passed by Minuit at this iteration.
The convention for A1-calib (like A1) fits is that
- if "flag": "~" or "!" the parameter is a Minuit parameter, and "function" is empty, the key is in the form "p[k]" with k the index of the parameter
- if "flag": "=" the parameter is missing and the key is specified by "function": "p[k]", with k the index of a previous parameter as written by the user, with reference to internal, dashboard parameter indexing
- all indices must be referred instead to Minuit parameters, therefore they must be recomputed by aux translate, since the missing paramters alter the indices of all subsequent parameters
aux mint2int translates back best fit values to component parameters
mumodel _load_calib_data_ preloads time, yf,yb,bf,bb,yfm,ybm as from suite single_for_back_count
, to calculate asymmetry and asymmetry errors with alpha = p[0], plus component methods and their key lists.
mumodel _chisquare_ is the cost function.
mumodel _add_calib_single_ assigns the correct parameters to each component, calculated from the Minuit array of parameters, including p[0] to alpha, and recalculates asymmetry plus asymmetry errors
the_model._load_calib_data_(time,yf,yb,bf,bb,yfm,ybm,...)
,
m = Minuit(the_model._chisquare_,names,*values)
m.errors = errors
, etc
m.migrad()
Minuit migrad()
method calls
the_model._chisquare_
, which in turns calls
the_model._add_calib_single_(x,*argv)
, where argv
is the Minuit array of parameters. Their assignment to component methods is performed
- scanning the method list
- scanning the keys list of each method and evaluating each key
Note that plots are obtained with best fit alpha = p[0] with the standard asymmetry. This is accomplished by
the_model._add_calib_single_(x,*argv)
Back to Fit Types
Index