changeset 279:6544f0027c72 draft

Uploaded
author luca_milaz
date Sun, 04 Aug 2024 17:55:22 +0000
parents c1af8b0b2815
children 5bfc1b9cde50
files marea_2/flux_to_map.py
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/marea_2/flux_to_map.py	Sun Aug 04 17:48:17 2024 +0000
+++ b/marea_2/flux_to_map.py	Sun Aug 04 17:55:22 2024 +0000
@@ -821,12 +821,14 @@
 def gray_to_red_cmap(value):
     value = abs(value)
 
+    # Red color (1, 0, 0)
     r = 1
     g = 0
     b = 0
     
-    # Opacity transition from 0.5 to 1
-    alpha = 0.5 + 0.5 * value
+    # Log scale for opacity transition from 0.5 to 1
+    log_value = math.log10(1 + 9 * value) / math.log10(10)  # Log scale from 0 to 1
+    alpha = 0.5 + 0.5 * log_value
     
     return (r, g, b, alpha)
     
@@ -871,7 +873,8 @@
         for rxn_id in ids:
             arrow = Arrow(width=5, col=colors_median[rxn_id])
             #arrow.applyTo(arrow.getMapReactionId(rxn_id, mindReactionDir=False), metabMap_median, arrow.toStyleStr())
-            arrow.applyTo(getArrowBodyElementId(rxn_id), metabMap_median, arrow.toStyleStr())
+            #arrow.applyTo(getArrowBodyElementId(rxn_id), metabMap_median, arrow.toStyleStr())
+            arrow.styleReactionElements(metabMap_median, rxn_id, mindReactionDir=False)
 
             # Now we style the arrow head(s):
             #idOpt1, idOpt2 = getArrowHeadElementId(arrow.getMapReactionId(rxn_id, mindReactionDir=True))
@@ -882,7 +885,8 @@
 
             arrow = Arrow(width=5, col=colors_mean[rxn_id])
             #arrow.applyTo(arrow.getMapReactionId(rxn_id, mindReactionDir=False), metabMap_mean, arrow.toStyleStr())
-            arrow.applyTo(getArrowBodyElementId(rxn_id), metabMap_mean, arrow.toStyleStr())
+            #arrow.applyTo(getArrowBodyElementId(rxn_id), metabMap_mean, arrow.toStyleStr())
+            arrow.styleReactionElements(metabMap_mean, rxn_id, mindReactionDir=False)
 
             # Now we style the arrow head(s):
             #idOpt1, idOpt2 = getArrowHeadElementId(arrow.getMapReactionId(rxn_id, mindReactionDir=True))