From 19a9428b8bfe05ea5a06419c9d01e33261c877f2 Mon Sep 17 00:00:00 2001 From: Hammouda Elbez <hammouda.elbez@univ-lille.fr> Date: Thu, 9 Mar 2023 16:57:32 +0100 Subject: [PATCH] Init change on the 2D view section --- src/Modules/General/layout.py | 41 ++++++++++++++++++++--------------- src/templates/index.html | 6 ++--- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/src/Modules/General/layout.py b/src/Modules/General/layout.py index 72f7c1b..cf113d4 100755 --- a/src/Modules/General/layout.py +++ b/src/Modules/General/layout.py @@ -33,7 +33,6 @@ class layout(layoutOp): Max = 0 # ---------------------------------------------------------------- Nodes = [] - Edges = [] tabs = [] label = " " visStopped = True @@ -43,22 +42,19 @@ class layout(layoutOp): # 2D view -------------------------------------------------------- - def generate2DView(self, Nodes, Edges, g): + def generate2DView(self, Nodes, g): """ Generates a 2D View of the neural network Args: Nodes (list): neurons list - Edges (list): synapses list g (Global_Var): reference to access global variables """ # Create the neurones and layers for L in g.LayersNeuronsInfo: - Nodes.append({ - 'data': {'id': L["layer"], 'label': L["layer"]} - }) + Nodes.append({'data': {'id': L["layer"], 'label': L["layer"], 'spiked': -1}}) for i in range(L["neuronNbr"]): - Nodes.append( - {'data': {'id': L["layer"]+str(i), 'label': str(i), 'parent': L["layer"]}, 'position': {'x': 25*i, 'y': 0}}) + Nodes.append({'data': {'id': L["layer"]+str(i), 'label': str(i), 'parent': L["layer"], 'spiked': 10}, + 'position': {'x': 25*i, 'y': 0}}) # Add connections @@ -78,7 +74,6 @@ class layout(layoutOp): self.MaxSynapse = dict() self.Max = 0 self.Nodes = [] - self.Edges = [] def Vis(self): """ Create layer components @@ -103,7 +98,7 @@ class layout(layoutOp): ] # Generate 2D View ------------------------------------------- - self.generate2DView(self.Nodes, self.Edges, self.g) + self.generate2DView(self.Nodes, self.g) # Tabs content ----------------------------------------------- info_vis = dbc.Card( @@ -166,13 +161,14 @@ class layout(layoutOp): )], className="d-flex"), dcc.Graph(id='label-graph', config={"displaylogo": False})], className="col-lg-3 col-sm-12 col-xs-12") if(self.g.labelsExistance) else []], className="row") ], style={"padding": "5px"})), label="General information", value="General information"), + # 2D view dcc.Tab(dbc.Card( dbc.CardBody([ - html.Div( [ cyto.Cytoscape( id='cytoscape-compound', + responsive=True, layout={'name': 'grid'}, style={'width': '100%', 'height': '100%'}, @@ -188,17 +184,28 @@ class layout(layoutOp): { 'selector': '.neurons', 'style': {'line-style': 'dashed'} + }, + { + 'selector': '[spiked = 10]', + 'style': { + 'background-color': 'rgb(180,180,180)' + } + }, + { + 'selector': '[spiked = -1]', + 'style': { + 'background-color': 'rgb(227,227,227)' + } } ], - elements=self.Nodes + self.Edges + elements=self.Nodes ) ], style={"background": "rgb(227, 245, 251)", "height": "60vh", "textAlign": "start", "padding": "0px", "width":"70%"}), - html.Div( - [ - - ], style={"height": "60vh", "textAlign": "start", "padding": "0px", "width":"30%"}) - ])), label="2D view", value="2Dview")], id="tabinfo", value="General information"), + + html.Div([], style={"height": "60vh", "textAlign": "start", "padding": "0px", "width":"30%"}) + + ], className="row")), label="2D view", value="2Dview")], id="tabinfo", value="General information"), ] ), diff --git a/src/templates/index.html b/src/templates/index.html index 01ee2b4..70d434c 100755 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -33,9 +33,9 @@ <div class="col-10 m-5"> <div class="card"> <div class="card-body"> - VS2N version : <strong style="color: rgb(68, 71, 99);">{{ vs2n }}</strong><br><br> - MongoDB version : <strong style="color: rgb(68, 71, 99);">{{ mongodb }}</strong><br><br> - Apache Spark version : <strong style="color: rgb(68, 71, 99);">{{ spark }}</strong> + VS2N : <strong style="color: rgb(68, 71, 99);">{{ vs2n }}</strong><br><br> + MongoDB : <strong style="color: rgb(68, 71, 99);">{{ mongodb }}</strong><br><br> + Apache Spark : <strong style="color: rgb(68, 71, 99);">{{ spark }}</strong> </div> </div> </div> -- GitLab