From d2060edb980cf1c57e1b2db2431dfcc757117e85 Mon Sep 17 00:00:00 2001 From: Sooyoung Cheong <64125280+c-sooyoung@users.noreply.github.com> Date: Sun, 19 Jul 2026 18:17:34 +0900 Subject: [PATCH] fixes for fold_slice --- ptycho/fold_slice.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ptycho/fold_slice.py b/ptycho/fold_slice.py index d79a51f..d0242f6 100644 --- a/ptycho/fold_slice.py +++ b/ptycho/fold_slice.py @@ -34,7 +34,7 @@ class FoldSlicePtychoEngine(PtychoEngine): f.write(f"{key} {value}\n") - def run(self) -> None: + def run(self, header="") -> None: self.fold_slice_prepare() config = self.config @@ -57,7 +57,7 @@ class FoldSlicePtychoEngine(PtychoEngine): ) if not verbosity == 0: - header = '[fold slice]' + header = header + '[fold slice]' for line in p.stdout: # type: ignore sys.stdout.write(f'{header} {line}') p.stdout.close() # type: ignore @@ -107,5 +107,7 @@ class FoldSlicePtychoEngine(PtychoEngine): def metric(self) -> float: if self._metric is None: output = self.output() - self._metric = float(np.asarray(output['outputs']['fourier_error_out'][0]).squeeze()) # type: ignore + fourier_error = output['outputs']['fourier_error_out'][0][0].squeeze() + metric = float(fourier_error[-1]) + self._metric = metric return self._metric