treetime/treeanc.py
def _fitch_intersect(self, arrays):
        """
        Find the intersection of any number of 1D arrays.
        Return the sorted, unique values that are in all of the input arrays.
        Adapted from numpy.lib.arraysetops.intersect1d
        """
        def pairwise_intersect(arr1, arr2):
            s2 = set(arr2)
            b3 = [val for val in arr1 if val in s2]
            return b3

        arrays = list(arrays) # allow assignment
        N = len(arrays)
        while N > 1:
            arr1 = arrays.pop()
            arr2 = arrays.pop()
            arr = pairwise_intersect(arr1, arr2)
            arrays.append(arr)
            N = len(arrays)

        return arrays[0]
def _fitch_intersect(self, arrays):
        def pairwise_intersect(arr1, arr2):
            s2 = set(arr2)
            b3 = [val for val in arr1 if val in s2]
            return b3

        arrays = list(arrays) # allow assignment
        N = len(arrays)
        while N > 1:
            arr1 = arrays.pop()
            arr2 = arrays.pop()
            arr = pairwise_intersect(arr1, arr2)
            arrays.append(arr)
            N = len(arrays)

        return arrays[0]
def _fitch_intersect ( self , arrays ) : def pairwise_intersect ( arr1 , arr2 ) : s2 = set ( arr2 ) b3 = [ val for val in arr1 if val in s2 ] return b3 arrays = list ( arrays ) # allow assignment N = len ( arrays ) while N > 1 : arr1 = arrays . pop ( ) arr2 = arrays . pop ( ) arr = pairwise_intersect ( arr1 , arr2 ) arrays . append ( arr ) N = len ( arrays ) return arrays [ 0 ]
Find the intersection of any number of 1D arrays.
        Return the sorted, unique values that are in all of the input arrays.
        Adapted from numpy.lib.arraysetops.intersect1d
Find the intersection of any number of 1D arrays . Return the sorted unique values that are in all of the input arrays . Adapted from numpy . lib . arraysetops . intersect1d