def numberOfDistalSegments(self, cells=None):
    """
    Returns the total number of distal segments for these cells.

    A segment "exists" if its row in the matrix has any permanence values > 0.

    Parameters:
    ----------------------------
    @param  cells (iterable)
            Indices of the cells
    """
    if cells is None:
      cells = xrange(self.numberOfCells())

    n = 0

    for cell in cells:
      if self.internalDistalPermanences.nNonZerosOnRow(cell) > 0:
        n += 1

      for permanences in self.distalPermanences:
        if permanences.nNonZerosOnRow(cell) > 0:
          n += 1

    return n
def numberOfDistalSegments ( self , cells = None ) : if cells is None : cells = xrange ( self . numberOfCells ( ) ) n = 0 for cell in cells : if self . internalDistalPermanences . nNonZerosOnRow ( cell ) > 0 : n += 1 for permanences in self . distalPermanences : if permanences . nNonZerosOnRow ( cell ) > 0 : n += 1 return n
Returns the total number of distal segments for these cells.

    A segment "exists" if its row in the matrix has any permanence values > 0.

    Parameters:
    ----------------------------
    @param  cells (iterable)
            Indices of the cells