Hello, I am writing my first web app using Streamlit, and I hit a wall.
The error I am getting is :
AttributeError: 'str' object has no attribute 'sensor'
Here is the full code:
import streamlit as st
#import utility as util
#import device as dev
from streamlit_option_menu import option_menu
with st.sidebar:
selected = option_menu(
menu_title= "Exposure time calculator",
options=['Target', 'Camera', 'Telescope','Results'],
)
if selected == 'Target':
desiredSNR = st.number_input('Desired Signal to Noise Ratio (band)', key = 'desiredSNR', min_value=1.0, max_value=100.0, value =20.0, step=0.1 )
targetMagnitude = st.number_input('Target magnitude (mag)', key = 'targetMagnitude',min_value=1.0, max_value=50.0, value =24.0, step=0.1 )
skytMagnitude = st.number_input('Sky magnitude (mag)', key = 'skyMagnitude', min_value=1.0, max_value=50.0, value =20.88, step=0.1 )
angleZenith = st.number_input('Angle from Zenith (degree)', key = 'agnleZenith', min_value=1.0, max_value=90.0, value =20.0, step=0.1 )
seeing = st.number_input('Seeing (arcsec)', key = 'seeing',min_value=1.0, max_value=50.0, value =2.2, step=0.1 )
elif selected == 'Camera':
sensorList = ['ccdKAF16200','ccdKAF8300','ccdKAF11002','cmosIMX455','cmosIMX571','cmosIMX183','cmosPMN34230','cmosIMX533','ccdICX694']
filterList = ['B','V','R','I','Luminance','Hydrogen \u03B1 3nm','Hydrogen \u03B2 5nm','Oxygen III 3nm','Sulphur II 3nm']
sensorOption = st.selectbox('Select sensor', sensorList, key = 'sensor')
binnig = st.number_input('Bin', key = 'bin', min_value = 0.0, max_value = 10.0, value = 1.0, step= 1.0 )
filterOption = st.selectbox('Select Filter', filterList, key = 'filter')
elif selected == 'Telescope':
aperture = st.number_input('Aperture', min_value=1.0, max_value=10000.0, value =203.0, step=1.0 )
focalLength = st.number_input('Focal length', min_value=1.0, max_value=50000.0, value = 1333.0, step=1.0 )
centralObstruction = st.number_input('Central obstruction (mm)', min_value=0.0, max_value=5000.0, value =0.0, step=1.0 )
mirror1 = st.number_input('1st mirror reflectivity', min_value=0.0, max_value=1.0, value =0.98, step=0.1 )
mirror2 = st.number_input('2nd mirror reflectivity', min_value=0.0, max_value=1.0, value =0.98, step=0.1 )
elif selected == 'Results':
targetComputation = st.selectbox('Select source for computation', ('Extended source','Point source'))
if targetComputation == 'Extended source':
st.write('Camera selected', st.session_state.sensor)
st.write('Filter selected', st.session_state.filter)