Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | List of all members
generic.models.PlotInfo.Exposure Class Reference
Inheritance diagram for generic.models.PlotInfo.Exposure:
object

Public Member Functions

def __init__ (self, kwargs)
 
def __iadd__ (self, other)
 
def __imul__ (self, other)
 
def __add__ (self, other)
 
def __mul__ (self, other)
 
def __isub__ (self, other)
 
def __sub__ (self, other)
 
def __idiv__ (self, other)
 
def __div__ (self, other)
 

Public Attributes

short int type
 
short int number
 
char name [SIZE_OF_OBJ_NAME]
 
cat_entry star
 

Static Public Attributes

list EXPOSURE_TYPES
 

Private Member Functions

def _clone (self)
 

Detailed Description

Stores exposure (POT and/or livetime) information for a plot 

Definition at line 17 of file PlotInfo.py.

Constructor & Destructor Documentation

def generic.models.PlotInfo.Exposure.__init__ (   self,
  kwargs 
)

Definition at line 24 of file PlotInfo.py.

24  def __init__(self, **kwargs):
25 
26  exposures = {exp_type: kwargs[exp_type] if exp_type in kwargs else None for exp_type in Exposure.EXPOSURE_TYPES}
27  if not any(exposures.values()):
28  raise Exception("At least one of these exposure types must be specified to construct an Exposure: %s" % Exposure.EXPOSURE_TYPES)
29 
30  for exp_type, exposure in exposures.iteritems():
31  setattr(self, exp_type, exposure)
32 
def __init__(self, kwargs)
Definition: PlotInfo.py:24
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66

Member Function Documentation

def generic.models.PlotInfo.Exposure.__add__ (   self,
  other 
)
def generic.models.PlotInfo.Exposure.__div__ (   self,
  other 
)

Definition at line 85 of file PlotInfo.py.

85  def __div__(self, other):
86  return (1/other) * self
87 
88 
def __div__(self, other)
Definition: PlotInfo.py:85
def generic.models.PlotInfo.Exposure.__iadd__ (   self,
  other 
)

Definition at line 36 of file PlotInfo.py.

36  def __iadd__(self, other):
37  assert all(hasattr(other, prop) for prop in Exposure.EXPOSURE_TYPES)
38 
39  # make sure that if an exposure type is None for one, it's also None for the other.
40  # otherwise the addition shouldn't proceed (i.e., known + unknown = ??)
41  assert all( getattr(self, prop) is None == getattr(other, prop) for prop in Exposure.EXPOSURE_TYPES )
42 
43  for prop in Exposure.EXPOSURE_TYPES:
44  if getattr(self, prop) is None:
45  continue
46 
47  setattr(self, prop, getattr(self, prop) + getattr(other, prop))
48 
49  return self
50 
def __iadd__(self, other)
Definition: PlotInfo.py:36
def generic.models.PlotInfo.Exposure.__idiv__ (   self,
  other 
)

Definition at line 81 of file PlotInfo.py.

81  def __idiv__(self, other):
82  self *= (1/other)
83  return self
84 
def __idiv__(self, other)
Definition: PlotInfo.py:81
def generic.models.PlotInfo.Exposure.__imul__ (   self,
  other 
)

Definition at line 51 of file PlotInfo.py.

51  def __imul__(self, other):
52  if not isinstance(other, numbers.Number):
53  raise TypeError("Can only multiple Exposures by scalar numbers, not %s" % type(other))
54 
55  for prop in Exposure.EXPOSURE_TYPES:
56  if getattr(self, prop) is None:
57  continue
58 
59  setattr(self, prop, other * getattr(self, prop))
60 
61  return self
62 
def __imul__(self, other)
Definition: PlotInfo.py:51
def generic.models.PlotInfo.Exposure.__isub__ (   self,
  other 
)

Definition at line 73 of file PlotInfo.py.

73  def __isub__(self, other):
74  return self + (-1) * other
75 
def __isub__(self, other)
Definition: PlotInfo.py:73
def generic.models.PlotInfo.Exposure.__mul__ (   self,
  other 
)
def generic.models.PlotInfo.Exposure.__sub__ (   self,
  other 
)
def generic.models.PlotInfo.Exposure._clone (   self)
private

Definition at line 33 of file PlotInfo.py.

Referenced by generic.models.PlotInfo.Exposure.__add__(), generic.models.PlotInfo.Exposure.__mul__(), and generic.models.PlotInfo.Exposure.__sub__().

33  def _clone(self):
34  return Exposure(**{prop: getattr(self, prop) for prop in Exposure.EXPOSURE_TYPES})
35 

Member Data Documentation

list generic.models.PlotInfo.Exposure.EXPOSURE_TYPES
static
Initial value:
1 = [
2  "POT",
3  "livetime",
4  ]

Definition at line 20 of file PlotInfo.py.

char object::name
inherited
short int object::number
inherited

Definition at line 115 of file novas.h.

cat_entry object::star
inherited

Definition at line 117 of file novas.h.

short int object::type
inherited

Definition at line 114 of file novas.h.


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