Skip to content
Snippets Groups Projects
Commit 19a9428b authored by Hammouda Elbez's avatar Hammouda Elbez :computer:
Browse files

Init change on the 2D view section

parent f297c449
No related branches found
No related tags found
1 merge request!26Custom 2d view
...@@ -33,7 +33,6 @@ class layout(layoutOp): ...@@ -33,7 +33,6 @@ class layout(layoutOp):
Max = 0 Max = 0
# ---------------------------------------------------------------- # ----------------------------------------------------------------
Nodes = [] Nodes = []
Edges = []
tabs = [] tabs = []
label = " " label = " "
visStopped = True visStopped = True
...@@ -43,22 +42,19 @@ class layout(layoutOp): ...@@ -43,22 +42,19 @@ class layout(layoutOp):
# 2D view -------------------------------------------------------- # 2D view --------------------------------------------------------
def generate2DView(self, Nodes, Edges, g): def generate2DView(self, Nodes, g):
""" Generates a 2D View of the neural network """ Generates a 2D View of the neural network
Args: Args:
Nodes (list): neurons list Nodes (list): neurons list
Edges (list): synapses list
g (Global_Var): reference to access global variables g (Global_Var): reference to access global variables
""" """
# Create the neurones and layers # Create the neurones and layers
for L in g.LayersNeuronsInfo: for L in g.LayersNeuronsInfo:
Nodes.append({ Nodes.append({'data': {'id': L["layer"], 'label': L["layer"], 'spiked': -1}})
'data': {'id': L["layer"], 'label': L["layer"]}
})
for i in range(L["neuronNbr"]): for i in range(L["neuronNbr"]):
Nodes.append( Nodes.append({'data': {'id': L["layer"]+str(i), 'label': str(i), 'parent': L["layer"], 'spiked': 10},
{'data': {'id': L["layer"]+str(i), 'label': str(i), 'parent': L["layer"]}, 'position': {'x': 25*i, 'y': 0}}) 'position': {'x': 25*i, 'y': 0}})
# Add connections # Add connections
...@@ -78,7 +74,6 @@ class layout(layoutOp): ...@@ -78,7 +74,6 @@ class layout(layoutOp):
self.MaxSynapse = dict() self.MaxSynapse = dict()
self.Max = 0 self.Max = 0
self.Nodes = [] self.Nodes = []
self.Edges = []
def Vis(self): def Vis(self):
""" Create layer components """ Create layer components
...@@ -103,7 +98,7 @@ class layout(layoutOp): ...@@ -103,7 +98,7 @@ class layout(layoutOp):
] ]
# Generate 2D View ------------------------------------------- # Generate 2D View -------------------------------------------
self.generate2DView(self.Nodes, self.Edges, self.g) self.generate2DView(self.Nodes, self.g)
# Tabs content ----------------------------------------------- # Tabs content -----------------------------------------------
info_vis = dbc.Card( info_vis = dbc.Card(
...@@ -166,13 +161,14 @@ class layout(layoutOp): ...@@ -166,13 +161,14 @@ class layout(layoutOp):
)], className="d-flex"), )], 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") 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"), ], style={"padding": "5px"})), label="General information", value="General information"),
# 2D view
dcc.Tab(dbc.Card( dcc.Tab(dbc.Card(
dbc.CardBody([ dbc.CardBody([
html.Div( html.Div(
[ [
cyto.Cytoscape( cyto.Cytoscape(
id='cytoscape-compound', id='cytoscape-compound',
responsive=True,
layout={'name': 'grid'}, layout={'name': 'grid'},
style={'width': '100%', style={'width': '100%',
'height': '100%'}, 'height': '100%'},
...@@ -188,17 +184,28 @@ class layout(layoutOp): ...@@ -188,17 +184,28 @@ class layout(layoutOp):
{ {
'selector': '.neurons', 'selector': '.neurons',
'style': {'line-style': 'dashed'} '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%"}), ], style={"background": "rgb(227, 245, 251)", "height": "60vh", "textAlign": "start", "padding": "0px", "width":"70%"}),
html.Div(
[ html.Div([], style={"height": "60vh", "textAlign": "start", "padding": "0px", "width":"30%"})
], style={"height": "60vh", "textAlign": "start", "padding": "0px", "width":"30%"}) ], className="row")), label="2D view", value="2Dview")], id="tabinfo", value="General information"),
])), label="2D view", value="2Dview")], id="tabinfo", value="General information"),
] ]
), ),
......
...@@ -33,9 +33,9 @@ ...@@ -33,9 +33,9 @@
<div class="col-10 m-5"> <div class="col-10 m-5">
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
VS2N version : <strong style="color: rgb(68, 71, 99);">{{ vs2n }}</strong><br><br> VS2N : <strong style="color: rgb(68, 71, 99);">{{ vs2n }}</strong><br><br>
MongoDB version : <strong style="color: rgb(68, 71, 99);">{{ mongodb }}</strong><br><br> MongoDB : <strong style="color: rgb(68, 71, 99);">{{ mongodb }}</strong><br><br>
Apache Spark version : <strong style="color: rgb(68, 71, 99);">{{ spark }}</strong> Apache Spark : <strong style="color: rgb(68, 71, 99);">{{ spark }}</strong>
</div> </div>
</div> </div>
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment