diff --git a/src/aliby/pipeline.py b/src/aliby/pipeline.py index ed3b608b305ad20ff2d07024c8871f65820ed156..a9ed692ef5bc1a85817ed0bf437089bb767378c0 100644 --- a/src/aliby/pipeline.py +++ b/src/aliby/pipeline.py @@ -648,6 +648,18 @@ class Pipeline(ProcessABC): meta = MetaData(directory, filename) from_start = True if np.any(ow.values()) else False + + # New experiment or overwriting + if ( + from_start + and ( + config.get("overwrite", False) == True + or np.all(list(ow.values())) + ) + and filename.exists() + ): + os.remove(filename) + # If no previous segmentation and keep tiler if filename.exists(): if not ow["tiler"]: @@ -694,13 +706,6 @@ class Pipeline(ProcessABC): overwrite=True, ) - if from_start: # New experiment or overwriting - if ( - config.get("overwrite", False) is True - or np.all(list(ow.values())) - ) and filename.exists(): - os.remove(filename) - meta.run() meta.add_fields( # Add non-logfile metadata {