From b1f191ac58789f443acd2d2e20d2bc095a7a0ca9 Mon Sep 17 00:00:00 2001 From: William Lucas Date: Fri, 24 May 2024 15:59:25 +0100 Subject: [PATCH] Correct use of nbatch_per_checkpoint for LSST_Image. --- imsim/lsst_image.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/imsim/lsst_image.py b/imsim/lsst_image.py index 83b29556..3be2ea02 100644 --- a/imsim/lsst_image.py +++ b/imsim/lsst_image.py @@ -306,11 +306,14 @@ def buildImage(self, config, base, image_num, obj_num, logger): all_bounds = [stamp.bounds for stamp in all_stamps] data = (full_image, all_bounds, all_vars, end_obj_num, base.get('extra_builder',None)) - self.checkpoint.save(chk_name, data) logger.warning('File %d: Completed batch %d with objects [%d, %d), and wrote ' 'checkpoint data to %s', base.get('file_num', 0), batch+1, start_obj_num, end_obj_num, self.checkpoint.file_name) + if (batch % self.nbatch_per_checkpoint == 0 + or batch + 1 == nbatch): + self.checkpoint.save(chk_name, data) + logger.warning('Wrote checkpoint data to %s', self.checkpoint.file_name) # Bring the image so far up to a flat noise variance current_var = galsim.config.FlattenNoiseVariance(