def computeActivity(self, activePresynapticCells, connectedPermanence):
numActiveConnectedSynapsesForSegment = [<NUM_LIT:0>] * self._nextFlatIdx<EOL>numActivePotentialSynapsesForSegment = [<NUM_LIT:0>] * self._nextFlatIdx<EOL>threshold = connectedPermanence - EPSILON<EOL>for cell in activePresynapticCells:<EOL><INDENT>for synapse in self._synapsesForPresynapticCell[cell]:<EOL><INDENT>flatIdx = synapse.segment.flatIdx<EOL>numActivePotentialSynapsesForSegment[flatIdx] += <NUM_LIT:1><EOL>if synapse.permanence > threshold:<EOL><INDENT>numActiveConnectedSynapsesForSegment[flatIdx] += <NUM_LIT:1><EOL><DEDENT><DEDENT><DEDENT>return (numActiveConnectedSynapsesForSegment,<EOL>numActivePotentialSynapsesForSegment)<EOL>
Compute each segment's number of active synapses for a given input.
In the returned lists, a segment's active synapse count is stored at index
``segment.flatIdx``.

:param activePresynapticCells: (iter) Active cells.
:param connectedPermanence: (float) Permanence threshold for a synapse to be 
       considered connected

:returns: (tuple) (``numActiveConnectedSynapsesForSegment`` [list],
                  ``numActivePotentialSynapsesForSegment`` [list])