Explorar el Código

Adds simple debugging which can just print out the values as they are
bgin calculated to find what is causing crashes. Fixes bug in Hist2d
code.

Caleb Fangmeier hace 6 años
padre
commit
7953c45809
Se han modificado 3 ficheros con 6 adiciones y 7 borrados
  1. 5 4
      filval/histogram_utils.py
  2. 1 1
      filval/plotter.py
  3. 0 2
      setup.py

+ 5 - 4
filval/histogram_utils.py

@@ -42,6 +42,7 @@ def hist2d(th2, rescale_x=1.0, rescale_y=1.0, rescale_z=1.0):
     """
     nbins_x = th2.GetNbinsX()
     nbins_y = th2.GetNbinsY()
+    print(nbins_x, nbins_y)
     xs = np.zeros((nbins_y+1, nbins_x+1), np.float32)
     ys = np.zeros((nbins_y+1, nbins_x+1), np.float32)
     values = np.zeros((nbins_y, nbins_x), np.float32)
@@ -52,11 +53,11 @@ def hist2d(th2, rescale_x=1.0, rescale_y=1.0, rescale_z=1.0):
             ys[j][i] = th2.GetYaxis().GetBinLowEdge(j+1)
             values[j][i] = th2.GetBinContent(i+1, j+1)
             errors[j][i] = th2.GetBinError(i+1, j+1)
-        xs[nbins_y][i] = th2.GetXaxis().GetBinUpEdge(i+1)
-        ys[nbins_y][i] = th2.GetYaxis().GetBinUpEdge(nbins_y+1)
+        xs[nbins_y][i] = th2.GetXaxis().GetBinUpEdge(i)
+        ys[nbins_y][i] = th2.GetYaxis().GetBinUpEdge(nbins_y)
     for j in range(nbins_y+1):
-        xs[j][nbins_x] = th2.GetXaxis().GetBinUpEdge(nbins_x+1)
-        ys[j][nbins_x] = th2.GetYaxis().GetBinUpEdge(j+1)
+        xs[j][nbins_x] = th2.GetXaxis().GetBinUpEdge(nbins_x)
+        ys[j][nbins_x] = th2.GetYaxis().GetBinUpEdge(j)
 
     xs *= rescale_x
     ys *= rescale_y

+ 1 - 1
filval/plotter.py

@@ -200,7 +200,7 @@ def render_plots(plots, exts=('png',), scale=1.0, to_disk=True):
         print(f'Building plot {plot.name}')
         plot.data = None
         if to_disk:
-            with lp.figure(plot.name, directory='output/figures',
+            with lp.figure(plot.name.replace(' ', '_'), directory='output/figures',
                            exts=exts,
                            size=(scale * 10, scale * 10)):
                 argdicts, docs = grid_plot(plot.subplots)

+ 0 - 2
setup.py

@@ -3,8 +3,6 @@ from setuptools import setup
 with open('requirements.txt') as req:
     install_requires = [l.strip() for l in req.readlines()]
 
-print(install_requires)
-
 setup(
     name='filval',
     version='0.1',