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):