def _getBestMatchingCell(self, c, activeState, minThreshold):
<EOL>bestActivityInCol = minThreshold<EOL>bestSegIdxInCol = -<NUM_LIT:1><EOL>bestCellInCol = -<NUM_LIT:1><EOL>for i in range(self.cellsPerColumn):<EOL><INDENT>maxSegActivity = <NUM_LIT:0><EOL>maxSegIdx = <NUM_LIT:0><EOL>for j, s in enumerate(self.cells[c][i]):<EOL><INDENT>activity = self._getSegmentActivityLevel(s, activeState)<EOL>if activity > maxSegActivity:<EOL><INDENT>maxSegActivity = activity<EOL>maxSegIdx = j<EOL><DEDENT><DEDENT>if maxSegActivity >= bestActivityInCol:<EOL><INDENT>bestActivityInCol = maxSegActivity<EOL>bestSegIdxInCol = maxSegIdx<EOL>bestCellInCol = i<EOL><DEDENT><DEDENT>if bestCellInCol == -<NUM_LIT:1>:<EOL><INDENT>return (None, None, None)<EOL><DEDENT>else:<EOL><INDENT>return (bestCellInCol, self.cells[c][bestCellInCol][bestSegIdxInCol],<EOL>bestActivityInCol)<EOL><DEDENT>
Find weakly activated cell in column with at least minThreshold active
synapses.

:param c            which column to look at
:param activeState  the active cells
:param minThreshold minimum number of synapses required

:returns: tuple (cellIdx, segment, numActiveSynapses)