code: def get_original_order_unique_ids(id_array):
      
      assert isinstance(id_array, np.ndarray)
      assert len(id_array.shape) == 1
  
      # Get the indices of the unique IDs in their order of appearance
      # Note the [1] is because the np.unique() call will return both the sorted
      # unique IDs and the indices
      original_unique_id_indices =\
          np.sort(np.unique(id_array, return_index=True)[1])
  
      # Get the unique ids, in their original order of appearance
      original_order_unique_ids = id_array[original_unique_id_indices]
  
      return original_order_unique_ids
docs: Get the unique id's of id_array, in their original order of appearance.
  
      Parameters
      ----------
      id_array : 1D ndarray.
          Should contain the ids that we want to extract the unique values from.
  
      Returns
      -------
      original_order_unique_ids : 1D ndarray.
          Contains the unique ids from `id_array`, in their original order of
          appearance.