{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Example of B2 multirun sequential, multigroup global fits with animated mufitplot**\n",
    "\n",
    "Description of data set and experiment: \n",
    "* Download the data: e.g. GPS 2021 0822-0834 from http://musruser.psi.ch/cgi-bin/SearchDB.cgi or replace `datafile` in cell [2] with  /afs/psi.ch/project/bulkmusr/data/gps/2021/tdc/deltat_tdc_gps_0822.bin (MAKE SURE YOU HAVE ACCESS TO /afs/psi.ch/ AND RENEW IT)\n",
    "* Weak Transverse Field (WEP, along \\\\(\\hat x\\\\)), T-scan (1.5K-30K), on a magnetic sample with a broad distribution of internal fields below Tc ~ 20 K; groups are 2-1, along the beam \\\\(\\hat z\\\\) (full asymmetry ,\\\\(A_{21}\\\\)) and 3-4, along \\\\(\\hat y\\\\) (full asymmetry \\\\(A_{34}\\\\)). The initial muon spin lies at angle \\\\(\\theta\\\\) from \\\\(-\\hat z\\\\) in the \\\\(yz\\\\) plane. \n",
    "\n",
    "Approximate global fit:\n",
    "* ml: external field component, includes sample and environment above Tc, only environment at low T, a secondary phase in between; in principle it could consist of two-three distinct components; fraction \\\\(\\approx 1-f_{mag}(T)\\\\), magnetic field \\\\(B_0 \\approx 10\\\\) mT along \\\\(\\hat x\\\\), amplitude drops below Tc, phase is group-dependent \\\\((\\phi_{21},\\phi_{34}\\approx \\phi_{21}-\\pi/2)\\\\), \\\\(\\lambda_0\\\\) is group-global. \n",
    "* mg: transverse internal field component, expect a mean value \\\\(B_T(T)\\\\) along \\\\(\\hat z\\\\), with very broad \\\\(\\sigma_T(T)\\\\), amplitude \\\\(A_{34}f_{mag}(T)\\cos^2\\theta\\\\) along \\\\(\\hat y\\\\) (3-4),  and vanishing along \\\\(\\hat z\\\\) (2-1); one may expect \\\\(\\theta\\approx\\phi_{12}\\\\)\n",
    "* bl: longitudinal internal field component, with amplitude  \\\\(A_{21}f_{mag}(T)(1-\\cos^2\\theta)\\\\)  and a moderate  \\\\(\\lambda_L(T)\\\\)\n",
    "\n",
    "To run, after accessing data files, you must only adapt\n",
    "* the `%cd` magic in cell [1]\n",
    "* `logpath`, `datafile`\n",
    "* optionally, you can play with `...git/mujpy/log/mlmgbl.822.2-1_3-4.gg_1.json`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/home/roberto.derenzi/git/mujpy\n"
     ]
    }
   ],
   "source": [
    "%matplotlib tk\n",
    "%cd /home/roberto.derenzi/git/mujpy/  \n",
    "# adapt this\n",
    "from mujpy.musuite import suite\n",
    "import json, re\n",
    "from os.path import isfile\n",
    "from mujpy.mufit import mufit\n",
    "from mujpy.mufitplot import mufitplot\n",
    "jsonsuffix = '.json'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "logpath = '/home/roberto.derenzi/git/mujpy/log/' # adapt this\n",
    "datafile = '/home/roberto.derenzi/musrfit/MBT/gps/run_05_21/data/deltat_tdc_gps_0822.bin' # adapt this\n",
    "runlist = '822,823:834:-1' #  first run first\n",
    "modelname = 'mlmgbl'  # in jupyter notebook version see the the json ...git/mujpy/log/mlmgbl.822.2-1_3-4.gg_1.json (adapt)\n",
    "version = 'gg_1' ## gg_ is the group global convention for A21 and B2-type fits\n",
    "grp_calib = [{'forward':'2', 'backward':'1', 'alpha':1.13},{'forward':'3', 'backward':'4', 'alpha':1.13}] # two groups\n",
    "groupcalibfile = '2-1_3-4.calib' # in a separate single json (simple dict) file\n",
    "inputsuitefile = 'input.suite' # in a single json (simple dict) file\n",
    "dashboard = modelname+'.'+re.search(r'\\d+', runlist).group()+'.'+groupcalibfile[:groupcalibfile.index('.')+1]+version+jsonsuffix\n",
    "if not isfile(logpath+dashboard): \n",
    "    print('Model definition dashboard file {} does not exist. Make one.'.format(logpath+dashboard))\n",
    "# dashboard is the jargon name for the content of the model-defining json file  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "******************* SUITE *********************\n",
      "Run /home/roberto.derenzi/musrfit/MBT/gps/run_05_21/data/deltat_tdc_gps_0822.bin loaded\n",
      " MnBi6Te10 pellet 30.0K 10mT\n",
      "Run /home/roberto.derenzi/musrfit/MBT/gps/run_05_21/data/deltat_tdc_gps_0834.bin loaded\n",
      " MnBi6Te10 pellet 23.0K 10mT\n",
      "Run /home/roberto.derenzi/musrfit/MBT/gps/run_05_21/data/deltat_tdc_gps_0833.bin loaded\n",
      " MnBi6Te10 pellet 20.0K 10mT\n",
      "Run /home/roberto.derenzi/musrfit/MBT/gps/run_05_21/data/deltat_tdc_gps_0832.bin loaded\n",
      " MnBi6Te10 pellet 17.0K 10mT\n",
      "Run /home/roberto.derenzi/musrfit/MBT/gps/run_05_21/data/deltat_tdc_gps_0831.bin loaded\n",
      " MnBi6Te10 pellet 16.0K 10mT\n",
      "Run /home/roberto.derenzi/musrfit/MBT/gps/run_05_21/data/deltat_tdc_gps_0830.bin loaded\n",
      " MnBi6Te10 pellet 15.0K 10mT\n",
      "Run /home/roberto.derenzi/musrfit/MBT/gps/run_05_21/data/deltat_tdc_gps_0829.bin loaded\n",
      " MnBi6Te10 pellet 14.0K 10mT\n",
      "Run /home/roberto.derenzi/musrfit/MBT/gps/run_05_21/data/deltat_tdc_gps_0828.bin loaded\n",
      " MnBi6Te10 pellet 13.0K 10mT\n",
      "Run /home/roberto.derenzi/musrfit/MBT/gps/run_05_21/data/deltat_tdc_gps_0827.bin loaded\n",
      " MnBi6Te10 pellet 12.0K 10mT\n",
      "Run /home/roberto.derenzi/musrfit/MBT/gps/run_05_21/data/deltat_tdc_gps_0826.bin loaded\n",
      " MnBi6Te10 pellet 11.0K 10mT\n",
      "Run /home/roberto.derenzi/musrfit/MBT/gps/run_05_21/data/deltat_tdc_gps_0825.bin loaded\n",
      " MnBi6Te10 pellet 10.0K 10mT\n",
      "Run /home/roberto.derenzi/musrfit/MBT/gps/run_05_21/data/deltat_tdc_gps_0824.bin loaded\n",
      " MnBi6Te10 pellet 6.0K 10mT\n",
      "Run /home/roberto.derenzi/musrfit/MBT/gps/run_05_21/data/deltat_tdc_gps_0823.bin loaded\n",
      " MnBi6Te10 pellet 1.5K 10mT\n",
      "Succesfully completed prompt Minuit fit, check nt0, dt0 \n",
      "****************END OF SUITE*****************\n"
     ]
    }
   ],
   "source": [
    "#  can add 'scan':'T' or 'B' for orderinng csv for increasing T, B, otherwise increasing nrun\n",
    "input_suite = {'console':'print',\n",
    "                   'datafile':datafile,\n",
    "                   'logpath':logpath,\n",
    "                   'runlist':runlist,\n",
    "                   'groups calibration':groupcalibfile,\n",
    "                   'offset':20\n",
    "                  }  # 'console':logging, for output in Log Console, 'console':print, for output in notebook\n",
    "with open(logpath+inputsuitefile,\"w\") as f:\n",
    "    json.dump(input_suite,f)\n",
    "\n",
    "with open(logpath+groupcalibfile,\"w\") as f:\n",
    "    json.dump(grp_calib,f)\n",
    "    \n",
    "the_suite = suite(logpath+inputsuitefile,mplot=False) # the_suite implements the class suite according to input.suite"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Model definition from file /home/roberto.derenzi/git/mujpy/log/mlmgbl.822.2-1_3-4.gg_1.json\n",
      "mufit dofit_sequentialrun_multigroup_userpardicts debug: shape asymm, asyme = (13, 2, 25178), (13, 2, 25178)\n",
      "mufit dofit_sequentialrun_multigroup_userpardicts debug: Minuit inputs\n",
      "0 f_mag = 0.75(0.005), False, [0, 1] \n",
      "1 A12 = 0.25(0.005), False, [None, None] \n",
      "2 A34 = 0.25(0.005), False, [None, None] \n",
      "3 cosqt = 0.75(0.005), False, [0, 1] \n",
      "4 φ12 = -55.0(0.005), False, [None, None] \n",
      "5 φ34 = 35.0(0.005), False, [None, None] \n",
      "6 B_0 = 10.0(0.005), False, [None, None] \n",
      "7 B_T = 300.0(0.005), False, [None, None] \n",
      "8 λ_0 = 0.1(0.005), False, [-87.0, None] \n",
      "9 σ_T = 5.0(0.005), False, [None, None] \n",
      "10 λ_L = 0.1(0.005), False, [-87.0, None] \n",
      "int2_multigroup_method_key aux debug: userpardicts \n",
      "0 f_mag = 0.75(0.005), ~, [0, 1] \n",
      "1 A12 = 0.25(0.005), ~, [None, None] \n",
      "2 A34 = 0.25(0.005), ~, [None, None] \n",
      "3 cosqt = 0.75(0.005), ~, [0, 1] \n",
      "4 φ12 = -55.0(0.005), ~, [None, None] \n",
      "5 φ34 = 35.0(0.005), ~, [None, None] \n",
      "6 B_0 = 10.0(0.005), ~, [None, None] \n",
      "7 B_T = 300.0(0.005), ~, [None, None] \n",
      "8 λ_0 = 0.1(0.005), ~, [-87.0, None] \n",
      "9 σ_T = 5.0(0.005), ~, [None, None] \n",
      "10 λ_L = 0.1(0.005), ~, [-87.0, None] \n",
      "aux int2_multigroup_method_key debug: A[0] = (1-p[0])*p[1]\n",
      "aux int2_multigroup_method_key debug: B[0] = p[6]\n",
      "aux int2_multigroup_method_key debug: φ[0] = p[4]\n",
      "aux int2_multigroup_method_key debug: λ[0] = p[8]\n",
      "aux int2_multigroup_method_key debug: A[1] = (1-p[0])*p[2]\n",
      "aux int2_multigroup_method_key debug: B[1] = p[6]\n",
      "aux int2_multigroup_method_key debug: φ[1] = p[5]\n",
      "aux int2_multigroup_method_key debug: λ[1] = p[8]\n",
      "aux int2_multigroup_method_key debug: A[0] = p[1]-p[1]\n",
      "aux int2_multigroup_method_key debug: B[0] = p[7]\n",
      "aux int2_multigroup_method_key debug: φ[0] = p[4]-p[4]\n",
      "aux int2_multigroup_method_key debug: σ[0] = p[9]\n",
      "aux int2_multigroup_method_key debug: A[1] = p[0]*(1.-p[3])*p[2]\n",
      "aux int2_multigroup_method_key debug: B[1] = p[7]\n",
      "aux int2_multigroup_method_key debug: φ[1] = p[5]-p[5]\n",
      "aux int2_multigroup_method_key debug: σ[1] = p[9]\n",
      "aux int2_multigroup_method_key debug: A[0] = p[0]*p[3]*p[1]\n",
      "aux int2_multigroup_method_key debug: λ[0] = p[10]\n",
      "aux int2_multigroup_method_key debug: A[1] = p[2]-p[2]\n",
      "aux int2_multigroup_method_key debug: λ[1] = p[10]\n",
      "mufit dofit_sequentialrun_multigroup_userpardicts debug: check asyme[0,0] contains zeros!\n",
      "mufit dofit_sequentialrun_multigroup_userpardicts debug: asymm.shape (2, 4800) \n"
     ]
    },
    {
     "ename": "NameError",
     "evalue": "name 'where' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-4-beca39c82562>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Model definition from file {}'\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlogpath\u001b[0m\u001b[0;34m+\u001b[0m\u001b[0mdashboard\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mthe_fit\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mmufit\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mthe_suite\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mlogpath\u001b[0m\u001b[0;34m+\u001b[0m\u001b[0mdashboard\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;31m#, chain=True)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[0;32m~/git/mujpy/mujpy/mufit.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, suite, dashboard_file, chain)\u001b[0m\n\u001b[1;32m     14\u001b[0m         \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mnodash\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     15\u001b[0m         \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mnodata\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 16\u001b[0;31m         \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_initialise_fit\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdashboard_file\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mchain\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     17\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     18\u001b[0m     \u001b[0;32mdef\u001b[0m \u001b[0m_initialise_fit\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mdashboard_file\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mchain\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/git/mujpy/mujpy/mufit.py\u001b[0m in \u001b[0;36m_initialise_fit\u001b[0;34m(self, dashboard_file, chain)\u001b[0m\n\u001b[1;32m     59\u001b[0m         \u001b[0;31m# self.suite.console(\"**** Fit initialized *****\")\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     60\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 61\u001b[0;31m         \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mchoosefit\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mchain\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     62\u001b[0m             \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msuite\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconsole\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'     mufit stops here'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     63\u001b[0m \u001b[0;31m#        else:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/git/mujpy/mujpy/mufit.py\u001b[0m in \u001b[0;36mchoosefit\u001b[0;34m(self, chain)\u001b[0m\n\u001b[1;32m    166\u001b[0m                         self.dashboard[\"version\"]=('gg_'+version if \n\u001b[1;32m    167\u001b[0m                                         self.dashboard[\"version\"][0:3]!='gg_' else version)\n\u001b[0;32m--> 168\u001b[0;31m                         \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdofit_sequentialrun_multigroup_userpardicts\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mreturntup\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mchain\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    169\u001b[0m                         \u001b[0;31m# pe.g TF sequential of multigroups with shared parameters\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    170\u001b[0m         \u001b[0;32mreturn\u001b[0m \u001b[0;32mFalse\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/git/mujpy/mujpy/mufit.py\u001b[0m in \u001b[0;36mdofit_sequentialrun_multigroup_userpardicts\u001b[0;34m(self, returntup, chain)\u001b[0m\n\u001b[1;32m    737\u001b[0m             \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_the_model_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_load_data_multigroup_\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtime\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0masymm\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mmethods_keys\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0masyme\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    738\u001b[0m                                     \u001b[0;31m# int2_int() returns a list of methods to calculate the components\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 739\u001b[0;31m             \u001b[0mf\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0marray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mwhere\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_the_model_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_add_\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtime\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mvalues\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m>\u001b[0m\u001b[0msqrt\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfinfo\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'd'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmax\u001b[0m\u001b[0;34m/\u001b[0m\u001b[0;36m1000\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    740\u001b[0m             \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'mufit dofit_sequentialrun_multigroup_userpardicts debug: large f in  {} places'\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msize\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    741\u001b[0m             self.lastfit = Minuit(self._the_model_._chisquare_,\n",
      "\u001b[0;32m~/git/mujpy/mujpy/mucomponents/mucomponents.py\u001b[0m in \u001b[0;36m_add_multigroup_\u001b[0;34m(self, x, *argv)\u001b[0m\n\u001b[1;32m    503\u001b[0m             \u001b[0;31m# print('add_multigroup mucomponents debug: f.shape = {}, zeros.shape = {}'.format(\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    504\u001b[0m             \u001b[0;31m#                                                         f.shape,zeros_like(x).shape))\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 505\u001b[0;31m             \u001b[0mwarn\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0marray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mwhere\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mabs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mf\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m>\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    506\u001b[0m             \u001b[0;32mif\u001b[0m \u001b[0mwarn\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msize\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    507\u001b[0m                 \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Warning, model is getting too big in {}'\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mwarn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mNameError\u001b[0m: name 'where' is not defined"
     ]
    }
   ],
   "source": [
    "print('Model definition from file {}'.format(logpath+dashboard))\n",
    "the_fit = mufit(the_suite,logpath+dashboard)#, chain=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "fit_plot= mufitplot('0,20000,100',the_fit) # try '0,1000,4,24000,100'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
