From 4af64758b117d37e91a377d6d48f9edc9d4e5a8e Mon Sep 17 00:00:00 2001 From: Serge Koudoro Date: Mon, 21 Aug 2023 14:36:12 -0400 Subject: [PATCH] np.nan when file is missing --- quantconn/evaluate.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/quantconn/evaluate.py b/quantconn/evaluate.py index c0f31af..0719369 100644 --- a/quantconn/evaluate.py +++ b/quantconn/evaluate.py @@ -142,8 +142,15 @@ def save_empty_bundle_profiles(bundle_name, metric_folder, out_dir, stype=None): def evaluate_matrice(input_path, output_path, use_networkx=False): + filepath = pjoin(input_path, 'connectivity_matrice.npy') + + if not os.path.exists(filepath): + res = np.ones(3) * np.nan + np.save(pjoin(output_path, f"conn_matrice_score_{input_path[-1]}.npy"), res) + return + # Load the matrice - connectivity_matrix = np.load(pjoin(input_path, 'connectivity_matrice.npy')) + connectivity_matrix = np.load(filepath) if use_networkx: res = evaluate_matrice_networkx(connectivity_matrix)