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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BioInsp
VS2N
Commits
95febf21
Commit
95febf21
authored
1 year ago
by
Hammouda Elbez
Browse files
Options
Downloads
Patches
Plain Diff
Fixed issue with Flask & 2D View improved
parent
77fee91b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
VS2N.py
+1
-0
1 addition, 0 deletions
VS2N.py
src/Modules/General/callbacks.py
+14
-3
14 additions, 3 deletions
src/Modules/General/callbacks.py
with
15 additions
and
3 deletions
VS2N.py
+
1
−
0
View file @
95febf21
...
...
@@ -268,6 +268,7 @@ class VS2N():
# Loading Modules to Dashboard
layout
().
load
(
self
.
app_vis
,
self
.
g
)
return
"
done
"
def
Module
(
self
,
n
,
g
):
"""
Helper function to execute each module sparks pre processing (if exist)
...
...
This diff is collapsed.
Click to expand it.
src/Modules/General/callbacks.py
+
14
−
3
View file @
95febf21
...
...
@@ -566,6 +566,7 @@ class callbacks(callbacksOp):
elements
=
super
.
Spikes2D
matrix
=
{}
indices
=
{}
labelData
=
getNetworkInput
(
int
(
sliderValue
)
*
float
(
updateInterval
),
g
.
updateInterval
)
if
callback_context
.
triggered
[
0
][
'
prop_id
'
].
split
(
'
.
'
)[
0
]
in
[
"
v-step
"
,
"
vis-update
"
]:
super
.
SpikesActivityPerInput
=
{
i
:[[
0
for
j
in
range
(
g
.
nbrClasses
+
1
)]
for
i
in
range
(
g
.
Layer_Neuron
[
i
])]
for
i
in
g
.
Layer_Neuron
if
i
!=
"
Input
"
}
for
element
in
elements
:
...
...
@@ -611,7 +612,7 @@ class callbacks(callbacksOp):
heatmaps
=
[{
"
data
"
:[
go
.
Heatmap
(
z
=
matrix
[
layer
],
colorscale
=
'
Reds
'
,
customdata
=
indices
[
layer
],
hovertemplate
=
(
'
Neuron: %{customdata} <br>Spikes: %{z} <extra></extra>
'
),
xgap
=
4
,
ygap
=
4
)],
"
layout
"
:{
"
xaxis
"
:
dict
(
showgrid
=
False
,
zeroline
=
False
),
"
yaxis
"
:
dict
(
autorange
=
'
reversed
'
,
scaleanchor
=
'
x
'
,
showgrid
=
False
,
zeroline
=
False
),
"
margin
"
:{
'
l
'
:
0
,
'
r
'
:
0
,
'
t
'
:
5
,
'
b
'
:
0
},
"
uirevision
"
:
'
no reset of zoom
'
,
"
hoverlabel_align
"
:
'
right
'
}}
for
layer
in
super
.
AccumulatedSpikes2D
]
SpikesActivityPerInput
=
[
{
"
data
"
:[
go
.
Heatmap
(
z
=
super
.
Spike
s
ActivityPerInput
[
layer
],
colorscale
=
'
Reds
'
,
hovertemplate
=
(
'
Class: %{x} <br>Neuron: %{y} <br>Spikes: %{z} <extra></extra>
'
),
xgap
=
4
,
ygap
=
4
)],
"
layout
"
:{
"
xaxis
"
:
dict
(
title
=
"
Class
"
,
tickmode
=
"
array
"
,
zeroline
=
False
,
tickvals
=
[
i
for
i
in
range
(
g
.
nbrClasses
+
1
)]),
"
yaxis
"
:
dict
(
title
=
"
Neuron
"
,
zeroline
=
False
),
"
margin
"
:{
'
r
'
:
0
,
'
t
'
:
0
},
"
uirevision
"
:
'
no reset of zoom
'
}}
for
layer
in
super
.
SpikesActivityPerInput
]
SpikesActivityPerInput
=
[
make_
SpikeActivityPerInput
(
layer
,
labelData
)
for
layer
in
super
.
SpikesActivityPerInput
]
return
[
elements
,[],
heatmaps
,
SpikesActivityPerInput
]
else
:
...
...
@@ -628,7 +629,7 @@ class callbacks(callbacksOp):
heatmaps
=
[{
"
data
"
:[
go
.
Heatmap
(
z
=
matrix
[
layer
],
colorscale
=
'
Reds
'
,
customdata
=
indices
[
layer
],
hovertemplate
=
(
'
Neuron: %{customdata} <br>Spikes: %{z} <extra></extra>
'
),
xgap
=
4
,
ygap
=
4
)],
"
layout
"
:{
"
xaxis
"
:
dict
(
showgrid
=
False
,
zeroline
=
False
),
"
yaxis
"
:
dict
(
autorange
=
'
reversed
'
,
scaleanchor
=
'
x
'
,
showgrid
=
False
,
zeroline
=
False
),
"
margin
"
:{
'
l
'
:
0
,
'
r
'
:
0
,
'
t
'
:
5
,
'
b
'
:
0
},
"
uirevision
"
:
'
no reset of zoom
'
,
"
hoverlabel_align
"
:
'
right
'
}}
for
layer
in
super
.
AccumulatedSpikes2D
]
SpikesActivityPerInput
=
[
{
"
data
"
:[
go
.
Heatmap
(
z
=
super
.
Spike
s
ActivityPerInput
[
layer
],
colorscale
=
'
Reds
'
,
hovertemplate
=
(
'
Class: %{x} <br>Neuron: %{y} <br>Spikes: %{z} <extra></extra>
'
),
xgap
=
4
,
ygap
=
4
)],
"
layout
"
:{
"
xaxis
"
:
dict
(
title
=
"
Class
"
,
tickmode
=
"
array
"
,
zeroline
=
False
,
tickvals
=
[
i
for
i
in
range
(
g
.
nbrClasses
+
1
)]),
"
yaxis
"
:
dict
(
title
=
"
Neuron
"
,
zeroline
=
False
),
"
margin
"
:{
'
r
'
:
0
,
'
t
'
:
0
},
"
uirevision
"
:
'
no reset of zoom
'
}}
for
layer
in
super
.
SpikesActivityPerInput
]
SpikesActivityPerInput
=
[
make_
SpikeActivityPerInput
(
layer
,
labelData
)
for
layer
in
super
.
SpikesActivityPerInput
]
return
[
elements
,
f
"
Neuron
{
mouseOverNodeData
[
'
label
'
]
}
:
{
mouseOverNodeData
[
'
spikes
'
]
}
"
if
'
spikes
'
in
mouseOverNodeData
else
""
,
heatmaps
,
SpikesActivityPerInput
]
except
Exception
:
print
(
"
OnHover:
"
+
traceback
.
format_exc
())
...
...
@@ -691,7 +692,17 @@ class callbacks(callbacksOp):
else
:
res
.
append
(
getLoss
(
timestamp
,
g
.
updateInterval
))
return
res
def
make_SpikeActivityPerInput
(
layer
,
dataLabel
):
fig
=
make_subplots
(
rows
=
5
,
cols
=
1
,
shared_xaxes
=
True
,
vertical_spacing
=
0.08
,
specs
=
[[{
'
rowspan
'
:
4
}],[
None
],[
None
],[
None
],[{
'
rowspan
'
:
1
}]])
fig
.
add_trace
(
go
.
Heatmap
(
z
=
super
.
SpikesActivityPerInput
[
layer
],
colorscale
=
'
Reds
'
,
hovertemplate
=
(
'
Class: %{x} <br>Neuron: %{y} <br>Spikes: %{z} <extra></extra>
'
),
xgap
=
4
,
ygap
=
4
),
row
=
1
,
col
=
1
)
fig
.
update_layout
({
"
xaxis
"
:
dict
(
title
=
"
Class
"
,
tickmode
=
"
array
"
,
zeroline
=
False
,
tickvals
=
[
i
for
i
in
range
(
g
.
nbrClasses
+
1
)]),
"
yaxis
"
:
dict
(
title
=
"
Neuron
"
,
zeroline
=
False
),
"
margin
"
:{
'
l
'
:
0
,
'
r
'
:
0
,
'
t
'
:
5
,
'
b
'
:
0
},
"
uirevision
"
:
'
no reset of zoom
'
})
if
dataLabel
==
None
:
fig
.
add_trace
(
go
.
Bar
(
x
=
[],
y
=
[],
hovertemplate
=
(
'
Label: %{x} <br>Nbr: %{y} <extra></extra>
'
)),
row
=
5
,
col
=
1
)
else
:
fig
.
add_trace
(
go
.
Bar
(
x
=
list
(
dataLabel
[
0
].
keys
()),
y
=
list
(
dataLabel
[
0
].
values
()),
hovertemplate
=
(
'
Label: %{x} <br>Nbr: %{y} <extra></extra>
'
)),
row
=
5
,
col
=
1
)
fig
.
update_xaxes
(
tickvals
=
[
i
for
i
in
range
(
g
.
nbrClasses
+
1
)])
return
fig
# ---------------------------------------------------------
# MongoDB operations
# ---------------------------------------------------------
...
...
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