KVL_visualize / app.py
chanschan's picture
add file conversion KVL to XYZ
b477385
import streamlit as st
st.set_page_config(layout="wide", page_title='Kvl Visualisation')
from load_css import local_css
# import pandas as pd
# Local Imports
import home
# import raw_data
import plotting
import header
import read_kvl_file as kvl
import output_xyz
# import plotly.express as px
# from io import StringIO
local_css("style.css")
@st.cache_data
def load_data(uploaded_file):
if uploaded_file is not None:
try:
data=kvl.read_kvl_file(uploaded_file)
except UnicodeDecodeError as e:
st.error(f"error loading log.kvl: {e}")
else:
data=None
return data
# Sidebar Options & File Uplaod
kvl_file=None
st.sidebar.write('# KVL Data Visualisation')
st.sidebar.write('To begin using the app, load your KVL file using the file upload option below.')
path = st.sidebar.file_uploader('Choose a kvl files', accept_multiple_files=True, type=['.kvl'])
for uploadfile in path:
#uploadedfile =
kvl_file = load_data(uploadfile)
if kvl_file:
st.sidebar.success('File Uploaded Successfully')
st.sidebar.write(f'<b>Keys Name</b>: {kvl_file.keys()}',unsafe_allow_html=True)
# Sidebar Navigation
st.sidebar.title('Navigation')
options = st.sidebar.radio('Select a page:',
['Home', 'Keys Information', 'Data Visualisation', 'Convert KVL to XYZ',
])
if options == 'Home':
home.home()
elif options == 'Keys Information':
header.header(kvl_file)
# elif options == 'Data Information':
# raw_data.raw_data(kvl_file)
elif options == 'Data Visualisation':
plotting.plot(kvl_file)
elif options == 'Convert KVL to XYZ':
output_xyz.output_xyz(kvl_file)