/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
Scraper::dq::CQPacker::CQPacker Class Reference

List of all members.

Public Member Functions

def __init__
def pack
def unpack

Detailed Description

Definition at line 11 of file CQPacker.py.


Constructor & Destructor Documentation

def Scraper::dq::CQPacker::CQPacker::__init__ (   self)

Definition at line 12 of file CQPacker.py.

00013                       :
00014         pass


Member Function Documentation

def Scraper::dq::CQPacker::CQPacker::pack (   self,
  statusL 
)
    pack the 192 status into 7 int 
    statusL: list of status str for 192 PMTs order by channelid, e.g. ['1','1','0',...,'1'].
     when CQ service unpack the bits, should follow channelid order.

Definition at line 15 of file CQPacker.py.

00016                            :
00017         """ 
00018             pack the 192 status into 7 int 
00019             statusL: list of status str for 192 PMTs order by channelid, e.g. ['1','1','0',...,'1'].
00020                      when CQ service unpack the bits, should follow channelid order.
00021         """
00022         assert len(statusL)==192, 'packing: length of status str != 192'
00023         mask0 = int(''.join(statusL[0:31]), 2)
00024         mask1 = int(''.join(statusL[31:62]), 2)
00025         mask2 = int(''.join(statusL[62:93]), 2)
00026         mask3 = int(''.join(statusL[93:124]), 2)
00027         mask4 = int(''.join(statusL[124:155]), 2)
00028         mask5 = int(''.join(statusL[155:186]), 2)
00029         mask6 = int(''.join(statusL[186:192]), 2)
00030         return [mask0, mask1, mask2, mask3, mask4, mask5, mask6]

def Scraper::dq::CQPacker::CQPacker::unpack (   self,
  masks 
)
    upack status from masks, return a list of status str, i.e. ['1','1',...,'1']
    masks: list of mask, i.e. [mask0, mask1, ..., mask6]

Definition at line 31 of file CQPacker.py.

00032                            :
00033         """
00034             upack status from masks, return a list of status str, i.e. ['1','1',...,'1']
00035             masks: list of mask, i.e. [mask0, mask1, ..., mask6]
00036         """
00037         statusL = []
00038         for i in range(7):
00039             unmask = list(bin(masks[i])[2:]) # bin(mask) in form of '0b11'
00040             nbits = len(unmask)
00041             nbitsExp=6 if i==6 else 31
00042             unmask = ['0']*(nbitsExp-nbits) + unmask # in case the first several bit is 0
00043             statusL += unmask
00044         assert len(statusL)==192, 'unpacking: length of status str != 192'
00045         return statusL
00046 
00047 
        

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:50:03 for Scraper by doxygen 1.7.4