nodes: 0, module; 1, function_definition; 2, function_name:_sort_dd_skips; 3, parameters; 4, block; 5, identifier:configs; 6, identifier:dd_indices_all; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, comment:# determine skips; 11, expression_statement; 12, expression_statement; 13, comment:# now determine the configurations; 14, expression_statement; 15, for_statement; 16, return_statement; 17, comment:"""Given a set of dipole-dipole configurations, sort them according to
      their current skip.
  
      Parameters
      ----------
      configs: Nx4 numpy.ndarray
          Dipole-Dipole configurations
  
      Returns
      -------
      dd_configs_sorted: dict
          dictionary with the skip as keys, and arrays/lists with indices to
          these skips.
      """; 18, assignment; 19, call; 20, block; 21, assignment; 22, assignment; 23, assignment; 24, identifier:skip; 25, identifier:available_skips; 26, block; 27, identifier:dd_configs_sorted; 28, identifier:config_current_skips; 29, call; 30, attribute; 31, argument_list; 32, return_statement; 33, identifier:available_skips_raw; 34, call; 35, identifier:available_skips; 36, call; 37, identifier:dd_configs_sorted; 38, dictionary; 39, expression_statement; 40, expression_statement; 41, attribute; 42, argument_list; 43, identifier:np; 44, identifier:all; 45, call; 46, dictionary; 47, attribute; 48, argument_list; 49, attribute; 50, argument_list; 51, assignment; 52, assignment; 53, identifier:np; 54, identifier:abs; 55, binary_operator:configs[:, 1] - configs[:, 0]; 56, attribute; 57, argument_list; 58, pair; 59, identifier:np; 60, identifier:unique; 61, identifier:config_current_skips; 62, subscript; 63, identifier:astype; 64, identifier:int; 65, identifier:indices; 66, subscript; 67, subscript; 68, subscript; 69, subscript; 70, subscript; 71, identifier:np; 72, identifier:isnan; 73, identifier:config_current_skips; 74, integer:0; 75, list; 76, identifier:available_skips_raw; 77, unary_operator; 78, call; 79, integer:0; 80, identifier:dd_configs_sorted; 81, binary_operator:skip - 1; 82, identifier:dd_indices_all; 83, identifier:indices; 84, identifier:configs; 85, slice; 86, integer:1; 87, identifier:configs; 88, slice; 89, integer:0; 90, call; 91, attribute; 92, argument_list; 93, identifier:skip; 94, integer:1; 95, attribute; 96, argument_list; 97, identifier:np; 98, identifier:where; 99, comparison_operator:config_current_skips == skip; 100, identifier:np; 101, identifier:isnan; 102, identifier:available_skips_raw; 103, identifier:config_current_skips; 104, identifier:skip
code: def _sort_dd_skips(configs, dd_indices_all):
      """Given a set of dipole-dipole configurations, sort them according to
      their current skip.
  
      Parameters
      ----------
      configs: Nx4 numpy.ndarray
          Dipole-Dipole configurations
  
      Returns
      -------
      dd_configs_sorted: dict
          dictionary with the skip as keys, and arrays/lists with indices to
          these skips.
      """
      config_current_skips = np.abs(configs[:, 1] - configs[:, 0])
      if np.all(np.isnan(config_current_skips)):
          return {0: []}
  
      # determine skips
      available_skips_raw = np.unique(config_current_skips)
      available_skips = available_skips_raw[
          ~np.isnan(available_skips_raw)
      ].astype(int)
  
      # now determine the configurations
      dd_configs_sorted = {}
      for skip in available_skips:
          indices = np.where(config_current_skips == skip)[0]
          dd_configs_sorted[skip - 1] = dd_indices_all[indices]
  
      return dd_configs_sorted