Revision 9326d33d
Added by Pierre-Loïc Garoche over 1 year ago
share/lustrev-plot.py | ||
---|---|---|
30 | 30 |
init_signals = init_df['varid'].unique() |
31 | 31 |
init_signals_option = [{'label': i, 'value': i} for i in init_signals] |
32 | 32 |
|
33 |
# TODO: retravailler le cas bool3 pour voir si on a des infos partitionnees |
|
34 |
# TODO: generer une vrai figure par signal |
|
33 | 35 |
# TODO: extraire les suffixes de contexte booleens pour construire, pour chaque signal, la liste des signaux de partitionnement |
34 | 36 |
|
35 | 37 |
|
... | ... | |
100 | 102 |
# # return fig |
101 | 103 |
|
102 | 104 |
|
103 |
def onesigfig(fig, signal_df, name,row,col):
|
|
105 |
def onesigfig(fig,signal_df,name,row,col):
|
|
104 | 106 |
color='rgba(0,250,0,0.4)' |
105 | 107 |
x, y_min, y_max = 'timestep', 'min', 'max' |
106 |
|
|
108 |
type=signal_df['type'].unique() |
|
107 | 109 |
fig.add_traces( |
108 | 110 |
go.Scatter( |
109 | 111 |
x = signal_df[x], |
... | ... | |
136 | 138 |
name=name+'_min'), |
137 | 139 |
rows=row, |
138 | 140 |
cols=col) |
139 |
# fig.update_yaxes(type='linear') |
|
141 |
if type != 'bool': |
|
142 |
fig.update_yaxes(type='linear') |
|
140 | 143 |
return fig |
141 | 144 |
# fig.add_traces(go.Scatter(x = signal_df[x], y = signal_df[y_min], |
142 | 145 |
# line = dict(color='rgba(0,0,0,0)'))) |
... | ... | |
167 | 170 |
# Changing dropdown menu or same/split view updates the figure |
168 | 171 |
@app.callback( |
169 | 172 |
Output("graph", "figure"), |
173 |
Output('selected-data', 'children'), |
|
170 | 174 |
[Input("signal_sel", "value"), |
171 | 175 |
Input("sameplotcheck", "value"), |
172 | 176 |
Input("global_df", 'children') |
... | ... | |
179 | 183 |
color='rgba(0,250,0,0.4)' |
180 | 184 |
x, y_min, y_max = 'timestep', 'min', 'max' |
181 | 185 |
if selection is None or selection == [] or jsonified == None: |
182 |
return {} |
|
186 |
return {}, None
|
|
183 | 187 |
#selection=signals |
184 | 188 |
else: |
185 | 189 |
df=pd.read_json(jsonified, orient='split') |
... | ... | |
201 | 205 |
row_id=idx+1 |
202 | 206 |
onesigfig(fig,signal_df,sig,row_id,1) |
203 | 207 |
fig.update_layout(height=300 * nb_rows) |
204 |
return fig |
|
208 |
signals_data=df.query("varid in " + str(selection)) |
|
209 |
data=extract_selection(signals_data) |
|
210 |
return fig, data |
|
205 | 211 |
|
206 | 212 |
# Changing global_df or choice of types updates dropdown menu |
207 | 213 |
@app.callback(Output("signal_sel", "options"), |
208 | 214 |
Output("signal_sel", "value"), |
209 |
Output('selected-data', 'children'), |
|
210 | 215 |
Input("global_df", 'children'), |
211 | 216 |
Input('typesel', 'value') |
212 | 217 |
) |
... | ... | |
218 | 223 |
signals_data=df.query('type in ' +str(typesel)) |
219 | 224 |
signals=signals_data['varid'].unique() |
220 | 225 |
signals_options=[{'label': i, 'value': i} for i in signals] |
221 |
data=extract_selection(signals_data) |
|
222 |
return signals_options, signals, data |
|
226 |
return signals_options, signals |
|
223 | 227 |
|
224 | 228 |
|
225 | 229 |
def parse_contents(contents, filename, date): |
Also available in: Unified diff
Better handling of python web-based signal viewer