Skip to content

Commit b70600c

Browse files
committed
fix: ensure output directory exists and update log messages for clarity
1 parent 5049653 commit b70600c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/astra/autofocus.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,7 @@ def run_timestamp(self) -> str:
966966
return self._run_timestamp
967967

968968
def _output_path(self, save_dir: Path, suffix: str, ext: str) -> Path:
969+
save_dir.mkdir(parents=True, exist_ok=True)
969970
return save_dir / f"autofocus_{self.run_timestamp}_{suffix}.{ext}"
970971

971972
def make_summary_plot(self) -> None:
@@ -1082,7 +1083,8 @@ def create_result_file(self) -> None:
10821083

10831084
if last_image_path is None:
10841085
self.observatory.logger.error(
1085-
"Skipping creation of log file: no save_path configured and no last image available."
1086+
"Skipping creation of result file: "
1087+
"no save_path configured and no last image available."
10861088
)
10871089
return
10881090

@@ -1098,7 +1100,7 @@ def create_result_file(self) -> None:
10981100
)
10991101
result_file.write(f"Autofocuser: {self.autofocuser}\n")
11001102
except Exception as e:
1101-
self.observatory.logger.exception(f"Error creating log file: {str(e)}")
1103+
self.observatory.logger.exception(f"Error creating result file: {str(e)}")
11021104

11031105
def _initialise_logging(self) -> None:
11041106
"""Set up logging integration with astrafocus library.

0 commit comments

Comments
 (0)