From 63145f7fd547dbdd1f2cba6cbc9a85f22acda05f Mon Sep 17 00:00:00 2001 From: ptajvar Date: Tue, 22 Oct 2024 16:58:59 +0200 Subject: [PATCH] casting report parameters to corresponding data types --- src/pixelator/graph/community_detection.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/pixelator/graph/community_detection.py b/src/pixelator/graph/community_detection.py index 78719eeb..48313042 100644 --- a/src/pixelator/graph/community_detection.py +++ b/src/pixelator/graph/community_detection.py @@ -188,18 +188,18 @@ def connect_components( logger.debug("Generate graph report") result_metrics = edgelist_metrics(graph_output_edgelist) - result_metrics["edges_with_colliding_upi_count"] = ( - (removed_edgelist_df["depth"] == 0).sum().astype(int) + result_metrics["edges_with_colliding_upi_count"] = int( + (removed_edgelist_df["depth"] == 0).sum() ) - result_metrics["edges_removed_in_multiplet_recovery_first_iteration"] = ( - (removed_edgelist_df["depth"] == 1).sum().astype(int) + result_metrics["edges_removed_in_multiplet_recovery_first_iteration"] = int( + (removed_edgelist_df["depth"] == 1).sum() ) - result_metrics["edges_removed_in_multiplet_recovery_refinement"] = ( - (removed_edgelist_df["depth"] > 1).sum().astype(int) + result_metrics["edges_removed_in_multiplet_recovery_refinement"] = int( + (removed_edgelist_df["depth"] > 1).sum() + ) + result_metrics["fraction_edges_removed_in_refinement"] = float( + (removed_edgelist_df["depth"] > 1).sum() / max(len(removed_edgelist_df), 1) ) - result_metrics["fraction_edges_removed_in_refinement"] = ( - removed_edgelist_df["depth"] > 1 - ).sum() / max(len(removed_edgelist_df), 1) del graph_output_edgelist del removed_edgelist_df