From f35a04eeabbde215e687a18a37f8626bf6af5e96 Mon Sep 17 00:00:00 2001 From: RasmusOrsoe Date: Fri, 13 Sep 2024 15:53:42 +0200 Subject: [PATCH] remove changes to DataConverter --- src/graphnet/data/dataconverter.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/graphnet/data/dataconverter.py b/src/graphnet/data/dataconverter.py index 99b3dad51..6bc9e9572 100644 --- a/src/graphnet/data/dataconverter.py +++ b/src/graphnet/data/dataconverter.py @@ -1,4 +1,5 @@ """Contains `DataConverter`.""" + from typing import List, Union, OrderedDict, Dict, Tuple, Any, Optional, Type from abc import ABC @@ -260,8 +261,8 @@ def _request_event_nos(self, n_ids: int) -> List[int]: event_nos = np.arange(start_idx, start_idx + n_ids, 1).tolist() global_index.value += n_ids # type: ignore[name-defined] else: - starting_index = self._index - event_nos = np.arange(starting_index, starting_index + n_ids, 1).tolist() + start_idx = self._index + event_nos = np.arange(start_idx, start_idx + n_ids, 1).tolist() self._index += n_ids return event_nos @@ -316,7 +317,9 @@ def _update_shared_variables( self._output_files.extend(list(sorted(output_files[:]))) @final - def merge_files(self, files: Optional[List[str]] = None, **kwargs: Any) -> None: + def merge_files( + self, files: Optional[Union[List[str], str]] = None, **kwargs: Any + ) -> None: """Merge converted files. `DataConverter` will call the `.merge_files` method in the @@ -332,7 +335,9 @@ def merge_files(self, files: Optional[List[str]] = None, **kwargs: Any) -> None: elif files is not None: # Proceed to merge specified by user. if isinstance(files, str): - files = [files] # Cast to list if user forgot + # We shouldn't merge a single file? + self.info(f"Got just a single file {files}. Merging skipped.") + return files_to_merge = files else: # Raise error