code: def depolarizeCells(self, basalInput, apicalInput, learn):
      
      # Calculate predictions for this timestep
      (activeApicalSegments,
       matchingApicalSegments,
       apicalPotentialOverlaps) = self._calculateSegmentActivity(
         self.apicalConnections, apicalInput, self.connectedPermanence,
         self.activationThreshold, self.minThreshold, self.reducedBasalThreshold)
  
      apicallySupportedCells = self.apicalConnections.mapSegmentsToCells(
        activeApicalSegments)
      if not self.disableApicalDependence:
        (activeBasalSegments,
         matchingBasalSegments,
         basalPotentialOverlaps) = self._calculateSegmentActivity(
           self.basalConnections, basalInput,
           self.connectedPermanence, self.activationThreshold,
           self.minThreshold, self.reducedBasalThreshold,
           reducedThresholdCells = apicallySupportedCells,)
  
        predictedCells = np.intersect1d(
          self.basalConnections.mapSegmentsToCells(activeBasalSegments),
          apicallySupportedCells)
      else:
        (activeBasalSegments,
        matchingBasalSegments,
        basalPotentialOverlaps) = self._calculateSegmentActivity(
          self.basalConnections, basalInput, self.connectedPermanence,
          self.activationThreshold, self.minThreshold, self.reducedBasalThreshold)
  
        predictedCells = self.basalConnections.mapSegmentsToCells(activeBasalSegments)
  
      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.