From c8b763f784b1cb4253e7d1b16231e6057c8b4bea Mon Sep 17 00:00:00 2001 From: hammouda <hammoudae@gmail.com> Date: Wed, 8 Jun 2022 22:27:59 +0200 Subject: [PATCH] Layout updated --- requirements.txt | 1 + src/Modules/Neuron/callbacks.py | 34 ++++++++++++++++++++++++-------- src/Modules/Synapse/callbacks.py | 17 ++++++++++------ src/Modules/Synapse/layout.py | 7 +++---- 4 files changed, 41 insertions(+), 18 deletions(-) diff --git a/requirements.txt b/requirements.txt index b0fecfc..c4bf4df 100755 --- a/requirements.txt +++ b/requirements.txt @@ -13,3 +13,4 @@ dash-daq==0.5.0 Flask-Login==0.6.0 wheel==0.37.1 werkzeug==2.1.1 +PyArrow diff --git a/src/Modules/Neuron/callbacks.py b/src/Modules/Neuron/callbacks.py index 01f55b7..2043d07 100755 --- a/src/Modules/Neuron/callbacks.py +++ b/src/Modules/Neuron/callbacks.py @@ -445,7 +445,10 @@ class callbacks(callbacksOp): margin={'l': 40, 'r': 0, 't': 0, 'b': 35}, uirevision='no reset of zoom', yaxis={'title': 'Number of Spikes'}, - xaxis={'title': 'Step'} + xaxis={'title': 'Step'}, + paper_bgcolor= "rgba(255, 255, 255,0)", + plot_bgcolor= "rgba(255, 255, 255,0)" + )} else: if str(index) not in yAxisList: @@ -466,7 +469,9 @@ class callbacks(callbacksOp): margin={'l': 40, 'r': 0, 't': 0, 'b': 35}, uirevision='no reset of zoom', yaxis={'title': 'Number of Spikes'}, - xaxis={'title': 'Step'} + xaxis={'title': 'Step'}, + paper_bgcolor= "rgba(255, 255, 255,0)", + plot_bgcolor= "rgba(255, 255, 255,0)" )} else: return {'data': [ @@ -483,7 +488,9 @@ class callbacks(callbacksOp): margin={'l': 40, 'r': 0, 't': 0, 'b': 35}, uirevision='no reset of zoom', yaxis={'title': 'Number of Spikes'}, - xaxis={'title': 'Step'} + xaxis={'title': 'Step'}, + paper_bgcolor= "rgba(255, 255, 255,0)", + plot_bgcolor= "rgba(255, 255, 255,0)" )} except Exception as e: print("spikeCountDrawGraph: "+str(e)) @@ -532,8 +539,9 @@ class callbacks(callbacksOp): margin={'l': 40, 'r': 0, 't': 0, 'b': 35}, uirevision='no reset of zoom', yaxis={'title': 'Potential'}, - xaxis={'title': 'Step'} - + xaxis={'title': 'Step'}, + paper_bgcolor= "rgba(255, 255, 255,0)", + plot_bgcolor= "rgba(255, 255, 255,0)" )} else: if str(index) not in yAxisList: @@ -560,7 +568,9 @@ class callbacks(callbacksOp): margin={'l': 40, 'r': 0, 't': 0, 'b': 35}, uirevision='no reset of zoom', yaxis={'title': 'Potential'}, - xaxis={'title': 'Step'} + xaxis={'title': 'Step'}, + paper_bgcolor= "rgba(255, 255, 255,0)", + plot_bgcolor= "rgba(255, 255, 255,0)" )} else: if str(index) not in yAxisList: @@ -581,7 +591,9 @@ class callbacks(callbacksOp): margin={'l': 40, 'r': 0, 't': 0, 'b': 35}, uirevision='no reset of zoom', yaxis={'title': 'Potential'}, - xaxis={'title': 'Step'} + xaxis={'title': 'Step'}, + paper_bgcolor= "rgba(255, 255, 255,0)", + plot_bgcolor= "rgba(255, 255, 255,0)" )} except Exception as e: print("neuronPotentialDrawGraph: "+str(e)) @@ -630,6 +642,8 @@ class callbacks(callbacksOp): visible=False ) ), + paper_bgcolor= "rgba(255, 255, 255,0)", + plot_bgcolor= "rgba(255, 255, 255,0)", showlegend=False, margin={'l': 0, 'r': 0, 't': 25, 'b': 30}, ) @@ -649,6 +663,8 @@ class callbacks(callbacksOp): visible=True ) ), + paper_bgcolor= "rgba(255, 255, 255,0)", + plot_bgcolor= "rgba(255, 255, 255,0)", showlegend=False, margin={'l': 0, 'r': 0, 't': 25, 'b': 30}, ) @@ -666,7 +682,9 @@ class callbacks(callbacksOp): polar=dict( radialaxis=dict( visible=True - ) + ), + paper_bgcolor= "rgba(255, 255, 255,0)", + plot_bgcolor= "rgba(255, 255, 255,0)" ), showlegend=False, margin={'l': 0, 'r': 0, 't': 25, 'b': 30}, diff --git a/src/Modules/Synapse/callbacks.py b/src/Modules/Synapse/callbacks.py index 99e63de..6206a7c 100755 --- a/src/Modules/Synapse/callbacks.py +++ b/src/Modules/Synapse/callbacks.py @@ -7,9 +7,8 @@ import time from dash.dependencies import Input, Output, State, MATCH, ALL import dash import pymongo -import dash_html_components as html +from dash import dcc, html import dash_daq as daq -import dash_core_components as dcc from bson.json_util import loads from bson.json_util import dumps from dash.exceptions import PreventUpdate @@ -304,8 +303,7 @@ class callbacks(callbacksOp): "type": "Synapse-frequency-switch"}, on='True', size=25, color="#28a745", style={"marginLeft": "10px"}), html.Div("−", className="btn-danger btn-circle", style={"fontWeight": "500","fontSize":"16px", "marginLeft": "10px"}, id={"index": str(index), "type": "DeleteComponent"}), - html.P(layer+" Neuron "+neuron, style={"fontSize": "13px", "paddingTop": "6px", - "marginRight": "10px", "marginLeft": "10px"})], className="row", style={"height": "35px"}), + html.Div([html.Span(layer+" N: "+neuron, style={"fontSize": "13px", "paddingTop": "10px", "marginRight": "10px"}, className="badge alert-info")], className="d-flex", style={"direction": "rtl", "width": "100%"})], className="d-flex", style={"height": "35px"}), dcc.Graph(id={"index": str(index), "type": "SynapseFreqGraph", "layer": layer, "neuron": neuron}, style={ "width": "100%", "height": "290px"}, className="col-12", animate=False, config={"displaylogo": False}), ], className="col-lg-6 col-sm-12 col-xs-12"), @@ -317,7 +315,7 @@ class callbacks(callbacksOp): id={"index": str(index), "type": "Synapse-HeatMap-switch", "layer": layer, "neuron": neuron}, on='True', size=25, color="#28a745", style={"marginLeft": "10px"} - )], className="row", style={"height": "35px", "direction": "rtl", "paddingRight": "30px"}), + )], className="d-flex", style={"height": "35px", "direction": "rtl", "paddingRight": "30px"}), dcc.Graph(id={"index": str(index), "type": "Heatmap", "layer": layer, "neuron": neuron}, style={"width": "100%", "height": "290px"}, className="col-12", animate=False, config={"displaylogo": False}), ], className="col-lg-6 col-sm-12 col-xs-12") ], className="row", style={"margin": "10px"}) @@ -471,6 +469,8 @@ class callbacks(callbacksOp): uirevision='no reset of zoom', yaxis={'title': 'Mean Synapses Potential', 'range': [0, 1]}, + paper_bgcolor= "rgba(255, 255, 255,0)", + plot_bgcolor= "rgba(255, 255, 255,0)", xaxis={'title':'Step'} )} else: @@ -521,6 +521,8 @@ class callbacks(callbacksOp): uirevision='no reset of zoom', yaxis={'title': 'Mean Synapses Potential', 'range': [0, 1]}, + paper_bgcolor= "rgba(255, 255, 255,0)", + plot_bgcolor= "rgba(255, 255, 255,0)", xaxis={'title':'Step'} )} else: @@ -558,6 +560,8 @@ class callbacks(callbacksOp): uirevision='no reset of zoom', yaxis={'title': 'Mean Synapses Potential', 'range': [0, 1]}, + paper_bgcolor= "rgba(255, 255, 255,0)", + plot_bgcolor= "rgba(255, 255, 255,0)", xaxis={'title': 'Step'} )} except Exception as e: @@ -591,7 +595,8 @@ class callbacks(callbacksOp): yaxis={"autorange": "reversed"}, xaxis={'showticklabels': False,"ticks":"inside"}, width=400, height=300, - paper_bgcolor= "rgba(255, 255, 255,0)") + paper_bgcolor= "rgba(255, 255, 255,0)", + plot_bgcolor= "rgba(255, 255, 255,0)") if isOn: if data != None: data.sort(key=lambda d: d["C"]) diff --git a/src/Modules/Synapse/layout.py b/src/Modules/Synapse/layout.py index d2f8e6a..78ba9f2 100755 --- a/src/Modules/Synapse/layout.py +++ b/src/Modules/Synapse/layout.py @@ -2,10 +2,9 @@ """ from collections import deque -import dash_html_components as html +from dash import dcc, html import dash_bootstrap_components as dbc from .callbacks import callbacks -import dash_core_components as dcc from src.templates.layoutOp import layoutOp class layout(layoutOp): @@ -72,10 +71,10 @@ class layout(layoutOp): style={"width":"80px","marginLeft":"10px","textAlign":"center"}), html.P("X",style={"padding":"5px"}), dbc.Input(type="number",id="HeatMapY",value=28, min=0, step=1, - style={"width":"80px","textAlign":"center"})], className="row",style={"marginLeft":"3px"}) + style={"width":"80px","textAlign":"center"})], className="d-flex",style={"marginLeft":"3px"}) ,html.Div(id='clear-Synapse',children="False", style={'display': 'none'}) ,html.Div(id='display-Synapse',children="False", style={'display': 'none'}) - ], className="row"), + ], className="d-flex"), dbc.Card( dbc.CardBody([dbc.Card([dbc.CardHeader( dbc.Button( "Layer HeatMap", color="none", id=f"group-GlobalHeatMapAreaSynapse-toggle", -- GitLab