From 6ce9651ada3223de201a93e0600c00db1ee48399 Mon Sep 17 00:00:00 2001
From: Hammouda Elbez <hammouda.elbez@univ-lille.fr>
Date: Tue, 8 Aug 2023 21:58:58 +0200
Subject: [PATCH] General Module style updated

---
 src/Modules/General/callbacks.py | 11 ++++++-----
 src/Modules/General/layout.py    |  2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/Modules/General/callbacks.py b/src/Modules/General/callbacks.py
index 0d55f3a..fb71c08 100755
--- a/src/Modules/General/callbacks.py
+++ b/src/Modules/General/callbacks.py
@@ -89,7 +89,7 @@ class callbacks(callbacksOp):
                                             line=dict(color="rgb(31, 119, 180)"),
                                             name='Spikes '+ ('['+layer+']' if len(generalLayerFilter) > 1 else ''),
                                             mode='lines+markers',
-                                            marker=dict(symbol="diamond-tall", size=12),
+                                            marker=dict(symbol="diamond-tall", size=10),
                                             text=list(super.xAxisLabel),
                                             customdata=list(super.SpikeGraphY[layer]),
                                             hovertemplate="%{text} <br> <b>%{customdata}</b> <br> <b>Max</b> "+str(
@@ -115,7 +115,7 @@ class callbacks(callbacksOp):
                                             line=dict(color="rgb(255, 127, 14)"),
                                             name='Synapses activity '+ ('['+layer+']' if len(generalLayerFilter) > 1 else ''),
                                             mode='lines+markers',
-                                            marker=dict(symbol="asterisk-open", size=12),
+                                            marker=dict(symbol="asterisk-open", size=10),
                                             text=list(super.xAxisLabel),
                                             customdata=list(super.SynapseGraphY[layer]),
                                             hovertemplate="<span style='color:white;'>%{text} <br> <b>%{customdata}</b> <br> <b>Max</b> "+str(super.MaxSynapse[layer])))
@@ -140,7 +140,7 @@ class callbacks(callbacksOp):
                                             line=dict(color="rgb(44, 160, 44)"),
                                             name='Neuron\'s potential '+ ('['+layer+']' if len(generalLayerFilter) > 1 else ''),
                                             mode='lines+markers',
-                                            marker=dict(symbol="diamond-wide", size=12),
+                                            marker=dict(symbol="diamond-wide", size=10),
                                             text=list(super.xAxisLabel),
                                             customdata=list(super.PotentialGraphY[layer]),
                                             hovertemplate="%{text} <br> <b>%{customdata}</b> <br> <b>Max</b> "+str(super.MaxPotential[layer])))
@@ -894,14 +894,15 @@ class callbacks(callbacksOp):
                     return None
 
                 loss = 0
-
+                total = 0
                 for a in spikes:
                     for l in g.finalLabels:
                         if (str(a["i"]["N"]) == str(l["N"]) and str(a["i"]["L"]) == l["L"]):
                             if (str(l["Label"]) != str(a["Input"])):
                                 loss += 1
+                            total+=1
 
-                return min(100,round((loss*100) / len(spikes), 2))
+                return min(100,round((loss*100) / total, 2)) if total > 0 else None
             # ---------------------------------------------------------------------
 
         except Exception:
diff --git a/src/Modules/General/layout.py b/src/Modules/General/layout.py
index cfbd7c2..f6667ee 100755
--- a/src/Modules/General/layout.py
+++ b/src/Modules/General/layout.py
@@ -344,7 +344,7 @@ class layout(layoutOp):
                     ], className="input-group col-md-12 col-sm-12 col-lg-4", style={"height": "38px", "paddingTop": "12px"})
                 ], className="d-flex justify-content-center"), dbc.Col(
                     [
-                        html.P(id="text", style={"marginLeft": "25px"}),
+                        html.Span(id="text", style={"marginLeft": "25px","width":"fit-content","marginBottom":"5px"}, className="input-group-text"),
                         dcc.Slider(
                             id='vis-slider',
                             min=0,
-- 
GitLab