/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_RG::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

 offset_vorg
 offset_vsrc
 offset_vtgt
 seqnos
 vsrc
 vtgt
 vorg
 vcmp
 offset
 cable_offset
 totals

Detailed Description

Definition at line 63 of file test_svc_level_RG.py.


Constructor & Destructor Documentation

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

Definition at line 64 of file test_svc_level_RG.py.

00065                                                                  :
00066         vsrc = Vrb(src,1)
00067         vtgt = Vrb(tgt,1)
00068         vorg = Vrb(org)
00069         vcmp = Vrb(cmp)
00070 
00071         # number of entries in tgt
00072         print "Seqnos in org with all tasks: ",len(vorg.seqnos)
00073         print "Seqnos in src with task=1: ",len(vsrc.seqnos)
00074         print "Seqnos in tgt with task=1: ",len(vtgt.seqnos)
00075 
00076         # define offsets (earliest seqnos with task=1 minus 1)
00077         self.offset_vorg = 27877
00078         self.offset_vsrc = 1268
00079         self.offset_vtgt = 1410
00080 
00081         # giving the 6496 new entries an aligned counter into the 3 pots
00082         vorg.seqnos[:] = [x - self.offset_vorg for x in vorg.seqnos]
00083         vsrc.seqnos[:] = [x - self.offset_vsrc for x in vsrc.seqnos]
00084         vtgt.seqnos[:] = [x - self.offset_vtgt for x in vtgt.seqnos]
00085 
00086         # for debug purposes only <----       
00087         #for ientry in range(0,20):
00088         #    print "The entries ",vsrc.seqnos[ientry],",",vtgt.seqnos[ientry],",",vorg.seqnos[ientry]
00089 
00090         # equal by virtue of task 1 restriction
00091         assert vsrc.seqnos == vtgt.seqnos    
00092         self.seqnos = sorted(vsrc.seqnos)
00093         self.vsrc = vsrc
00094         self.vtgt = vtgt
00095         self.vorg = vorg
00096         self.vcmp = vcmp 
00097         self.offset = offset
00098         self.cable_offset = cable_offset
00099         self.totals = dict(mismatch=0,channels=0,nodata=0)


Member Function Documentation

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

Definition at line 100 of file test_svc_level_RG.py.

00101                    :
00102         log.debug("Purging cache...")
00103         self.vsrc.purge()
00104         self.vtgt.purge()
00105         self.vcmp.purge()
00106         self.vorg.purge()

def DybDbi::test_svc_level_RG::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 107 of file test_svc_level_RG.py.

00108                                      :
00109          """
00110          :param vrec: 
00111          :param offset:  in seconds from TIMESTART
00112          :return:  Service Mode corresponding to TIMESTART of the validity record parameter
00113          """
00114          thesite=vrec.contextrange.sitemask
00115          thesim=vrec.contextrange.simmask
00116          thesubsite=vrec.subsite
00117          t = TimeStamp(vrec.contextrange.timestart)
00118          t.Add(offset)
00119          ctx = Context(thesite,thesim,t,thesubsite)
00120          return ServiceMode(ctx,vrec.task)

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

Definition at line 121 of file test_svc_level_RG.py.

00122                                :
00123         seqs = self.seqnos if len(seqnos)==0 else seqnos 
00124         for seq in seqs:
00125             self.check_seqno(seq)

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

Definition at line 126 of file test_svc_level_RG.py.

00127                               :
00128          vs = self.vsrc(seq+self.offset_vsrc)
00129          vt = self.vtgt(seq+self.offset_vtgt)
00130          vo = self.vorg(seq+self.offset_vorg)
00131          print "Comparing seqnos: ","orig-->",vo.seqno," src-->",vs.seqno,", tgt-->",vt.seqno," counter-->",seq
00132 
00133          #sanity checks
00134          assert vs.seqno-self.offset_vsrc == vt.seqno-self.offset_vtgt == vo.seqno-self.offset_vorg == seq
00135          assert vs.GetContextRange().GetTimeStart().GetSec() == vo.GetContextRange().GetTimeStart().GetSec() == vt.GetContextRange().GetTimeStart().GetSec()
00136          
00137          #ttest = TimeStamp(2011,9,10,0,0,0); #<--query cmap with a crazy date to make sure rollback is working
00138          #ttest = TimeStamp(vo.versiondate)
00139          #ttest.Add(3600*24*30) #<--add three days
00140          #with Rollback(CalibPmtHighGainFake=vs.insertdate, CalibPmtFineGain=vt.insertdate, CableMap=ttest):
00141          with Rollback(CalibPmtHighGainFake=vs.insertdate, CalibPmtFineGain=vt.insertdate, CableMap=vo.versiondate):
00142              self.purge()             
00143              self.check_channels(vo)

def DybDbi::test_svc_level_RG::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::HighGainFakeCalibData
     'm_pmtId', 'm_sigmaSpeHigh', 'm_speHigh', 'm_speHighError', 'm_speHighFitQual', 'm_status'

Definition at line 144 of file test_svc_level_RG.py.

00145                                   :
00146         """
00147         :param vrec:
00148 
00149         Using the service mode corresponding to the timestart of the validity record passed
00150         loop over channels comparing results between services
00151 
00152         DayaBay::FineGainCalibData
00153                   'm_channelId', 'm_sigmaSpeHigh', 'm_speHigh', 'm_speHighError', 'm_speHighFitQual', 'm_status'
00154 
00155         DayaBay::HighGainFakeCalibData
00156                      'm_pmtId', 'm_sigmaSpeHigh', 'm_speHigh', 'm_speHighError', 'm_speHighFitQual', 'm_status'
00157 
00158         """
00159         seqno = vrec.seqno
00160         if seqno not in self:
00161             self[seqno] = dict(stat={'channels':0,'nodata':0,},mismatch=[])
00162 
00163         svm = self.svcMode( vrec , offset=self.offset )
00164         #new: have to read src and target tables with task=1 (this may be redundant if the line above already copies the task properly)
00165         svm1 = ServiceMode( svm.context(), 1 );
00166         svc = self.svcMode( vrec , offset=self.cable_offset )
00167         #Note: CableMap needs to be queried with vrec's version date
00168         svc.context().SetTimeStamp(vrec.versiondate)
00169         ch = Channels(vrec,svc)
00170 
00171         #qwns = ( 'm_sigmaSpeHigh', 'm_speHigh', 'm_speHighError', 'm_speHighFitQual', 'm_status' )
00172 
00173         qwns = ( 'm_sigmaSpeHigh', 'm_speHigh', 'm_speHighError', 'm_status' ) #removed m_speHighFitQual temporarily because in services for fake table it is the seqno that is being returned right now
00174 
00175         print "Will look in svcMode ",svm.context().AsString()
00176 
00177         for board,connector,channelId,pmtId in ch():
00178             fineCalibData = calibSvc.fineGainCalibData(channelId,svm1)          
00179             pmtCalibData = calibSvc.fakeGainCalibData(pmtId,svm1)
00180    
00181             self[seqno]['stat']['channels'] += 1
00182             self.totals['channels'] += 1
00183 
00184             xist = filter(None, (fineCalibData,pmtCalibData))
00185             lxist = len(xist)
00186             assert lxist in (0,2),  ("expect both to exist or not %s ", xist )
00187 
00188             if lxist == 0:
00189                 self[seqno]['stat']['nodata'] += 1
00190                 self.totals['nodata'] += 1
00191                 continue
00192    
00193             assert fineCalibData.m_channelId == channelId
00194             assert pmtCalibData.m_pmtId == pmtId
00195 
00196             msg = "board %-2s connector %-2s channelId %s  pmtId %s " % ( board,connector,hex(channelId.fullPackedData()),hex(pmtId.fullPackedData()))
00197 
00198             mism = compare( pmtCalibData , fineCalibData, qwns )
00199             if len(mism)>0:
00200                 log.warn("%s\n%s" % (msg, "\n".join(map(repr,mism))) )
00201                 self[seqno]['mismatch'].append(msg)
00202                 self.totals['mismatch'] += 1
00203                 print "Had some problems!"
00204             else:
00205                 log.debug(msg)

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

Definition at line 206 of file test_svc_level_RG.py.

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


Member Data Documentation

Definition at line 64 of file test_svc_level_RG.py.

Definition at line 64 of file test_svc_level_RG.py.

Definition at line 64 of file test_svc_level_RG.py.

Definition at line 64 of file test_svc_level_RG.py.

Definition at line 64 of file test_svc_level_RG.py.

Definition at line 64 of file test_svc_level_RG.py.

Definition at line 64 of file test_svc_level_RG.py.

Definition at line 64 of file test_svc_level_RG.py.

Definition at line 64 of file test_svc_level_RG.py.

Definition at line 64 of file test_svc_level_RG.py.

Definition at line 64 of file test_svc_level_RG.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:25 for DybDbi by doxygen 1.7.4