Skip to content

Commit

Permalink
output file name bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Aske-Rosted committed Feb 17, 2024
1 parent 2adc935 commit 4e442f0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/graphnet/data/dataconverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,14 @@ def __call__(self, input_dir: Union[str, List[str]]) -> None:
# in the directory
input_files = self._file_reader.find_files(path=input_dir)
self._launch_jobs(input_files=input_files)
self._output_files = glob(
self._output_files = [
os.path.join(
self._output_dir, f"*{self._save_method.file_extension}"
self._output_dir,
self._create_file_name(file)
+ self._save_method.file_extension,
)
)
for file in input_files
]

@final
def _launch_jobs(
Expand Down Expand Up @@ -159,8 +162,9 @@ def _create_file_name(self, input_file_path: Union[str, I3FileSet]) -> str:
if isinstance(input_file_path, I3FileSet):
input_file_path = input_file_path.i3_file
file_name = os.path.basename(input_file_path)
index_of_dot = file_name.index(".")
file_name_without_extension = file_name[:index_of_dot]
for ext in self._file_reader._accepted_file_extensions:
if file_name.endswith(ext):
file_name_without_extension = file_name.replace(ext, "")
return file_name_without_extension

@final
Expand Down

0 comments on commit 4e442f0

Please sign in to comment.