nodes: 0, module; 1, function_definition; 2, function_name:gen_reciprocals; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, comment:# Switch AB and MN; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, comment:# # Sort by current dipoles; 13, expression_statement; 14, expression_statement; 15, if_statement; 16, return_statement; 17, identifier:append; 18, False; 19, comment:""" Generate reciprocal configurations, sort by AB, and optionally
          append to configurations.
  
          Parameters
          ----------
          append : bool
              Append reciprocals to configs (the default is False).
  
          Examples
          --------
          >>> cfgs = ConfigManager(nr_of_electrodes=5)
          >>> nor = cfgs.gen_dipole_dipole(skipc=0)
          >>> rec = cfgs.gen_reciprocals(append=True)
          >>> print(cfgs.configs)
          [[1 2 3 4]
           [1 2 4 5]
           [2 3 4 5]
           [3 4 1 2]
           [4 5 1 2]
           [4 5 2 3]]
          """; 20, assignment; 21, assignment; 22, assignment; 23, assignment; 24, assignment; 25, identifier:append; 26, block; 27, identifier:reciprocals; 28, identifier:reciprocals; 29, subscript; 30, subscript; 31, call; 32, subscript; 33, call; 34, identifier:ind; 35, call; 36, identifier:reciprocals; 37, subscript; 38, expression_statement; 39, call; 40, slice; 41, slice; 42, identifier:reciprocals; 43, slice; 44, slice; 45, attribute; 46, argument_list; 47, identifier:reciprocals; 48, slice; 49, slice; 50, attribute; 51, argument_list; 52, attribute; 53, argument_list; 54, identifier:reciprocals; 55, identifier:ind; 56, assignment; 57, attribute; 58, argument_list; 59, unary_operator; 60, integer:0; 61, integer:2; 62, identifier:np; 63, identifier:sort; 64, subscript; 65, keyword_argument; 66, integer:2; 67, integer:4; 68, identifier:np; 69, identifier:sort; 70, subscript; 71, keyword_argument; 72, identifier:np; 73, identifier:lexsort; 74, tuple; 75, attribute; 76, call; 77, attribute; 78, identifier:copy; 79, integer:1; 80, identifier:reciprocals; 81, slice; 82, slice; 83, identifier:axis; 84, integer:1; 85, identifier:reciprocals; 86, slice; 87, slice; 88, identifier:axis; 89, integer:1; 90, subscript; 91, subscript; 92, subscript; 93, subscript; 94, identifier:self; 95, identifier:configs; 96, attribute; 97, argument_list; 98, identifier:self; 99, identifier:configs; 100, integer:0; 101, integer:2; 102, integer:2; 103, integer:4; 104, identifier:reciprocals; 105, slice; 106, integer:3; 107, identifier:reciprocals; 108, slice; 109, integer:2; 110, identifier:reciprocals; 111, slice; 112, integer:1; 113, identifier:reciprocals; 114, slice; 115, integer:0; 116, identifier:np; 117, identifier:vstack; 118, tuple; 119, attribute; 120, identifier:reciprocals; 121, identifier:self; 122, identifier:configs
code: def gen_reciprocals(self, append=False):
          """ Generate reciprocal configurations, sort by AB, and optionally
          append to configurations.
  
          Parameters
          ----------
          append : bool
              Append reciprocals to configs (the default is False).
  
          Examples
          --------
          >>> cfgs = ConfigManager(nr_of_electrodes=5)
          >>> nor = cfgs.gen_dipole_dipole(skipc=0)
          >>> rec = cfgs.gen_reciprocals(append=True)
          >>> print(cfgs.configs)
          [[1 2 3 4]
           [1 2 4 5]
           [2 3 4 5]
           [3 4 1 2]
           [4 5 1 2]
           [4 5 2 3]]
          """
          # Switch AB and MN
          reciprocals = self.configs.copy()[:, ::-1]
          reciprocals[:, 0:2] = np.sort(reciprocals[:, 0:2], axis=1)
          reciprocals[:, 2:4] = np.sort(reciprocals[:, 2:4], axis=1)
          # # Sort by current dipoles
          ind = np.lexsort((reciprocals[:, 3], reciprocals[:, 2],
                            reciprocals[:, 1], reciprocals[:, 0]))
          reciprocals = reciprocals[ind]
  
          if append:
              self.configs = np.vstack((self.configs, reciprocals))
          return reciprocals