From b94b77a340a89d3d295a285d0aa3ba7a9bb1709f Mon Sep 17 00:00:00 2001 From: mattminder <myfiles@vpn-251-030.epfl.ch> Date: Wed, 13 May 2020 11:18:32 +0200 Subject: [PATCH] check if prediction already exists --- disk/InteractionDisk_temp.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/disk/InteractionDisk_temp.py b/disk/InteractionDisk_temp.py index ee6f1d1..1e6f39e 100644 --- a/disk/InteractionDisk_temp.py +++ b/disk/InteractionDisk_temp.py @@ -476,19 +476,19 @@ class Reader: def LaunchPrediction(self, currentT, currentFOV): - """It launches the neural neutwork on the current image and creates an hdf file with the prediction for the time T and corresponding FOV. """ - file = h5py.File(self.predictname, 'r+') - im = self.LoadOneImage(currentT, currentFOV) - im = skimage.exposure.equalize_adapthist(im) - im = im*1.0; - pred = nn.prediction(im) - file.create_dataset('/{}/{}'.format(self.fovlabels[currentFOV], - self.tlabels[currentT]), data = pred, compression = 'gzip', - compression_opts = 7) + file = h5py.File(self.predictname, 'r+') + if not self.TestTimeExists(currentT, currentFOV): + im = self.LoadOneImage(currentT, currentFOV) + im = skimage.exposure.equalize_adapthist(im) + im = im*1.0; + pred = nn.prediction(im) + file.create_dataset('/{}/{}'.format(self.fovlabels[currentFOV], + self.tlabels[currentT]), data = pred, + compression = 'gzip', compression_opts = 7) file.close() -- GitLab