From e914004cc213168e2f924a7fde9b48450c4daaa2 Mon Sep 17 00:00:00 2001 From: Le Stagiaire Date: Tue, 28 May 2024 11:56:09 +0200 Subject: [PATCH] feat: Update A-Scan filters page with new options and input field --- 3D_app/pages/ascan.py | 59 +++++++++++++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 14 deletions(-) diff --git a/3D_app/pages/ascan.py b/3D_app/pages/ascan.py index 22d4b83..a714734 100644 --- a/3D_app/pages/ascan.py +++ b/3D_app/pages/ascan.py @@ -12,16 +12,16 @@ dash.register_page( ) # on définit le dossier et les fichiers à lire -# dossier = "Dataset/Shear_transform" -# fichiers_selectionnes = [ -# "Shear_x001-x101_y{:03d}_Rot00_transform.csv".format(i) for i in range(10, 14) -# ] +dossier = "Dataset/Shear_transform" +fichiers_selectionnes = [ + "Shear_x001-x101_y{:03d}_Rot00_transform.csv".format(i) for i in range(10, 14) +] # on charge le fichier numpy fichiers = np.load("Dataset/npy/3D_Dataset_Long_Wave_Rot00.npy") # on lit les fichiers et on les met dans un tableau -pre_volume = np.array(fichiers) +pre_volume = np.array(lire_fichier_csv(dossier, fichiers_selectionnes)) volume = pre_volume[:, ::32, :] dim_z, dim_x, dim_y = volume.shape @@ -43,13 +43,31 @@ configAScan = { layout = html.Div( [ - dbc.Select( - id="select-ascan-filter", - options=[ - {"label": "Option 1", "value": "1"}, - {"label": "Option 2", "value": "2"}, - ], - style={"margin-bottom": "15px"}, + dbc.Row( + [ + dbc.Col( + [ + dbc.Select( + id="select-ascan-filter", + options=[ + {"label": "Option 1", "value": "1"}, + {"label": "Option 2", "value": "2"}, + ], + style={"margin-bottom": "15px"}, + ), + ] + ), + dbc.Col( + [ + dbc.Button( + id="button-validate-filter", + children="Valider", + color="primary", + style={"marginBottom": "15px"}, + ), + ] + ), + ] ), dbc.Checklist( options=[ @@ -73,6 +91,13 @@ layout = html.Div( str(i): str(i) for i in range(1, dim_x + 1, max(1, int(dim_x / 20))) }, ), + dbc.Input( + id="input-ascan-solo", + type="number", + placeholder="Valeurs", + step=0.1, + style={"marginTop": "15px"}, + ), ], style={"padding": "20px"}, ) @@ -81,9 +106,15 @@ layout = html.Div( # callback to update the heatmap @callback( Output("heatmap-ascan-solo", "figure"), - [Input("select-ascan-filter", "value"), Input("layer-slider-ascan-solo", "value"), Input("absolute-values-ascan", "value")], + [ + Input("select-ascan-filter", "value"), + Input("layer-slider-ascan-solo", "value"), + Input("absolute-values-ascan", "value"), + Input("button-validate-filter", "n_clicks"), + Input("input-ascan-solo", "value"), + ], ) -def update_heatmap_ascan(value, layer, absolute_values): +def update_heatmap_ascan(filter, layer, absolute_values, n_clicks, input_value): # TODO: implement the filter fig = px.line(y=volume[layer - 1, :, 5], title="A-scan")