Recent Changes · Search:

Dispense


Navigation Tips - Dritte


PmWiki

pmwiki.org

edit SideBar

Dashboard

< Mujpy.WIN10 | Index | Mujpy.Subnotebook >


Plan for a dashboard graphical editor

  • the notebook contains a first cell of imports
 
    %matplotlib tk
    from os import getcwd
    startuppath = getcwd() # before changing to git mujpy (if mujpy installed this is not needed)
    %cd /home/roberto.derenzi/git/mujpy/
    from mujpy.musuite import suite
    from mujpy.mudash import dash
    from mujpy.mufit import mufit
    from mujpy.mufitplot import mufitplota first run and grp_calib fed to a suite instance, and a  run

  • a second cell invoking suite for a first run and grp_calib@@

    datafile = '/afs/psi.ch/project/bulkmusr/data/gps/d2021/tdc/deltat_tdc_gps_0822.bin'
    runlist = '822' # first run first
    grp_calib = [{'forward':'3', 'backward':'4', 'alpha':1.13}]
    the_suite = suite(datafile, runlist , grp_calib , offset, startuppath)

  • a third invoking the dash

    if 'datafile' in the_suite.__dict__:
        the_dash = dash(the_suite, model='mgml',fit_range=[0,20000,40])

  • This produces a model with parameters set to zero
  • The dash allows you to change run, fit model, grp, and go global:
    • buttons to change single run: < = previous, Load = file selection gui, > next
    • to change model
      • input acronym 'xxyy' and Enter: an empty model with two components 'xx' and 'yy' will appear
      • button Load with drop Best Fit opens /fit subdirectory with recent fit results, loaded as starting guess
      • button Load with drop Template opens /mujpy/template subdirectory where a few empty fit models exist, loaded as starting guess
  • The main dash tab is fit. It allows one to define a model and its guess value, plot guess or results in different views, Fourier transform, plot in Rotating frame. Invoking the fit method jn different ways
    • at start by model acronym: generates a model with guess values set to zero
    • at start by a loading an existing json
    • after request of a new acronym or a loaded dash or edit of existing model (add-delete components)
    • change model type (single/sequential/global run, single/sequential/global groups)
  • Innards:

Folder structure:

  • each instrument+sample is a root folder './' with subfolders to keep folder list readable.
  • jupyterlab is launched from this root that contains
    • the dashboard notebooks
      • have a set of templates per initial fit model, type (calib/normal, single/multi run, single/multi group, sequential/global) and version. Duplicate templates, that must be kept clean. Template folder in mujpy installation directory.
    • Results are
      • printed on a 'keep-an-eye' console in an output widget, side by side with the gui. This guarantees os-independence. Hack by reversing the buffer to obtain that last output is in top (a reversed tail -f terminal)
      • saved in a json fit results file, where result values are appended to starting values, and grp_calib is also appended, so that this json is a completely reproducible starting point.
      • saved on a csv for plotting purposes. The csv is strictly for one model (e.g. if a parameter function is turned on the csv is not compatible)
    • any notebook template reads a _fit.json to reproduce the fit (or compiles it with mudash). So there are two types of notebooks: the interactive ones using the gui dash and the ones using a fixes json dashboard for the reproduction of a fit. They are also included in the templates.
    • template path is automatic: git/mujpy/templates/ and contains template model .json files, one per type and version
    • messy fit path is automatic: ./fit/ and contains template _fit.json results ("model_result" and "userpardicts_result" and "grp_calib" added to template .json). May be difficult to navigate
    • clean csv path is automatic: ./csv/ and contains csv files where a line of parameter values, errors per run is added for plotting purposes, typically one .csv file per dashboard
    • very messy cache path, automatic: ./cache/ containing .txt summary files, like that printed in the output widget.
  • futher experiment-related subfolder may be created from the jupyterlab left bar, e.g. an instrument+sample+mode folder for LF/TF modes. Copy a notebook to it andit will act as root folder. Run the notebook and it will generate its own subfolders

Dashboard notebook

  • the notebook has a preamble (partially hidden). made of
    • imports, hidden
    • Suite and groupings, shown
      • a datafile e.g. '/afs/psi.ch/bulkmusr/data/gps/d2022/tdc/deltat_gps_tdc_1233.bin'
      • a runlist, e.g. '1233' or '1233-47'
      • a model, e.g 'mgml'
      • a version, e.g. 'wtf'
      • an offset (needed for asymmetry, which is a suite method; hence offset elsewhere i accessed as self.suite.offset)
      • a list of group dictionaries, e.g. [{'forward':2,'backward':1,'alpha'=1.18}]
  • the suite command is exec'd before the dash gui (A1, A1-calib, A20, A20-calib, B1)
    • optional userpar list of dictionaries, une per user parameter, acts as switch for a global fit
      • compulsory key is "name", suggested to include unit, e.g. {"name":'B1 [mT]"} (csv: remember to use ',' as separator)
      • optional keys "value","error","limits" (a list, [None,None]is unbounded, [0,0] is fixed)
  • All these can be saved onto
    • a grp_calib.json file (find a naming scheme)
    • an input.suite.json file (>>)

Dashboard

  • Must be able to plot guess and load/next/prev if single run
  • Header info tab
    • Title, comment, max bin, ns/bin
    • total counts
    • partial counts of groups
  • Model template
    • model name (calib is preceded by 'al')
    • Version
    • Offset
    • Fit start, stop, pack
    • Plot results start, stop, pack [,stop2, pack2]
  • optional userpar dashboard with
    • internal number, name (static), value, error, limits
  • component dashboard
    • to be added + button to add a component, - button to remove component
    • label
    • fft tick
    • component pardicts
      • internal number (if userpar it increments on that)
      • name static
      • value
      • flag and function, e.g ~, or !, or =p[1] or =0.255 - p[1]
      • fix automatically errors and limits. No plot flag here
  • todo
    • rotating frame button
    • fft button with fft apodization filter, fft range, fft amplitude/power toggle,
    • add userpar options in group tab
    • add plot tab (parameters, detector plot, temperature plot, multiplot) ,

< Mujpy.WIN10 | Index | Mujpy.Subnotebook >

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