Uploaded image for project: 'ROOT'
  1. ROOT
  2. ROOT-7960

Computation blocked only on jupyter notebook

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 6.06/00
    • Fix Version/s: None
    • Component/s: Notebooks
    • Labels:
      None
    • Environment:

      fedora 23, ipython 4.0.1, jupyter 4.0.2, python 2.7.10

    • Development:

      Description

      I have noticed that some computations are blocked when evaluated in a jupyter notebook. All these operations have a long output on the std output (RooFit fit), that from ROOT 6.06 is redirected to the jupyter cells.

      Here an example, but I noticed this behaviour several times.

      First cell of the notebook:

      import ROOT
      from ROOT import RooFit, RooStats

      second cell:

      f = ROOT.TFile("ws_shape.root")
      ws = f.Get("ws_shape")
       
      data = ws.data('obsData')
      mass = ws.var('mass')
      mH = ws.var('mH')
      sbModel = ws.obj('sbModel')
      bModel = ws.obj('bModel')

      third cell:

      import sys
       
      mH_values = np.linspace(mH.getMin(), mH.getMax(), 20)
      pvalues, pvalues_exp, zs, qvalues = [], [], [], []
      for mH_value in mH_values:
          sys.stdout.flush()
          mH.setVal(mH_value)
          mH.setConstant(True)
          print "mH = ", mH.getVal(),
          #ws.pdf('model').fitTo(data)   # better to do a fit before
          
          profll = RooStats.ProfileLikelihoodTestStat(bModel.GetPdf())
          profll.SetOneSidedDiscovery(True)
          qvalues.append(profll.Evaluate(data, bModel.GetParametersOfInterest()))
          
          hypoCalc = RooStats.AsymptoticCalculator(data, sbModel, bModel)
          hypoCalc.SetOneSidedDiscovery(True)
          htr = hypoCalc.GetHypoTest()
          print "pvalue =", htr.NullPValue(), " significance =", htr.Significance()
          pval_exp = RooStats.AsymptoticCalculator.GetExpectedPValues(htr.NullPValue(), htr.AlternatePValue(), 0, False)
          pvalues.append(htr.NullPValue()); zs.append(htr.Significance()); pvalues_exp.append(pval_exp)
          del hypoCalc
          del htr

      The output I get from this cell is:

      mH =  90.0 pvalue = 0.5  significance = -0.0

      and then it doesn't continue.

      If I evaluate the same code in a plain python console, the execution take just a second.
      If I evaluate the same notebook using previous version of ROOT it works (and the std output is not visible in jupyter, only the print output, as expected).

      I attach the workspace.

        Attachments

        1. ROOT-7960.ipynb
          4 kB
        2. ROOT-7960.py
          1 kB
        3. ws_shape.root
          20 kB

          Issue Links

            Activity

              People

              • Assignee:
                dpiparo Danilo Piparo
                Reporter:
                turra Ruggero Turra
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: