From 6c912a5294988a5e2e0b7c791fde1d6b13d38bbb Mon Sep 17 00:00:00 2001 From: Noe Brucy Date: Fri, 27 May 2022 15:17:22 +0200 Subject: [PATCH] [snapshot] add verification before redoing pspsec --- snapshotprocessor.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/snapshotprocessor.py b/snapshotprocessor.py index 5ffb6fc..072a3ed 100644 --- a/snapshotprocessor.py +++ b/snapshotprocessor.py @@ -1371,9 +1371,10 @@ class SnapshotProcessor(HDF5Container): df = pd.read_csv(csv_name, header=None, names=header) return {key: df[key].values for key in df} - def _pspec(self, **kwargs): + def _pspec(self, overwrite_file=False, **kwargs): outfile = self.pspec_filename - pspec_new.pspec(repo=self.path, iouts=[self.num], outfile=outfile, **kwargs) + if overwrite_file or not os.path.exists(self.pspec_filename): + pspec_new.pspec(repo=self.path, iouts=[self.num], outfile=outfile, **kwargs) return np.array([self.pspec_filename]) def _write_particles(self):