Public Member Functions | Private Attributes | List of all members
PandAna.core.core.filledSpectrum Class Reference
Inheritance diagram for PandAna.core.core.filledSpectrum:
PandAna.core.core.spectrum

Public Member Functions

def __init__ (self, df, pot, weight=None)
 
def fill (self)
 
def POT (self)
 
def df (self)
 
def weight (self)
 
def histogram (self, bins=None, range=None, POT=None)
 
def entries (self)
 
def integral (self, POT=None)
 
def to_text (self, fileName, sep=' ', header=False)
 
def __add__ (self, b)
 
def __and__ (self, b)
 

Private Attributes

 _df
 
 _POT
 
 _weight
 

Detailed Description

Definition at line 102 of file core.py.

Constructor & Destructor Documentation

def PandAna.core.core.filledSpectrum.__init__ (   self,
  df,
  pot,
  weight = None 
)

Definition at line 103 of file core.py.

103  def __init__(self, df, pot, weight=None):
104  self._df = df
105  self._POT = pot
106 
107  if weight is not None:
108  self._weight = weight
109  else:
110  self._weight = pd.Series(1, self._df.index, name='weight')
111 
def __init__(self, df, pot, weight=None)
Definition: core.py:103

Member Function Documentation

def PandAna.core.core.spectrum.__add__ (   self,
  b 
)
inherited

Definition at line 85 of file core.py.

References PandAna.core.core.spectrum._df, novaddt::SlowMMTrigger._df, and PandAna.core.core.spectrum._POT.

85  def __add__(self, b):
86  df = pd.concat([self._df, b._df])
87  pot = self._POT + b._POT
88  return filledSpectrum(df, pot)
89 
def __add__(self, b)
Definition: core.py:85
def PandAna.core.core.spectrum.__and__ (   self,
  b 
)
inherited

Definition at line 90 of file core.py.

References PandAna.core.core.spectrum._df, novaddt::SlowMMTrigger._df, PandAna.core.core.spectrum._POT, PandAna.core.core.spectrum._weight, and makeHists._weight.

90  def __and__(self, b):
91  assert self._POT == b._POT, "Spectra should have same POT"
92  if self._weight is not None and b._weight is not None:
93  assert np.array_equal(self._weight, b._weight), "Spectra should have same weights"
94 
95  df = pd.concat([self._df, b._df], axis=1)
96  pot = self._POT
97  weight = self._weight
98  return filledSpectrum(df, pot, weight=weight)
99 
100 
101 # For constructing spectra without having to fill
def __and__(self, b)
Definition: core.py:90
def PandAna.core.core.spectrum.df (   self)
inherited

Definition at line 64 of file core.py.

References PandAna.core.core.spectrum._df, and novaddt::SlowMMTrigger._df.

64  def df(self):
65  return self._df
66 
def PandAna.core.core.spectrum.entries (   self)
inherited

Definition at line 75 of file core.py.

75  def entries(self):
76  return self._df.shape[0]
77 
def PandAna.core.core.filledSpectrum.fill (   self)

Definition at line 112 of file core.py.

References print.

112  def fill(self):
113  print('This spectrum was constructed already filled.')
114 
115 # Save spectra to an hdf5 file. Takes a single or a list of spectra
bool print
def PandAna.core.core.spectrum.histogram (   self,
  bins = None,
  range = None,
  POT = None 
)
inherited

Definition at line 70 of file core.py.

References PandAna.core.core.spectrum._df, novaddt::SlowMMTrigger._df, PandAna.core.core.spectrum._POT, PandAna.core.core.spectrum._weight, and makeHists._weight.

70  def histogram(self, bins=None, range=None, POT=None):
71  if not POT: POT = self._POT
72  n, bins = np.histogram(self._df, bins, range, weights = self._weight)
73  return n*POT/self._POT, bins
74 
def histogram(self, bins=None, range=None, POT=None)
Definition: core.py:70
def PandAna.core.core.spectrum.integral (   self,
  POT = None 
)
inherited

Definition at line 78 of file core.py.

References PandAna.core.core.spectrum._POT.

78  def integral(self,POT=None):
79  if not POT: POT = self._POT
80  return self._weight.sum()*POT/self._POT
81 
def integral(self, POT=None)
Definition: core.py:78
def PandAna.core.core.spectrum.POT (   self)
inherited

Definition at line 61 of file core.py.

References PandAna.core.core.spectrum._POT.

61  def POT(self):
62  return self._POT
63 
def PandAna.core.core.spectrum.to_text (   self,
  fileName,
  sep = ' ',
  header = False 
)
inherited

Definition at line 82 of file core.py.

82  def to_text(self, fileName, sep=' ', header=False):
83  self._df.to_csv(fileName, sep=sep, index=True, header=header)
84 
def to_text(self, fileName, sep=' ', header=False)
Definition: core.py:82
def PandAna.core.core.spectrum.weight (   self)
inherited

Definition at line 67 of file core.py.

References PandAna.core.core.spectrum._weight, and makeHists._weight.

67  def weight(self):
68  return self._weight
69 

Member Data Documentation

PandAna.core.core.filledSpectrum._df
private

Definition at line 104 of file core.py.

PandAna.core.core.filledSpectrum._POT
private

Definition at line 105 of file core.py.

PandAna.core.core.filledSpectrum._weight
private

Definition at line 108 of file core.py.


The documentation for this class was generated from the following file: