CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Attributes
utils_v2.StatisticalTest Class Reference

StatisticalTests. More...

Inheritance diagram for utils_v2.StatisticalTest:
utils_v2.Chi2Test utils_v2.KolmogorovTest

Public Member Functions

def do_test (self, h1, h2)
 
def get_N_bins (self, h)
 
def is_empty (self, h)
 

Static Public Attributes

 name
 

Detailed Description

StatisticalTests.

Definition at line 302 of file utils_v2.py.

Member Function Documentation

◆ do_test()

def utils_v2.StatisticalTest.do_test (   self,
  h1,
  h2 
)

Reimplemented in utils_v2.Chi2Test, and utils_v2.KolmogorovTest.

Definition at line 319 of file utils_v2.py.

319  def do_test(self, h1, h2):
320  if not h1 or not h2:
321  raise ComparisonError('Missing histogram')
322  if not isinstance(h1, type(h2)):
323  return -104 # raise ComparisonError('Histograms have different types')
324  if not h1.InheritsFrom('TH1'):
325  return -105 # raise ComparisonError('Object is not a histogram')
326  if self.is_empty(h1) or self.is_empty(h2):
327  return 1
328  h1_bins = self.get_N_bins(h1)
329  if h1_bins != self.get_N_bins(h2):
330  return -103 # raise CoparisonError('Ranges of histograms are different')
331 
332 

References utils_v2.StatisticalTest.get_N_bins(), DEutils< T >.is_empty(), DEcompare< T >.is_empty(), dirstructure.Directory.is_empty(), and utils_v2.StatisticalTest.is_empty().

◆ get_N_bins()

def utils_v2.StatisticalTest.get_N_bins (   self,
  h 
)

Definition at line 305 of file utils_v2.py.

305  def get_N_bins(self, h):
306  x = h.GetNbinsX()
307  y = h.GetNbinsY()
308  z = h.GetNbinsZ()
309  if not (y and z): # Is this realy necessary?
310  return 0
311  return (x + 1) * (y + 1) * (z + 1)
312 

Referenced by utils_v2.StatisticalTest.do_test(), utils_v2.Chi2Test.do_test(), and utils_v2.StatisticalTest.is_empty().

◆ is_empty()

def utils_v2.StatisticalTest.is_empty (   self,
  h 
)

Definition at line 313 of file utils_v2.py.

313  def is_empty(self, h):
314  for i in range(1, self.get_N_bins(h)):
315  if h.GetBinContent(i) != 0:
316  return False
317  return True
318 

References utils_v2.StatisticalTest.get_N_bins(), and FastTimerService_cff.range.

Referenced by utils_v2.StatisticalTest.do_test().

Member Data Documentation

◆ name

utils_v2.StatisticalTest.name
static
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
utils.is_empty
def is_empty(h)
Definition: utils.py:179