Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
VS2N
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BioInsp
VS2N
Commits
e7769190
Commit
e7769190
authored
4 years ago
by
Elbez Hammouda
Browse files
Options
Downloads
Patches
Plain Diff
General module multilayer support finalised
parent
aa9bb56d
No related branches found
No related tags found
1 merge request
!22
V0.351
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
assets/app.css
+4
-0
4 additions, 0 deletions
assets/app.css
src/Modules/General/callbacks.py
+60
-70
60 additions, 70 deletions
src/Modules/General/callbacks.py
src/Modules/General/layout.py
+5
-4
5 additions, 4 deletions
src/Modules/General/layout.py
with
69 additions
and
74 deletions
assets/app.css
+
4
−
0
View file @
e7769190
...
@@ -78,3 +78,7 @@ button:focus{
...
@@ -78,3 +78,7 @@ button:focus{
color
:
rgb
(
68
,
71
,
99
);
color
:
rgb
(
68
,
71
,
99
);
background-color
:
rgba
(
68
,
71
,
99
,
0.116
);
background-color
:
rgba
(
68
,
71
,
99
,
0.116
);
}
}
.Select-control
{
width
:
100%
!important
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/Modules/General/callbacks.py
+
60
−
70
View file @
e7769190
...
@@ -63,6 +63,7 @@ class callbacks():
...
@@ -63,6 +63,7 @@ class callbacks():
graphs
=
{
l
:[]
for
l
in
generalLayerFilter
}
graphs
=
{
l
:[]
for
l
in
generalLayerFilter
}
annotations
=
[]
annotations
=
[]
for
layer
in
generalLayerFilter
:
for
layer
in
generalLayerFilter
:
i
=
0
i
=
0
for
f
in
generalGraphFilter
:
for
f
in
generalGraphFilter
:
...
@@ -70,7 +71,7 @@ class callbacks():
...
@@ -70,7 +71,7 @@ class callbacks():
if
(
layer
not
in
super
.
SpikeGraphY
):
if
(
layer
not
in
super
.
SpikeGraphY
):
super
.
SpikeGraphY
[
layer
]
=
deque
(
maxlen
=
100
)
super
.
SpikeGraphY
[
layer
]
=
deque
(
maxlen
=
100
)
super
.
MaxSpike
[
layer
]
=
0
super
.
MaxSpike
[
layer
]
=
0
if
data
!=
None
and
layer
in
data
[
i
]:
if
data
[
i
]
!=
None
and
layer
in
data
[
i
]:
super
.
SpikeGraphY
[
layer
].
append
(
data
[
i
][
layer
][
"
spikes
"
])
super
.
SpikeGraphY
[
layer
].
append
(
data
[
i
][
layer
][
"
spikes
"
])
else
:
else
:
super
.
SpikeGraphY
[
layer
].
append
(
0
)
super
.
SpikeGraphY
[
layer
].
append
(
0
)
...
@@ -86,7 +87,7 @@ class callbacks():
...
@@ -86,7 +87,7 @@ class callbacks():
fill
=
'
tozeroy
'
if
len
(
fill
=
'
tozeroy
'
if
len
(
generalGraphFilter
)
==
1
else
'
none
'
,
generalGraphFilter
)
==
1
else
'
none
'
,
line
=
dict
(
color
=
"
rgb(31, 119, 180)
"
),
line
=
dict
(
color
=
"
rgb(31, 119, 180)
"
),
name
=
'
Spikes
'
,
name
=
'
Spikes
[
'
+
layer
+
'
]
'
,
mode
=
'
lines+markers
'
,
mode
=
'
lines+markers
'
,
text
=
list
(
super
.
xAxisLabel
),
text
=
list
(
super
.
xAxisLabel
),
customdata
=
list
(
super
.
SpikeGraphY
[
layer
]),
customdata
=
list
(
super
.
SpikeGraphY
[
layer
]),
...
@@ -97,7 +98,7 @@ class callbacks():
...
@@ -97,7 +98,7 @@ class callbacks():
if
(
layer
not
in
super
.
SynapseGraphY
):
if
(
layer
not
in
super
.
SynapseGraphY
):
super
.
SynapseGraphY
[
layer
]
=
deque
(
maxlen
=
100
)
super
.
SynapseGraphY
[
layer
]
=
deque
(
maxlen
=
100
)
super
.
MaxSynapse
[
layer
]
=
0
super
.
MaxSynapse
[
layer
]
=
0
if
data
!=
None
and
layer
in
data
[
i
]:
if
data
[
i
]
!=
None
and
layer
in
data
[
i
]:
super
.
SynapseGraphY
[
layer
].
append
(
data
[
i
][
layer
][
"
synapseUpdate
"
])
super
.
SynapseGraphY
[
layer
].
append
(
data
[
i
][
layer
][
"
synapseUpdate
"
])
else
:
else
:
super
.
SynapseGraphY
[
layer
].
append
(
0
)
super
.
SynapseGraphY
[
layer
].
append
(
0
)
...
@@ -111,7 +112,7 @@ class callbacks():
...
@@ -111,7 +112,7 @@ class callbacks():
fill
=
'
tozeroy
'
if
len
(
fill
=
'
tozeroy
'
if
len
(
generalGraphFilter
)
==
1
else
'
none
'
,
generalGraphFilter
)
==
1
else
'
none
'
,
line
=
dict
(
color
=
"
rgb(255, 127, 14)
"
),
line
=
dict
(
color
=
"
rgb(255, 127, 14)
"
),
name
=
'
Synapses
update
'
,
name
=
'
Synapses
activity [
'
+
layer
+
'
]
'
,
mode
=
'
lines+markers
'
,
mode
=
'
lines+markers
'
,
text
=
list
(
super
.
xAxisLabel
),
text
=
list
(
super
.
xAxisLabel
),
customdata
=
list
(
super
.
SynapseGraphY
[
layer
]),
customdata
=
list
(
super
.
SynapseGraphY
[
layer
]),
...
@@ -120,7 +121,7 @@ class callbacks():
...
@@ -120,7 +121,7 @@ class callbacks():
if
(
layer
not
in
super
.
PotentialGraphY
):
if
(
layer
not
in
super
.
PotentialGraphY
):
super
.
PotentialGraphY
[
layer
]
=
deque
(
maxlen
=
100
)
super
.
PotentialGraphY
[
layer
]
=
deque
(
maxlen
=
100
)
super
.
MaxPotential
[
layer
]
=
0
super
.
MaxPotential
[
layer
]
=
0
if
data
!=
None
and
layer
in
data
[
i
]:
if
data
[
i
]
!=
None
and
layer
in
data
[
i
]:
super
.
PotentialGraphY
[
layer
].
append
(
data
[
i
][
layer
][
"
potential
"
])
super
.
PotentialGraphY
[
layer
].
append
(
data
[
i
][
layer
][
"
potential
"
])
else
:
else
:
super
.
PotentialGraphY
[
layer
].
append
(
0
)
super
.
PotentialGraphY
[
layer
].
append
(
0
)
...
@@ -135,13 +136,15 @@ class callbacks():
...
@@ -135,13 +136,15 @@ class callbacks():
fill
=
'
tozeroy
'
if
len
(
fill
=
'
tozeroy
'
if
len
(
generalGraphFilter
)
==
1
else
'
none
'
,
generalGraphFilter
)
==
1
else
'
none
'
,
line
=
dict
(
color
=
"
rgb(44, 160, 44)
"
),
line
=
dict
(
color
=
"
rgb(44, 160, 44)
"
),
name
=
"
Neuron
'
s potential
update
"
,
name
=
'
Neuron
\
'
s potential
[
'
+
layer
+
'
]
'
,
mode
=
'
lines+markers
'
,
mode
=
'
lines+markers
'
,
text
=
list
(
super
.
xAxisLabel
),
text
=
list
(
super
.
xAxisLabel
),
customdata
=
list
(
super
.
PotentialGraphY
[
layer
]),
customdata
=
list
(
super
.
PotentialGraphY
[
layer
]),
hovertemplate
=
"
%{text} <br> <b>%{customdata}</b> <br> <b>Max</b>
"
+
str
(
super
.
MaxPotential
[
layer
])))
hovertemplate
=
"
%{text} <br> <b>%{customdata}</b> <br> <b>Max</b>
"
+
str
(
super
.
MaxPotential
[
layer
])))
i
+=
1
i
+=
1
if
(
len
(
graphs
)
!=
0
):
if
(
g
.
Labels
!=
None
):
if
(
g
.
Labels
!=
None
):
if
(
data
[
-
1
]
!=
None
):
if
(
data
[
-
1
]
!=
None
):
...
@@ -171,23 +174,6 @@ class callbacks():
...
@@ -171,23 +174,6 @@ class callbacks():
fig
.
add_trace
(
fig
.
add_trace
(
graph
,
row
=
3
,
col
=
1
)
graph
,
row
=
3
,
col
=
1
)
fig
[
'
layout
'
].
update
(
xaxis2
=
dict
(
title
=
'
Step
'
,
autorange
=
True
,
range
=
[
min
(
super
.
InfoGraphX
)
if
super
.
InfoGraphX
else
0
,
max
(
super
.
InfoGraphX
)
if
super
.
InfoGraphX
else
0
],
#rangeslider={'visible': True,'autorange': True},
# showticklabels=False,
tickvals
=
list
(
super
.
InfoGraphX
),
),
yaxis1
=
dict
(
range
=
[
0
,
105
]
),
showlegend
=
True
,
uirevision
=
'
no reset of zoom
'
,
margin
=
{
'
l
'
:
0
,
'
r
'
:
0
,
'
t
'
:
30
,
'
b
'
:
25
},
annotations
=
annotations
)
else
:
else
:
fig
=
make_subplots
(
fig
=
make_subplots
(
rows
=
len
(
graphs
),
cols
=
1
,
shared_xaxes
=
True
,
vertical_spacing
=
0.05
)
rows
=
len
(
graphs
),
cols
=
1
,
shared_xaxes
=
True
,
vertical_spacing
=
0.05
)
...
@@ -199,21 +185,25 @@ class callbacks():
...
@@ -199,21 +185,25 @@ class callbacks():
graph
,
row
=
l
,
col
=
1
)
graph
,
row
=
l
,
col
=
1
)
l
+=
1
l
+=
1
fig
.
update_xaxes
(
title_text
=
"
Step
"
,
row
=
len
(
graphs
),
col
=
1
)
fig
[
'
layout
'
].
update
(
fig
[
'
layout
'
].
update
(
# TODO: change axis when there is no Loss
xaxis
=
dict
(
title
=
'
Step
'
,
autorange
=
True
,
range
=
[
min
(
super
.
InfoGraphX
)
if
super
.
InfoGraphX
else
0
,
max
(
super
.
InfoGraphX
)
if
super
.
InfoGraphX
else
0
],
#rangeslider={'visible': True,'autorange': True},
# showticklabels=False,
tickvals
=
list
(
super
.
InfoGraphX
)),
yaxis
=
dict
(
range
=
[
0
,
105
]),
yaxis
=
dict
(
range
=
[
0
,
105
]),
showlegend
=
True
,
showlegend
=
True
,
uirevision
=
'
no reset of zoom
'
,
uirevision
=
'
no reset of zoom
'
,
margin
=
{
'
l
'
:
0
,
'
r
'
:
0
,
'
t
'
:
30
,
'
b
'
:
25
},
margin
=
{
'
l
'
:
0
,
'
r
'
:
0
,
'
t
'
:
30
,
'
b
'
:
25
},
annotations
=
annotations
)
annotations
=
annotations
)
else
:
fig
=
make_subplots
(
rows
=
1
,
cols
=
1
,
shared_xaxes
=
True
,
vertical_spacing
=
0.05
,
specs
=
[[{
'
rowspan
'
:
1
}]])
fig
.
add_trace
(
go
.
Scatter
(
x
=
list
(),
y
=
list
(),
mode
=
'
lines
'
,
line
=
{
"
color
"
:
"
#dc3545
"
,
"
dash
"
:
"
dot
"
,
"
width
"
:
2
},
),
row
=
1
,
col
=
1
)
return
fig
return
fig
except
Exception
as
e
:
except
Exception
as
e
:
...
...
This diff is collapsed.
Click to expand it.
src/Modules/General/layout.py
+
5
−
4
View file @
e7769190
...
@@ -68,6 +68,7 @@ class layout():
...
@@ -68,6 +68,7 @@ class layout():
self
.
SpikeGraphY
.
clear
()
self
.
SpikeGraphY
.
clear
()
self
.
LossGraphY
.
clear
()
self
.
LossGraphY
.
clear
()
self
.
SynapseGraphY
.
clear
()
self
.
SynapseGraphY
.
clear
()
self
.
PotentialGraphY
.
clear
()
self
.
xAxisLabel
.
clear
()
self
.
xAxisLabel
.
clear
()
self
.
Label
.
clear
()
self
.
Label
.
clear
()
self
.
MaxPotential
=
dict
()
self
.
MaxPotential
=
dict
()
...
@@ -133,18 +134,18 @@ class layout():
...
@@ -133,18 +134,18 @@ class layout():
# Graphs filter
# Graphs filter
dcc
.
Dropdown
(
dcc
.
Dropdown
(
id
=
'
GeneralGraphFilter
'
,
id
=
'
GeneralGraphFilter
'
,
options
=
[{
'
label
'
:
"
Spikes
"
,
'
value
'
:
"
Spikes
"
},
{
'
label
'
:
"
Synapses
update
"
,
'
value
'
:
"
Synapses
"
},
{
options
=
[{
'
label
'
:
"
Spikes
"
,
'
value
'
:
"
Spikes
"
},
{
'
label
'
:
"
Synapses
activity
"
,
'
value
'
:
"
Synapses
"
},
{
'
label
'
:
"
Neurons potential
update
"
,
'
value
'
:
"
Potentials
"
}],
'
label
'
:
"
Neurons potential
"
,
'
value
'
:
"
Potentials
"
}],
value
=
[
'
Spikes
'
],
value
=
[
'
Spikes
'
],
multi
=
True
,
multi
=
True
,
style
=
{
'
width
'
:
'
50%
'
,
"
marginLeft
"
:
"
10px
"
,
"
textAlign
"
:
"
start
"
}),
style
=
{
"
minWidth
"
:
"
10%
"
,
"
marginLeft
"
:
"
10px
"
,
"
textAlign
"
:
"
start
"
}),
# Layers filter
# Layers filter
dcc
.
Dropdown
(
dcc
.
Dropdown
(
id
=
'
GeneralLayerFilter
'
,
id
=
'
GeneralLayerFilter
'
,
options
=
[{
'
label
'
:
str
(
i
),
'
value
'
:
str
(
i
)}
for
i
in
(
i
for
i
in
g
.
Layer_Neuron
if
i
!=
"
Input
"
)],
options
=
[{
'
label
'
:
str
(
i
),
'
value
'
:
str
(
i
)}
for
i
in
(
i
for
i
in
g
.
Layer_Neuron
if
i
!=
"
Input
"
)],
value
=
[
str
(
i
)
for
i
in
(
i
for
i
in
g
.
Layer_Neuron
if
i
!=
"
Input
"
)],
value
=
[
str
(
i
)
for
i
in
(
i
for
i
in
g
.
Layer_Neuron
if
i
!=
"
Input
"
)],
multi
=
True
,
multi
=
True
,
style
=
{
'
width
'
:
'
50%
'
,
"
marginLeft
"
:
"
5px
"
,
"
textAlign
"
:
"
start
"
})],
className
=
"
row
"
,
style
=
{
"
paddingLeft
"
:
"
20px
"
})
style
=
{
"
minWidth
"
:
"
10%
"
,
"
marginLeft
"
:
"
1
5px
"
,
"
textAlign
"
:
"
start
"
})],
className
=
"
row
"
,
style
=
{
"
paddingLeft
"
:
"
20px
"
,
'
width
'
:
'
100%
'
})
],
className
=
"
col-12
"
)
],
className
=
"
col-12
"
)
],
className
=
"
row
"
),
],
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
.
Labels
!=
None
)
else
"
col-lg-12 col-sm-12 col-xs-12
"
),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment