nodes: 0, module; 1, function_definition; 2, function_name:_getMostActiveCells; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, comment:# include a tie-breaker before sorting; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, return_statement; 15, comment:"""
      Gets the most active cells in the Union SDR having at least non-zero
      activation in sorted order.
      @return: a list of cell indices
      """; 16, assignment; 17, assignment; 18, assignment; 19, assignment; 20, assignment; 21, comparison_operator:max(self._poolingTimer) > self._minHistory; 22, block; 23, else_clause; 24, attribute; 25, identifier:poolingActivation; 26, attribute; 27, identifier:nonZeroCells; 28, subscript; 29, identifier:poolingActivationSubset; 30, binary_operator:poolingActivation[nonZeroCells] + \
                                self._poolingActivation_tieBreaker[nonZeroCells]; 31, identifier:potentialUnionSDR; 32, subscript; 33, identifier:topCells; 34, subscript; 35, call; 36, attribute; 37, expression_statement; 38, block; 39, identifier:self; 40, identifier:_unionSDR; 41, identifier:self; 42, identifier:_poolingActivation; 43, call; 44, slice; 45, integer:0; 46, subscript; 47, line_continuation:\; 48, subscript; 49, identifier:nonZeroCells; 50, subscript; 51, identifier:potentialUnionSDR; 52, slice; 53, identifier:max; 54, argument_list; 55, identifier:self; 56, identifier:_minHistory; 57, assignment; 58, expression_statement; 59, attribute; 60, argument_list; 61, identifier:poolingActivation; 62, identifier:nonZeroCells; 63, attribute; 64, identifier:nonZeroCells; 65, call; 66, slice; 67, integer:0; 68, attribute; 69, attribute; 70, attribute; 71, call; 72, assignment; 73, identifier:numpy; 74, identifier:argwhere; 75, comparison_operator:poolingActivation > 0; 76, identifier:self; 77, identifier:_poolingActivation_tieBreaker; 78, attribute; 79, argument_list; 80, unary_operator; 81, identifier:self; 82, identifier:_maxUnionCells; 83, identifier:self; 84, identifier:_poolingTimer; 85, identifier:self; 86, identifier:_unionSDR; 87, attribute; 88, argument_list; 89, attribute; 90, list; 91, identifier:poolingActivation; 92, integer:0; 93, identifier:numpy; 94, identifier:argsort; 95, identifier:poolingActivationSubset; 96, integer:1; 97, call; 98, identifier:astype; 99, identifier:UINT_DTYPE; 100, identifier:self; 101, identifier:_unionSDR; 102, attribute; 103, argument_list; 104, identifier:numpy; 105, identifier:sort; 106, identifier:topCells
code: def _getMostActiveCells(self):
      """
      Gets the most active cells in the Union SDR having at least non-zero
      activation in sorted order.
      @return: a list of cell indices
      """
      poolingActivation = self._poolingActivation
      nonZeroCells = numpy.argwhere(poolingActivation > 0)[:,0]
  
      # include a tie-breaker before sorting
      poolingActivationSubset = poolingActivation[nonZeroCells] + \
                                self._poolingActivation_tieBreaker[nonZeroCells]
      potentialUnionSDR = nonZeroCells[numpy.argsort(poolingActivationSubset)[::-1]]
  
      topCells = potentialUnionSDR[0: self._maxUnionCells]
  
      if max(self._poolingTimer) > self._minHistory:
        self._unionSDR = numpy.sort(topCells).astype(UINT_DTYPE)
      else:
        self._unionSDR = []
  
      return self._unionSDR