code: def depolarizeCells(self, basalInput, apicalInput, learn):
      
      (activeApicalSegments,
       matchingApicalSegments,
       apicalPotentialOverlaps) = self._calculateApicalSegmentActivity(
         self.apicalConnections, apicalInput, self.connectedPermanence,
         self.activationThreshold, self.minThreshold)
  
      if learn or self.useApicalModulationBasalThreshold==False:
        reducedBasalThresholdCells = ()
      else:
        reducedBasalThresholdCells = self.apicalConnections.mapSegmentsToCells(
          activeApicalSegments)
  
      (activeBasalSegments,
       matchingBasalSegments,
       basalPotentialOverlaps) = self._calculateBasalSegmentActivity(
         self.basalConnections, basalInput, reducedBasalThresholdCells,
         self.connectedPermanence,
         self.activationThreshold, self.minThreshold, self.reducedBasalThreshold)
  
      predictedCells = self._calculatePredictedCells(activeBasalSegments,
                                                     activeApicalSegments)
  
      self.predictedCells = predictedCells
      self.activeBasalSegments = activeBasalSegments
      self.activeApicalSegments = activeApicalSegments
      self.matchingBasalSegments = matchingBasalSegments
      self.matchingApicalSegments = matchingApicalSegments
      self.basalPotentialOverlaps = basalPotentialOverlaps
      self.apicalPotentialOverlaps = apicalPotentialOverlaps
docs: Calculate predictions.
  
      @param basalInput (numpy array)
      List of active input bits for the basal dendrite segments
  
      @param apicalInput (numpy array)
      List of active input bits for the apical dendrite segments
  
      @param learn (bool)
      Whether learning is enabled. Some TM implementations may depolarize cells
      differently or do segment activity bookkeeping when learning is enabled.