code: def gen_configs_permutate(self,
                                injections_raw,
                                only_same_dipole_length=False,
                                ignore_crossed_dipoles=False,
                                silent=False):
          injections = np.atleast_2d(injections_raw).astype(int)
          N = injections.shape[0]
          measurements = []
          for injection in range(0, N):
              dipole_length = np.abs(injections[injection][1] -
                                     injections[injection][0])
              for i in set(range(0, N)) - set([injection]):
                  test_dipole_length = np.abs(injections[i, :][1] -
                                              injections[i, :][0])
                  if (only_same_dipole_length
                          and test_dipole_length != dipole_length):
                      continue
                  quadpole = np.array(
                      [injections[injection, :], injections[i, :]]).flatten()
                  if ignore_crossed_dipoles is True:
                      if (quadpole[2] > quadpole[0]
                              and quadpole[2] < quadpole[1]):
                          if not silent:
                              print('A - ignoring', quadpole)
                      elif (quadpole[3] > quadpole[0]
                            and quadpole[3] < quadpole[1]):
                          if not silent:
                              print('B - ignoring', quadpole)
                      else:
                          measurements.append(quadpole)
                  else:
                      measurements.append(quadpole)
          filtered = []
          for quadpole in measurements:
              if (not set(quadpole[0:2]).isdisjoint(set(quadpole[2:4]))):
                  if not silent:
                      print('Ignoring quadrupole because of ',
                            'repeated electrode use:', quadpole)
              else:
                  filtered.append(quadpole)
          self.add_to_configs(filtered)
          return np.array(filtered)