Recent Changes · Search:

Dispense


Navigation Tips - Dritte


PmWiki

pmwiki.org

edit SideBar

SaveFit

< Mujpy.Multigroup | Index | Mujpy.PositiveParameters >


Run and group loops

The new unique mufit.dofit_ method performs krun and/or kgroup loops, distinguishing:

B20 fit

  • for krun
    • for kgroup
      • execute
      • summary
        • each run, group shows model parameters on the terminal
        • writes the same in a unique cache log file, filename does not include run nor group
        • adds a model row in a unique csv file, filename does not include run nor group
      • savefit, one saved fit file per fit (i.e. per run per group)

B1, B21 fits

  • for krun
    • execute
    • for kgroup
      • B1 summary
        • each run shows model parameters on the terminal
        • writes the same in a unique cache log file
        • adds a model row in a unique csv file, filename includes group, no run
      • B21 summary_global
        • shows per group model parameters on the terminal
        • writes the same in a unique cache log file, filename does not include run nor group
        • adds a model row in a unique csv file, filename does not include run nor group
        • each fit adds a Minuit parameters row in a a unique U_csv, filename does not include run or group
    • savefit

A20 fit

  • for kgroup
    • execute
    • summary
      • each group shows model parameters on the terminal
      • writes the same in a unique cache log file, filename does not include run nor group
      • adds a model row in a unique csv file, filename does not include run nor group
    • savefit

A1, A21, C1, C2 fits

  • execute
  • for krun
    • for kgroup
      • A1 summary
        • shows model parameters on the terminal
        • writes the same in a cache log file, filename includes run and group
        • adds a row in a unique csv file, filename includes group]
      • summary_global
        • A21 each group shows model parameters on terminal
        • writes the same in a unique cache log file
        • adds one model row in a unique csv, filename does not include run nor group
        • each fit adds one Minuit row in unique U_csv, filename does not include run nor group
        • C1 [and C2] each group [and run] shows model parameters on terminal
        • writes the same in a unique log cache file
        • adds one row in a unique csv file, filename includes run [does not include run] does not include group
        • each fit writes an additional user log, with Minuit parameters
  • savefit

Finally

  • all csv files include run and group columns, hence filename does not include run or group (A1, B1, C1 may)
  • summary, min2int deal with single run single group parameters errors, model driven
    • A1, B1, A20, B20 produce lists of model logs on terminal, one model summary per run per group,
      • shared parameters have an added 'S' besides the error
    • min2int produces depth=2 nam, val, err, shared lists [component [parameter]]
    • as many model log files (bloating cache)
    • as many rows in unique csv model files
  • summary_global, min2int_global deal with dofit_ selected single run, single group but revisit the same userpardicts over again, save userpars the first time in a single log/csv
    • A21, B21, C1 C2, produce lists of model logs on terminal, one model log per run per group
      • non-hash parameters have an added 'G' besides the error
    • as many model logs in a single file in cache
    • as many rows in unique csv model file
    • A21 B21 produce an extra U_csv file listing one row of Minuit parameters per fit (per run per group) in a unique file (non run no group in the filename)
    • C1, C2 produce an extra U_log file, with Minuit parameters
    • min2int_global produces depth=3 nam, val, err lists [run [group [component parameters]]]
      • here components parameters are added to the same list, component[0] parameters[0], component[0] parameter[1], ... component[-1] parameter[-1]
  • in all cases prepare_csv_row receives a single run, group and treats all the same way

Policy for saving fits (revise!):

  • single or sequential fits have
    • one set of values and errors for each Minuit parameter,
    • transform them back into component parameter values by min2int
    • store component parameter values and errors in dashboard["model_result"]
    • save the augmented dashboard to the json file (mufit.save_fit)
    • writes component parameters etc in a csv file (mufit.prepare_csv and aux.write_csv)
  • single run or sequential run multigroup userpardicts fits (one chi2 for several groups, single run) have:
    • user parameters guesses (dashboard["userpardicts_guess"], a list of dicts) that initialize Minuit parameters
    • The result of a fit is an equivalent single set of Minuit (user) parameters, that determine the component parameters for all groups, based on int2_multigroup_method
    • store their optimized values in dashboard["userpardicts_results"]; these are global
    • save the augmented dashboard (mufit.save_fit_multigroup)
    • write the same user parameter values and errors in a csv file (mufit.prepare_csv_multigroup and aux.write_csv)
      • the same "function" evaluation, for common parameters
      • specific "function_multi" evaluation (as many "function" strings as groups), for group-specific parameters
    • can transform them back to component parameter values by min2int_multigroup, using "function" and "function_multi" evaluation
    • skip storing component parameter best fit values (evaluated) into dashboard["model_result"]: evaluated by mucomponents using int2_multigroup_method
  • at this stage json files are
    • just guess if no "..result" is present,
    • single run fits is they have a "model_result" key (including calib)
    • multigroup fits if they have a "userpardicts_result" key

< Mujpy.Multigroup | Index | Mujpy.PositiveParameters >

Edit - History - Print - PDF - Recent Changes - Search
Page last modified on July 13, 2026, at 10:27 AM