changeset 316:c96a8a3cc81e draft

Uploaded
author luca_milaz
date Mon, 05 Aug 2024 12:41:07 +0000
parents 48d2973faacf
children e7abca5fb51c
files marea_2/flux_to_map.py
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/marea_2/flux_to_map.py	Mon Aug 05 12:32:14 2024 +0000
+++ b/marea_2/flux_to_map.py	Mon Aug 05 12:41:07 2024 +0000
@@ -870,8 +870,9 @@
     ax.set_axis_off()
 
     # Save the image
-    plt.savefig(path, bbox_inches='tight', pad_inches=0)
+    plt.savefig(path.show(), bbox_inches='tight', pad_inches=0)
     plt.close()
+    pass
 
 def computeEnrichmentMeanMedian(metabMap: ET.ElementTree, class_pat: Dict[str, List[List[float]]], ids: List[str]) -> None:
     """
@@ -901,8 +902,8 @@
     min_flux_medians = min(np.min(np.abs(arr)) for arr in medians.values())
     min_flux_means = min(np.min(np.abs(arr)) for arr in means.values())
 
-    medians = {key: (median - min_flux_medians) / (max_flux_medians - min_flux_medians) for key, median in medians.items()}
-    means = {key: (mean - min_flux_means) / (max_flux_means - min_flux_means) for key, mean in means.items()}
+    medians = {key: median/max_flux_medians for key, median in medians.items()}
+    means = {key: mean/max_flux_means for key, mean in means.items()}
 
     save_colormap_image(min_flux_medians, max_flux_medians, "colormap_median.png")
     save_colormap_image(min_flux_means, max_flux_means, "colormap_mean.png")
@@ -911,8 +912,8 @@
 
     for key in class_pat:
         # Create color mappings for median and mean
-        colors_median = {rxn_id: rgb_to_hex(cmap(medians[key][i])) for i, rxn_id in enumerate(ids)}
-        colors_mean = {rxn_id: rgb_to_hex(cmap(means[key][i])) for i, rxn_id in enumerate(ids)}
+        colors_median = {rxn_id: rgb_to_hex(cmap(abs(medians[key][i]))) for i, rxn_id in enumerate(ids)}
+        colors_mean = {rxn_id: rgb_to_hex(cmap(abs(means[key][i]))) for i, rxn_id in enumerate(ids)}
 
         for i, rxn_id in enumerate(ids):
             isNegative = medians[key][i] < 0