def _filter_dipole_dipole(configs):
    """Filter dipole-dipole configurations

    A dipole-dipole configuration is defined using the following criteria:

        * equal distance between the two current electrodes and between the two
          voltage electrodes
        * no overlap of dipoles

    Parameters
    ----------
    configs: numpy.ndarray
        Nx4 array with N measurement configurations

    Returns
    -------
    configs: numpy.ndarray
        Remaining configurations, all dipole-dipole configurations are set to
        numpy.nan
    dd_indices: numpy.ndarray
        indices of dipole-dipole configurations

    """
    # check that dipoles have equal size
    dist_ab = np.abs(configs[:, 0] - configs[:, 1])
    dist_mn = np.abs(configs[:, 2] - configs[:, 3])

    distances_equal = (dist_ab == dist_mn)

    # check that they are not overlapping
    not_overlapping = (
        # either a,b < m,n
        (
            (configs[:, 0] < configs[:, 2]) &
            (configs[:, 1] < configs[:, 2]) &
            (configs[:, 0] < configs[:, 3]) &
            (configs[:, 1] < configs[:, 3])
        ) |
        # or m,n < a,b
        (
            (configs[:, 2] < configs[:, 0]) &
            (configs[:, 3] < configs[:, 0]) &
            (configs[:, 2] < configs[:, 1]) &
            (configs[:, 3] < configs[:, 1])
        )
    )

    is_dipole_dipole = (distances_equal & not_overlapping)

    dd_indices = np.where(is_dipole_dipole)[0]
    dd_indices_sorted = _sort_dd_skips(configs[dd_indices, :], dd_indices)

    # set all dd configs to nan
    configs[dd_indices, :] = np.nan

    return configs, dd_indices_sorted
def _filter_dipole_dipole ( configs ) : dist_ab = np . abs ( configs [ : , 0 ] - configs [ : , 1 ] ) dist_mn = np . abs ( configs [ : , 2 ] - configs [ : , 3 ] ) distances_equal = ( dist_ab == dist_mn ) not_overlapping = ( ( ( configs [ : , 0 ] < configs [ : , 2 ] ) & ( configs [ : , 1 ] < configs [ : , 2 ] ) & ( configs [ : , 0 ] < configs [ : , 3 ] ) & ( configs [ : , 1 ] < configs [ : , 3 ] ) ) | ( ( configs [ : , 2 ] < configs [ : , 0 ] ) & ( configs [ : , 3 ] < configs [ : , 0 ] ) & ( configs [ : , 2 ] < configs [ : , 1 ] ) & ( configs [ : , 3 ] < configs [ : , 1 ] ) ) ) is_dipole_dipole = ( distances_equal & not_overlapping ) dd_indices = np . where ( is_dipole_dipole ) [ 0 ] dd_indices_sorted = _sort_dd_skips ( configs [ dd_indices , : ] , dd_indices ) configs [ dd_indices , : ] = np . nan return configs , dd_indices_sorted
Filter dipole-dipole configurations

    A dipole-dipole configuration is defined using the following criteria:

        * equal distance between the two current electrodes and between the two
          voltage electrodes
        * no overlap of dipoles

    Parameters
    ----------
    configs: numpy.ndarray
        Nx4 array with N measurement configurations

    Returns
    -------
    configs: numpy.ndarray
        Remaining configurations, all dipole-dipole configurations are set to
        numpy.nan
    dd_indices: numpy.ndarray
        indices of dipole-dipole configurations