/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Public Attributes
DybDbi::test_svc_level::RationalizerTester Class Reference

List of all members.

Public Member Functions

def __init__
def purge
def svcMode
def __call__
def check_seqno
def check_channels
def __repr__

Public Attributes

 seqnos
 vsrc
 vtgt
 vcmp
 offset
 cable_offset
 totals

Detailed Description

Definition at line 59 of file test_svc_level.py.


Constructor & Destructor Documentation

def DybDbi::test_svc_level::RationalizerTester::__init__ (   self,
  cmp,
  src,
  tgt,
  offset = 0,
  cable_offset = 0 
)

Definition at line 61 of file test_svc_level.py.

00062                                                              :
00063         vsrc = Vrb(src)
00064         vtgt = Vrb(tgt)
00065         vcmp = Vrb(cmp)
00066         assert vsrc.seqnos == vtgt.seqnos
00067         self.seqnos = sorted(vsrc.seqnos)
00068         self.vsrc = vsrc
00069         self.vtgt = vtgt
00070         self.vcmp = vcmp 
00071         self.offset = offset
00072         self.cable_offset = cable_offset
00073         self.totals = dict(mismatch=0,channels=0,nodata=0)


Member Function Documentation

def DybDbi::test_svc_level::RationalizerTester::purge (   self)

Definition at line 74 of file test_svc_level.py.

00075                    :
00076         log.debug("Purging cache...")
00077         self.vsrc.purge()
00078         self.vtgt.purge()
00079         self.vcmp.purge()

def DybDbi::test_svc_level::RationalizerTester::svcMode (   self,
  vrec,
  offset = 0 
)
:param vrec: 
:param offset:  in seconds from TIMESTART
:return:  Service Mode corresponding to TIMESTART of the validity record parameter

Definition at line 80 of file test_svc_level.py.

00081                                      :
00082          """
00083          :param vrec: 
00084          :param offset:  in seconds from TIMESTART
00085          :return:  Service Mode corresponding to TIMESTART of the validity record parameter
00086          """
00087          thesite=vrec.contextrange.sitemask
00088          thesim=vrec.contextrange.simmask
00089          thesubsite=vrec.subsite
00090          t = TimeStamp(vrec.contextrange.timestart)
00091          t.Add(offset)
00092          ctx = Context(thesite,thesim,t,thesubsite)
00093          return ServiceMode(ctx,vrec.task)

def DybDbi::test_svc_level::RationalizerTester::__call__ (   self,
  seqnos 
)

Definition at line 94 of file test_svc_level.py.

00095                                :
00096         seqs = self.seqnos if len(seqnos)==0 else seqnos 
00097         for seq in seqs:
00098             self.check_seqno(seq)

def DybDbi::test_svc_level::RationalizerTester::check_seqno (   self,
  seq 
)

Definition at line 99 of file test_svc_level.py.

00100                               :
00101          vs = self.vsrc(seq)
00102          vt = self.vtgt(seq)
00103          assert vs.seqno == vt.seqno == seq
00104          with Rollback(CalibPmtHighGain=vs.insertdate, CalibPmtFineGain=vt.insertdate, CableMap=vs.insertdate):
00105              self.purge()             
00106              self.check_channels(vs)

def DybDbi::test_svc_level::RationalizerTester::check_channels (   self,
  vrec 
)
:param vrec:

Using the service mode corresponding to the timestart of the validity record passed
loop over channels comparing results between services

DayaBay::FineGainCalibData
  'm_channelId', 'm_sigmaSpeHigh', 'm_speHigh', 'm_speHighError', 'm_speHighFitQual', 'm_status'

DayaBay::HighGainCalibData
     'm_pmtId', 'm_sigmaSpeHigh', 'm_speHigh', 'm_speHighError', 'm_speHighFitQual', 'm_status'

Definition at line 107 of file test_svc_level.py.

00108                                   :
00109         """
00110         :param vrec:
00111 
00112         Using the service mode corresponding to the timestart of the validity record passed
00113         loop over channels comparing results between services
00114 
00115         DayaBay::FineGainCalibData
00116                   'm_channelId', 'm_sigmaSpeHigh', 'm_speHigh', 'm_speHighError', 'm_speHighFitQual', 'm_status'
00117 
00118         DayaBay::HighGainCalibData
00119                      'm_pmtId', 'm_sigmaSpeHigh', 'm_speHigh', 'm_speHighError', 'm_speHighFitQual', 'm_status'
00120 
00121         """ 
00122         seqno = vrec.seqno
00123         if seqno not in self:
00124             self[seqno] = dict(stat={'channels':0,'nodata':0},mismatch=[])
00125 
00126         svm = self.svcMode( vrec , offset=self.offset )
00127         svc = self.svcMode( vrec , offset=self.cable_offset )
00128         #Note: CableMap needs to be queried with vrec's insert date, not start date
00129         svc.context().SetTimeStamp(vrec.insertdate)
00130         ch = Channels(vrec,svc)
00131 
00132         qwns = ( 'm_sigmaSpeHigh', 'm_speHigh', 'm_speHighError', 'm_speHighFitQual', 'm_status' ) 
00133 
00134         for board,connector,channelId,pmtId in ch():
00135             fineCalibData = calibSvc.fineGainCalibData(channelId,svm)
00136             pmtCalibData = calibSvc.highGainCalibData(pmtId,svm)
00137 
00138             self[seqno]['stat']['channels'] += 1
00139             self.totals['channels'] += 1
00140 
00141             xist = filter(None, (fineCalibData,pmtCalibData))
00142             lxist = len(xist)
00143             assert lxist in (0,2),  ("expect both to exist or not %s ", xist )
00144 
00145             if lxist == 0:
00146                 self[seqno]['stat']['nodata'] += 1
00147                 self.totals['nodata'] += 1
00148                 continue
00149 
00150             assert fineCalibData.m_channelId == channelId
00151             assert pmtCalibData.m_pmtId == pmtId
00152 
00153             msg = "board %-2s connector %-2s channelId %s  pmtId %s " % ( board,connector,hex(channelId.fullPackedData()),hex(pmtId.fullPackedData()))
00154 
00155             mism = compare( pmtCalibData , fineCalibData, qwns )
00156             if len(mism)>0:
00157                 log.warn("%s\n%s" % (msg, "\n".join(map(repr,mism))) )
00158                 self[seqno]['mismatch'].append(msg)
00159                 self.totals['mismatch'] += 1
00160             else:
00161                 log.debug(msg)

def DybDbi::test_svc_level::RationalizerTester::__repr__ (   self)

Definition at line 162 of file test_svc_level.py.

00163                       :
00164         return "\n".join( ["%s : %s : %s " % (seqno,len(self[seqno]['mismatch']),repr(self[seqno]['stat'])) for seqno in self] + [repr(self.totals)] )
00165 


Member Data Documentation

Definition at line 61 of file test_svc_level.py.

Definition at line 61 of file test_svc_level.py.

Definition at line 61 of file test_svc_level.py.

Definition at line 61 of file test_svc_level.py.

Definition at line 61 of file test_svc_level.py.

Definition at line 61 of file test_svc_level.py.

Definition at line 61 of file test_svc_level.py.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:57:24 for DybDbi by doxygen 1.7.4