Recent Changes · Search:

Dispense


Navigation Tips - Dritte


PmWiki

pmwiki.org

edit SideBar

A1

Index


Single run single group fit This is the flow of information in mujpy to produce the fit. Back to Fit Types

In dashboard, a json file containing a dict,

  • 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, "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)

The "label" action is clarified by an example: model "mgml" contains two components, "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. Likewise for "ml" "label": "_slow". Labels are arbirary.

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 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_data_ preloads time, asymmetry and asymmetry errors, methods and key lists, alpha. The last is deprecated, only needed for linear "da" corrections.

mumodel _chisquare_ is the cost function.

mumodel _add_single_ assigns the correct parameters to each component, calculated from the Minuit array of parameters

  • the_model._load_data_(time,asymmetry,...),
  • 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_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

Back to Fit Types


Index

Edit - History - Print - PDF - Recent Changes - Search
Page last modified on December 12, 2021, at 04:18 PM