Recent Changes · Search:

Dispense


Navigation Tips - Dritte


PmWiki

pmwiki.org

edit SideBar

Methods2

< Mujpy.InstallWin10 | Index | Mujpy.GlobalFits >


New login suggested by PB, in order to allow command line driving, musrfit-style. See Mujpy.GlobalFits for the A1, ... , C2 types of fit.

The mudash class is a separate second layer (relying on ipywidget, jupyterlab, to be done). Several use modes can be envisaged, starting from a python script. Tests of mujpy are provided as jupyter notebook, .ipynb files in example. The core mujpy is defined from the following classes:

  • the musuite class, contains everything about data. Use:
    • Define an instance. the instance methods that
      • defines a console, according to mujpy mode (jupyter, python, gui)
      • contains a list of lists of runs, if the innermost contains more items they identify runs to be added. The list defines the fit order for sequentila fits
      • reads data for each run from a file, the reference run, only the first full path is given, the others are retrieved from the list
      • loads a json groups.calib file, containing one or more groups, each defined by a dict of two groupings in shorthand notation and an α parameter = {'forward':forw,'backward':backw,'alpha':alpha}, as determined by the special instance. This file can be easily typed in, as in the test notebooks.
      • automatic t0 and background determination, prompt and preprompt, respectively, for musr2py PSI data, and just edge for musr2isis homebrew Nexus ISIS data
      • a switchyard asymmetry (distinct methods for Mujpy.A1, Mujpy.A2, Mujpy.B1, Mujpy.B2?, Mujpy.C1, Mujpy.C2).
  • the mufit class, contains everything about fitting. It relies on a json structure that reproduces the old mugui dashboard. Use a json aware editor.
    • It reads:
      • a suite instance (data)
      • a json structure defining the model (the name is the game), e.g. 'mgml'. The letters are combinations of 2-letter standard component names, from class mumodel in library mucomponents. The json file name also refer to the reference run, and the group shorthand
      • the combination of the suite and the model determine which type of fit, single or multi run, single or multi group, sequential or global.
      • models starting with component "al", for α, produce a special fit, where asymmetry is recalculated at each iteration with the α Minuit parameter; this is the preliminary fit to determine α for the groups.calib file of the suite.
      • the standard model is defined by a structure initialised as the "model_guess" key of a dict, corresponding to a list of components, that reproduces the old mugui dashboard; here a simple example
 [
   {"name": "mg",
    "label": "_fast"
    "pardicts": [
                 {"name":"A","value":0.2,"error":0.001,"flag":"~","function":"","limits":[null,null]},
                 {"name":"B","value":10.0,"error":0.1,"flag":"~","function":"","limits":[null,null]},
                 {"name":'φ',"value":0.0,"error":0.1,"flag":"~","function":"","limits":[null,null]},
                 {"name":'σ1',"value":3.0,"error":0.1,"flag":"~","function":"","limits":[null,null]}
                 ]
    },
    {"name": "ml",
     "label": "_slow",
     "pardicts": [
                  {"name":"A","value":0.05,"error":0.001,"flag":"~","function":"","limits":[null,null]},
                  {'name':'B1',"value":0.0,"error":0.001,"flag":"=","function":"p[1]","limits":[null,null]},
                  {'name':'φ',"value":0.0,"error":0.001,"flag":"=","function":"p[2]","limits":[null,null]},
                  {'name':'σ1',"value":0.1,"errore":0.001,"flag":"~","function":"","limits":[null,null]},

    }
 ]
  • multi group fits may use the additional pardict key "function_multi" and "error_propagation_multi" to define a list of parameter functions and error propagation rules
  • global fits have an additional key "userpardicts_guess", assigned to a list of pardicts to define global Minuit parameters, common to suites of runs or to different groupings or both, e.g.
 [
  {'name':'Atot21','value':0.25,'flag':'~','limits':(None,None)},
  {'name':'Atot34','value':0.26,'flag':'~','limits':(None,None)}
 ]
  • mufit methods automatically perform
    • Minuit (iminuit2) best fit
    • save one or more fit files by adding a "model_result" copy of the "model_guess" key, with best fit "values" and "std"; global fits save also a "userpardicts_result" key.
    • write [in] a csv
    • write results on the suite console
  • the mufitplot class, produces plots of best/guess fit or fft, or both
    • single run, single group fits produce static plots
    • all the others produce animations that cycle with 1 s delay all the data sets of the suite. Mouse click can toggle the animation on/off, i.e. stop on any run/group for static observation
    • the best fit(s) can be plotted either on a single range on twin ranges with distinct packing: early and late times; chi2 statistics is also shown
    • a skeleton rotating frame is selectable, by the rotating frame frequency {$\nu_{\mathrm R}$}, as a presentation option; it works when the fit components are {$\nu-\nu_{\mathrm R}>0$} and {$\nu-\nu_{\mathrm R}\ll\nu_{\mathrm R}$}
    • fft is performed on (partial) residues
      • the fit component may be subtracted by setting a "fft":True key in its "mu model_guess"
    • a multiplot mode is foreseen, with a vertical offset for clarity.
    • a detector inspection mode is foreseen, with animation for scanning detectors

[1] could be a list of lists of lists with a list of successive calibrations (if, e.g., the calibration dependes on T ranges)


< Mujpy.InstallWin10 | Index | Mujpy.GlobalFits >

Edit - History - Print - PDF - Recent Changes - Search
Page last modified on October 13, 2022, at 05:39 AM