code: def _calculateBasalSegmentActivity(connections, activeInput,
                                  reducedBasalThresholdCells, connectedPermanence,
                                  activationThreshold, minThreshold, reducedBasalThreshold):
      
      # Active apical segments lower the activation threshold for basal (lateral) segments
      overlaps = connections.computeActivity(activeInput, connectedPermanence)
      outrightActiveSegments = np.flatnonzero(overlaps >= activationThreshold)
      if reducedBasalThreshold != activationThreshold and len(reducedBasalThresholdCells) > 0:
          potentiallyActiveSegments = np.flatnonzero((overlaps < activationThreshold)
                                          & (overlaps >= reducedBasalThreshold))
          cellsOfCASegments = connections.mapSegmentsToCells(potentiallyActiveSegments)
          # apically active segments are condit. active segments from apically active cells
          conditionallyActiveSegments = potentiallyActiveSegments[np.in1d(cellsOfCASegments,
                                                  reducedBasalThresholdCells)]
          activeSegments = np.concatenate((outrightActiveSegments, conditionallyActiveSegments))
      else:
          activeSegments = outrightActiveSegments
  
  
  
      # Matching
      potentialOverlaps = connections.computeActivity(activeInput)
      matchingSegments = np.flatnonzero(potentialOverlaps >= minThreshold)
  
      return (activeSegments,
              matchingSegments,
              potentialOverlaps)
docs: Calculate the active and matching basal segments for this timestep.
  
      The difference with _calculateApicalSegmentActivity is that cells
      with active apical segments (collected in reducedBasalThresholdCells) have
      a lower activation threshold for their basal segments (set by
      reducedBasalThreshold parameter).
  
      @param connections (SparseMatrixConnections)
      @param activeInput (numpy array)
  
      @return (tuple)
      - activeSegments (numpy array)
        Dendrite segments with enough active connected synapses to cause a
        dendritic spike
  
      - matchingSegments (numpy array)
        Dendrite segments with enough active potential synapses to be selected for
        learning in a bursting column
  
      - potentialOverlaps (numpy array)
        The number of active potential synapses for each segment.
        Includes counts for active, matching, and nonmatching segments.