Functions | Variables
wirecell.gen.test.plot_impactzipper Namespace Reference

Functions

def bilogify (hist, lmin=None)
 
def set_palette (which="custom")
 

Variables

 stops = array('d',[ 0.00, 0.45, 0.50, 0.55, 1.00 ])
 
 reds = array('d',[ 0.00, 0.00, 1.00, 1.00, 0.51 ])
 
 greens = array('d',[ 0.00, 0.81, 1.00, 0.20, 0.00 ])
 
 blues = array('d',[ 0.51, 1.00, 1.00, 0.00, 0.00 ])
 
 fp = ROOT.TFile.Open("build/gen/test_impactzipper-uvw.root")
 
dictionary hists = {u:fp.Get("h%d"%n) for n,u in enumerate("uvw")}
 
list limits = [1,1,2]
 
list lmins = [-3, -3, -3]
 
string pdffile = "plot_impactzipper.pdf"
 
 c = ROOT.TCanvas()
 
 lminout = bilogify(h, lmin)
 
 title = h.GetTitle()
 

Function Documentation

def wirecell.gen.test.plot_impactzipper.bilogify (   hist,
  lmin = None 
)
Modify histogram so that it is rescaled in a "bilog" manner.
Negative values are -log10(-z).  An offset in log10 is returned
and represents the 0.

Definition at line 6 of file plot_impactzipper.py.

6 def bilogify(hist, lmin = None):
7  """
8  Modify histogram so that it is rescaled in a "bilog" manner.
9  Negative values are -log10(-z). An offset in log10 is returned
10  and represents the 0.
11  """
12  nx,ny = hist.GetNbinsX(), hist.GetNbinsY()
13  zmax = max(abs(hist.GetMinimum()), abs(hist.GetMaximum()))
14 
15  if lmin is None:
16  zmin = sum([abs(hist.GetBinContent(99,iy)) for iy in range(ny)]) / ny
17  lmin = int(log10(zmin))
18 
19  lmax = 1+int(log10(zmax))
20 
21  for ix in range(hist.GetNbinsX()):
22  for iy in range(hist.GetNbinsY()):
23  val = hist.GetBinContent(ix, iy)
24  if val == 0.0:
25  hist.SetBinContent(ix, iy, 0.0)
26  continue
27 
28  sign = 1.0
29  if val > 0: # opposite sign to match Xin
30  sign = -1.0
31  lval = log10(abs(val))
32  if lval < lmin:
33  lval = 0.0
34  else:
35  lval -= lmin
36  lval *= sign
37  hist.SetBinContent(ix, iy, lval)
38  continue
39  continue
40 
41  lhmax = lmax - lmin
42 
43  hist.SetMaximum(lhmax)
44  hist.SetMinimum(-lhmax)
45  return lmin
46 
47 
T abs(T value)
static int max(int a, int b)
def wirecell.gen.test.plot_impactzipper.set_palette (   which = "custom")

Definition at line 58 of file plot_impactzipper.py.

58 def set_palette(which = "custom"):
59  if not which or which == "custom":
60  ROOT.TColor.CreateGradientColorTable(len(stops), stops, reds, greens, blues, 100)
61  return
62  ROOT.gStyle.SetPalette(which)
63 

Variable Documentation

wirecell.gen.test.plot_impactzipper.blues = array('d',[ 0.51, 1.00, 1.00, 0.00, 0.00 ])

Definition at line 52 of file plot_impactzipper.py.

wirecell.gen.test.plot_impactzipper.c = ROOT.TCanvas()

Definition at line 71 of file plot_impactzipper.py.

wirecell.gen.test.plot_impactzipper.fp = ROOT.TFile.Open("build/gen/test_impactzipper-uvw.root")

Definition at line 64 of file plot_impactzipper.py.

wirecell.gen.test.plot_impactzipper.greens = array('d',[ 0.00, 0.81, 1.00, 0.20, 0.00 ])

Definition at line 51 of file plot_impactzipper.py.

dictionary wirecell.gen.test.plot_impactzipper.hists = {u:fp.Get("h%d"%n) for n,u in enumerate("uvw")}

Definition at line 65 of file plot_impactzipper.py.

list wirecell.gen.test.plot_impactzipper.limits = [1,1,2]

Definition at line 66 of file plot_impactzipper.py.

wirecell.gen.test.plot_impactzipper.lminout = bilogify(h, lmin)

Definition at line 89 of file plot_impactzipper.py.

list wirecell.gen.test.plot_impactzipper.lmins = [-3, -3, -3]

Definition at line 67 of file plot_impactzipper.py.

string wirecell.gen.test.plot_impactzipper.pdffile = "plot_impactzipper.pdf"

Definition at line 69 of file plot_impactzipper.py.

wirecell.gen.test.plot_impactzipper.reds = array('d',[ 0.00, 0.00, 1.00, 1.00, 0.51 ])

Definition at line 50 of file plot_impactzipper.py.

wirecell.gen.test.plot_impactzipper.stops = array('d',[ 0.00, 0.45, 0.50, 0.55, 1.00 ])

Definition at line 49 of file plot_impactzipper.py.

wirecell.gen.test.plot_impactzipper.title = h.GetTitle()

Definition at line 90 of file plot_impactzipper.py.