diff --git a/pages/1-samples_selection.py b/pages/1-samples_selection.py index 63e4a436644531c789c81c7b2fb2f0bda1e16661..f7ca85a711670eb96b111bc3c5b0035f2639f931 100644 --- a/pages/1-samples_selection.py +++ b/pages/1-samples_selection.py @@ -6,6 +6,8 @@ from Class_Mod.DATA_HANDLING import * ################################### Data Loading and Visualization ######################################## container1 = st.container(border=True) col2, col1 = st.columns([3, 1]) +col1.header("Data Loading", divider='blue') +col2.header("Spectral Data Visualization", divider='blue') container2 = st.container(border=True) @@ -15,8 +17,6 @@ influence, hotelling, qexp = st.columns([2, 2, 1]) with container1: - col1.header("Data Loading", divider='blue') - col2.header("Spectral Data Visualization", divider='blue') # loader for csv file containing NIRS spectra sselectx_csv = col1.file_uploader("Load NIRS Data", type=["csv","dx"], help=" :mushroom: select a csv matrix with samples as rows and lambdas as columns", key=5) if sselectx_csv is not None: @@ -59,9 +59,10 @@ with container1: data = DxRead(path = tmp_path) data_import = data.specs_df_ st.success("The data have been loaded successfully", icon="✅") + ## Visualize spectra - + with col2: fig, ax = plt.subplots(figsize = (30,7)) data_import.T.plot(legend=False, ax = ax, color = 'blue') @@ -85,11 +86,10 @@ with container1: ###################################################################################### ############################## Exploratory data analysis ############################### +plot_type=['', 'PCA','UMAP', 'NMF'] +cluster_methods = ['', 'Kmeans','UMAP', 'AP'] with container2: if sselectx_csv is not None: - plot_type=['', 'PCA','UMAP', 'NMF'] - cluster_methods = ['', 'Kmeans','UMAP', 'AP'] - with pc: type_plot = st.selectbox("Dimensionality reduction techniques: ", options=plot_type, key=37) type_cluster = st.selectbox("Clustering techniques: ", options=cluster_methods, key=38) @@ -128,8 +128,15 @@ with container2: else: - fig = px.scatter_3d(t, x=axis1, y=axis2, z = axis3) - fig.update_traces(marker=dict(size=4)) + if test == '.dx': + filter = ['origin', 'date', 'time', 'spectrometer/data system'] + col = st.selectbox('filter', options= filter) + + fig = px.scatter_3d(t, x=axis1, y=axis2, z = axis3, color = data.md_df_[col]) + fig.update_traces(marker=dict(size=4)) + else: + fig = px.scatter_3d(t, x=axis1, y=axis2, z = axis3 ) + fig.update_traces(marker=dict(size=4)) st.plotly_chart(fig) diff --git a/pages/3-prediction.py b/pages/3-prediction.py index e7f32f7cf795fbc0caa18aef6a68b1e36e360aff..6fba85144e3d85863dd387de395e755954e6869f 100644 --- a/pages/3-prediction.py +++ b/pages/3-prediction.py @@ -42,7 +42,7 @@ if NIRS_csv: if index: idx = pd.read_csv(index, sep=';', index_col=0).iloc[:,0].to_numpy() -result = '' +#result = '' if st.button("Predict"): if s: