The extraction of data from the pycbc.CBCData
instance happens here in the constructor.
For each effort in the selected circles, find all the related census records. For each census record, place its data in the cell in the appropriate row and column (or combine it with any data that may already be there), creating new rows as necessary.
# - - - C b c H i s t . _ _ i n i t _ _
def __init__(self, db, effKeyList, txny, layoutFactory,
cenFilter=None):
'''Constructor.
'''
#-- 1
self.db = db
self.effKeyList = effKeyList
self.txny = txny
self.cenFilter = cenFilter
The layoutFactory is a class, not an
instance, and it requires a list of effort keys. Also,
we put a hard limit (see Section 13.7.2, “COLUMN_COUNT_LIMIT”) on the total number of
logical columns; much beyond that and there's not much
room for data.
#-- 2
# [ self._columnLayout := result of calling layoutFactory
# with effKeyList
# self.nCols := length of that result ]
self._columnLayout = layoutFactory(effKeyList)
self.nCols = len(self._columnLayout)
if self.nCols > COLUMN_COUNT_LIMIT:
raise ScriptError("Too many columns (%d): maximum is "
"%d." % (self.nCols, COLUMN_COUNT_LIMIT))
For the .keyRow and .partyHoursRow attributes, see Section 30, “class KeyRow: The first heading line” and Section 32, “class PartyHoursRow: Heading row showing
total effort”.
#-- 3
# [ self.keyRow := as invariant ]
self.keyRow = KeyRow(self)
#-- 4
# [ self.partyHoursRow := as invariant ]
self.partyHoursRow = PartyHoursRow(self)
See Section 28.8, “CbcHist._buildCensusRows(): Build the
census rows” for the
construction of the census logical rows.
#-- 5
# [ self._rowMap := as invariant using census data from
# db filtered by self.cenFilter ]
self._buildCensusRows()