From 8146a9b270edf1d76a606ec61fc77dc3393a9534 Mon Sep 17 00:00:00 2001 From: sebastiankloth Date: Tue, 27 Jun 2023 17:29:36 +0200 Subject: [PATCH] Readded the try except block to shifted_correlation. --- mdevaluate/correlation.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/mdevaluate/correlation.py b/mdevaluate/correlation.py index 34cbcd8..525a2f4 100644 --- a/mdevaluate/correlation.py +++ b/mdevaluate/correlation.py @@ -192,13 +192,22 @@ def shifted_correlation( ) else: pool = ProcessPool(nodes=nodes) - result = np.array( - pool.map(partial(get_correlation, idx=idx, selector=selector), start_frames) - ) - pool.terminate() - pool.restart() + try: + result = np.array( + pool.map( + partial(get_correlation, idx=idx, selector=selector), start_frames + ) + ) + except Exception: + logger.warning( + "WARNING: Something went wrong during multiprocessing " + "in shifted_correlation." + ) + finally: + pool.terminate() + pool.restart() - if average == True: + if average: clean_result = [] for entry in result: if np.all(entry == 0):