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