Update app.py
Browse files
app.py
CHANGED
@@ -194,6 +194,7 @@ with col_1:
|
|
194 |
with col_2:
|
195 |
st.markdown("<br style='margin:15px 0'>", unsafe_allow_html=True)
|
196 |
example = st.button("Example")
|
|
|
197 |
|
198 |
# with col_2:
|
199 |
# st.markdown("### Examples")
|
@@ -215,15 +216,18 @@ if uploaded_file is not None:
|
|
215 |
os.system(f'mkdir -p {uploaded_file.name.strip(".fits")}')
|
216 |
fname = uploaded_file.name.strip(".fits")
|
217 |
st.session_state['loaded'] = True
|
|
|
218 |
|
219 |
-
if
|
220 |
fname = "NGC4649_example"
|
221 |
data, wcs = load_file(f"{fname}.fits")
|
222 |
-
st.session_state['loaded'] =
|
|
|
223 |
|
224 |
if "data" not in locals():
|
225 |
data = np.zeros((128,128))
|
226 |
st.session_state['loaded'] = False
|
|
|
227 |
|
228 |
# Make six columns for buttons
|
229 |
_, col1, col2, col3, col4, col5, col6, _ = st.columns([bordersize,0.5,0.5,0.5,0.5,0.5,0.5,bordersize])
|
@@ -254,7 +258,7 @@ with col5: decompose = st.button('Decompose', key="decompose")
|
|
254 |
# Make two columns for plots
|
255 |
_, colA, colB, colC, _ = st.columns([bordersize,1,1,1,bordersize])
|
256 |
|
257 |
-
if st.session_state['loaded']:
|
258 |
# NORMALIZE IMAGE
|
259 |
MIN = np.min(np.where(data == 0, 1, data))
|
260 |
if MIN < 1: data = data / MIN
|
|
|
194 |
with col_2:
|
195 |
st.markdown("<br style='margin:15px 0'>", unsafe_allow_html=True)
|
196 |
example = st.button("Example")
|
197 |
+
st.markdown('<style>div.row-widget.stButton > div{margin-left: auto;}</style>', unsafe_allow_html=True)
|
198 |
|
199 |
# with col_2:
|
200 |
# st.markdown("### Examples")
|
|
|
216 |
os.system(f'mkdir -p {uploaded_file.name.strip(".fits")}')
|
217 |
fname = uploaded_file.name.strip(".fits")
|
218 |
st.session_state['loaded'] = True
|
219 |
+
st.session_state['example'] = False
|
220 |
|
221 |
+
if uploaded_file is not None) and :
|
222 |
fname = "NGC4649_example"
|
223 |
data, wcs = load_file(f"{fname}.fits")
|
224 |
+
st.session_state['loaded'] = False
|
225 |
+
st.session_state['example'] = True
|
226 |
|
227 |
if "data" not in locals():
|
228 |
data = np.zeros((128,128))
|
229 |
st.session_state['loaded'] = False
|
230 |
+
st.session_state['example'] = False
|
231 |
|
232 |
# Make six columns for buttons
|
233 |
_, col1, col2, col3, col4, col5, col6, _ = st.columns([bordersize,0.5,0.5,0.5,0.5,0.5,0.5,bordersize])
|
|
|
258 |
# Make two columns for plots
|
259 |
_, colA, colB, colC, _ = st.columns([bordersize,1,1,1,bordersize])
|
260 |
|
261 |
+
if st.session_state['loaded'] or st.session_state['example']:
|
262 |
# NORMALIZE IMAGE
|
263 |
MIN = np.min(np.where(data == 0, 1, data))
|
264 |
if MIN < 1: data = data / MIN
|