Next / Previous / Contents / TCC Help System / NM Tech homepage

42.2. CensusCell.add(): Accumulate data from one census record

cbchistlib.py
# - - -   C e n s u s C e l l . a d d

    def add(self, c):
        '''Accumulate data from one Census.census field.
        '''
        #-- 1
        # [ census.census is an integer in string form ->
        #     nInd  :=  census.census as an int ]
        nInd = int(c.census)

        #-- 2
        if c.q == pycbc.Q_Q:
            if c.plus == pycbc.PLUS_CW:
                total = self._qPlus
            else:
                total = self._q
        else:
            if c.plus == pycbc.PLUS_CW:
                total = self._plus
            else:
                total = self._regular

        #-- 3
        # [ total  :=  total with nInd accumulated ]
        total.add(nInd)