nodes: 0, module; 1, function_definition; 2, function_name:sort_catalogue_chronologically; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, string; 12, assignment; 13, assignment; 14, call; 15, comment:# Catalogue was already in chronological order; 16, block; 17, call; 18, string_content:Sorts the catalogue into chronological order; 19, identifier:dec_time; 20, call; 21, identifier:idx; 22, call; 23, attribute; 24, argument_list; 25, return_statement; 26, attribute; 27, argument_list; 28, attribute; 29, argument_list; 30, attribute; 31, argument_list; 32, identifier:np; 33, identifier:all; 34, comparison_operator:(idx[1:] - idx[:-1]) > 0.; 35, identifier:self; 36, identifier:select_catalogue_events; 37, identifier:idx; 38, identifier:self; 39, identifier:get_decimal_time; 40, identifier:np; 41, identifier:argsort; 42, identifier:dec_time; 43, parenthesized_expression; 44, float:0.; 45, binary_operator:idx[1:] - idx[:-1]; 46, subscript; 47, subscript; 48, identifier:idx; 49, slice; 50, identifier:idx; 51, slice; 52, integer:1; 53, unary_operator; 54, integer:1
code: def sort_catalogue_chronologically(self):
          '''
          Sorts the catalogue into chronological order
          '''
          dec_time = self.get_decimal_time()
          idx = np.argsort(dec_time)
          if np.all((idx[1:] - idx[:-1]) > 0.):
              # Catalogue was already in chronological order
              return
          self.select_catalogue_events(idx)