diff --git a/src/Global_Var.py b/src/Global_Var.py
index d3202bd0dafeb2c04c777d090fd5502b7c4d8eee..9745a89869e5422436430448bb8bdbf3d2c2d4bf 100755
--- a/src/Global_Var.py
+++ b/src/Global_Var.py
@@ -37,7 +37,8 @@ class Global_Var():
Input = 0
Date = ""
Accuracy = "0"
- Labels = None
+ finalLabels = None
+ labelsExistance = False
oldIdSpike = None
def __init__(self):
@@ -54,7 +55,8 @@ class Global_Var():
self.Input = 0
self.Date = ""
self.Accuracy = "0"
- self.Labels = None
+ self.finalLabels = None
+ self.labelsExistance = False
self.oldIdSpike = None
# MongoDB connection ---------------------------------------------
diff --git a/src/Modules/General/callbacks.py b/src/Modules/General/callbacks.py
index 0a654270a6e906cb5f2114b3721c39e44c46ed3e..7ee5c082e72a632a882573e540b0cf74d00282a4 100644
--- a/src/Modules/General/callbacks.py
+++ b/src/Modules/General/callbacks.py
@@ -87,7 +87,7 @@ class callbacks():
fill='tozeroy' if len(
generalGraphFilter) == 1 else 'none',
line=dict(color="rgb(31, 119, 180)"),
- name='Spikes ['+layer+']',
+ name='Spikes'+ ('['+layer+']' if len(generalLayerFilter) > 1 else ''),
mode='lines+markers',
text=list(super.xAxisLabel),
customdata=list(super.SpikeGraphY[layer]),
@@ -112,7 +112,7 @@ class callbacks():
fill='tozeroy' if len(
generalGraphFilter) == 1 else 'none',
line=dict(color="rgb(255, 127, 14)"),
- name='Synapses activity ['+layer+']',
+ name='Synapses activity'+ ('['+layer+']' if len(generalLayerFilter) > 1 else ''),
mode='lines+markers',
text=list(super.xAxisLabel),
customdata=list(super.SynapseGraphY[layer]),
@@ -136,7 +136,7 @@ class callbacks():
fill='tozeroy' if len(
generalGraphFilter) == 1 else 'none',
line=dict(color="rgb(44, 160, 44)"),
- name='Neuron\'s potential ['+layer+']',
+ name='Neuron\'s potential'+ ('['+layer+']' if len(generalLayerFilter) > 1 else ''),
mode='lines+markers',
text=list(super.xAxisLabel),
customdata=list(super.PotentialGraphY[layer]),
@@ -145,7 +145,7 @@ class callbacks():
if(len(graphs) != 0):
- if(g.Labels != None):
+ if(g.finalLabels != None):
if(data[-1] != None):
super.LossGraphY.append(round(data[-1], 2))
@@ -736,7 +736,7 @@ class callbacks():
Returns:
loss value
"""
- if g.Labels == None:
+ if g.finalLabels == None:
return None
# MongoDB---------------------
col = pymongo.collection.Collection(g.db, 'spikes')
@@ -754,7 +754,7 @@ class callbacks():
loss = 0
for a in spikes:
- for l in g.Labels:
+ 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
diff --git a/src/Modules/General/layout.py b/src/Modules/General/layout.py
index abb951fc384b34ad84277e15287e34046e1dcb22..97e0d87858822cce59c0b80a7cb29bbcc0ed2e19 100644
--- a/src/Modules/General/layout.py
+++ b/src/Modules/General/layout.py
@@ -148,7 +148,7 @@ class layout():
style={"minWidth":"10%","marginLeft": "15px", "textAlign": "start"})], className="row", style={"paddingLeft": "20px",'width': '100%'})
], className="col-12")
], className="row"),
- html.Div([dcc.Graph(id='general-graph', animate=False, config={"displaylogo": False})])], className="col-lg-9 col-sm-12 col-xs-12" if(g.Labels != None) else "col-lg-12 col-sm-12 col-xs-12"),
+ html.Div([dcc.Graph(id='general-graph', animate=False, config={"displaylogo": False})])], className="col-lg-9 col-sm-12 col-xs-12" if(g.labelsExistance) else "col-lg-12 col-sm-12 col-xs-12"),
html.Div([
html.Div([
html.P("Inputs", style={
@@ -160,7 +160,7 @@ class layout():
color="#28a745",
style={"marginLeft": "10px"}
)], className="row"),
- dcc.Graph(id='label-graph', animate=False, config={"displaylogo": False})], className="col-lg-3 col-sm-12 col-xs-12") if(g.Labels != None) else []], className="row")
+ dcc.Graph(id='label-graph', animate=False, config={"displaylogo": False})], className="col-lg-3 col-sm-12 col-xs-12") if(g.labelsExistance) else []], className="row")
], style={"padding": "5px"})), label="General information", value="General information"),
dcc.Tab(dbc.Card(
dbc.CardBody([
diff --git a/src/Modules/General/spark.py b/src/Modules/General/spark.py
index 9495e039e31dda23fab0e43a8d942c66daaf391f..d5182d58a608ce71bbc076af13f38eadef379ec9 100644
--- a/src/Modules/General/spark.py
+++ b/src/Modules/General/spark.py
@@ -63,6 +63,7 @@ def preProcessing(g):
M = max(M, pymongo.collection.Collection(
g.db, 'synapseWeight').find_one(sort=[("T", -1)])["T"])
if ('labels' in g.db.list_collection_names()):
+ g.labelsExistance = True
M = max(M, pymongo.collection.Collection(
g.db, 'labels').find_one(sort=[("T", -1)])["T"])
else: