Plsek commited on
Commit
17c52a0
·
1 Parent(s): 0012f0e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -149,7 +149,7 @@ with col:
149
  st.markdown("Input images should be centred at the centre of the galaxy and point sources should be filled with surrounding background ([dmfilth](https://cxc.cfa.harvard.edu/ciao/ahelp/dmfilth.html)).")
150
  st.markdown("If you use this tool for your research, please cite [Plšek et al. 2023](https://arxiv.org/abs/2304.05457)")
151
 
152
- _, col_1, col_2, _ = st.columns([bordersize, 2.5, 0.5, bordersize])
153
 
154
  with col_1:
155
  # Create file uploader widget
@@ -158,8 +158,8 @@ with col_1:
158
  with col_2:
159
  example = st.button("Example")
160
 
161
- def change_state(b):
162
- st.session_state.value = 0.0
163
 
164
  # If file is uploaded, read in the data and plot it
165
  if uploaded_file is not None:
@@ -179,7 +179,7 @@ if uploaded_file is not None:
179
  # st.markdown("<style>{margin-top: -26px;}</style>", unsafe_allow_html=True)
180
  st.markdown("<br style='margin:-44px 0'>", unsafe_allow_html=True)
181
  max_scale = int(data.shape[0] // 128)
182
- scale = st.selectbox('Scale:',[f"{(i+1)*128}x{(i+1)*128}" for i in range(max_scale)], label_visibility="hidden", on_change=change_state)
183
  scale = int(scale.split("x")[0]) // 128
184
 
185
  # Detect button
@@ -189,7 +189,10 @@ if uploaded_file is not None:
189
  with col4:
190
  st.markdown("")
191
  # st.markdown("""<style>[data-baseweb="select"] {margin-top: -36px;}</style>""", unsafe_allow_html=True)
192
- threshold = st.slider("Threshold", 0.0, 1.0, st.session_state.value, 0.05) #, label_visibility="hidden")
 
 
 
193
 
194
  # Decompose button
195
  with col5: decompose = st.button('Decompose', key="decompose")
 
149
  st.markdown("Input images should be centred at the centre of the galaxy and point sources should be filled with surrounding background ([dmfilth](https://cxc.cfa.harvard.edu/ciao/ahelp/dmfilth.html)).")
150
  st.markdown("If you use this tool for your research, please cite [Plšek et al. 2023](https://arxiv.org/abs/2304.05457)")
151
 
152
+ _, col_1, _, col_2, _ = st.columns([bordersize, 2.0, 0.5, 0.5, bordersize])
153
 
154
  with col_1:
155
  # Create file uploader widget
 
158
  with col_2:
159
  example = st.button("Example")
160
 
161
+ default_scale = 1
162
+ default_threshold = 0
163
 
164
  # If file is uploaded, read in the data and plot it
165
  if uploaded_file is not None:
 
179
  # st.markdown("<style>{margin-top: -26px;}</style>", unsafe_allow_html=True)
180
  st.markdown("<br style='margin:-44px 0'>", unsafe_allow_html=True)
181
  max_scale = int(data.shape[0] // 128)
182
+ scale = st.selectbox('Scale:',[f"{(i+1)*128}x{(i+1)*128}" for i in range(max_scale)], label_visibility="hidden")
183
  scale = int(scale.split("x")[0]) // 128
184
 
185
  # Detect button
 
189
  with col4:
190
  st.markdown("")
191
  # st.markdown("""<style>[data-baseweb="select"] {margin-top: -36px;}</style>""", unsafe_allow_html=True)
192
+ threshold = st.slider("Threshold", 0.0, 1.0, 0.0, 0.05) #, label_visibility="hidden")
193
+
194
+ if scale != default_scale:
195
+ threshold = default_threshold
196
 
197
  # Decompose button
198
  with col5: decompose = st.button('Decompose', key="decompose")