Update app.py
Browse files
app.py
CHANGED
|
@@ -209,20 +209,21 @@ with col_2:
|
|
| 209 |
# uploaded_file = "NGC5813_example.fits"
|
| 210 |
|
| 211 |
# If file is uploaded, read in the data and plot it
|
|
|
|
| 212 |
if uploaded_file is not None:
|
| 213 |
data, wcs = load_file(uploaded_file)
|
| 214 |
os.system(f'mkdir -p {uploaded_file.name.strip(".fits")}')
|
| 215 |
fname = uploaded_file.name.strip(".fits")
|
| 216 |
-
|
| 217 |
|
| 218 |
if example:
|
| 219 |
fname = "NGC4649_example"
|
| 220 |
data, wcs = load_file(f"{fname}.fits")
|
| 221 |
-
|
| 222 |
|
| 223 |
if "data" not in locals():
|
| 224 |
data = np.zeros((128,128))
|
| 225 |
-
|
| 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,7 +254,7 @@ with col5: decompose = st.button('Decompose', key="decompose")
|
|
| 253 |
# Make two columns for plots
|
| 254 |
_, colA, colB, colC, _ = st.columns([bordersize,1,1,1,bordersize])
|
| 255 |
|
| 256 |
-
if
|
| 257 |
# NORMALIZE IMAGE
|
| 258 |
MIN = np.min(np.where(data == 0, 1, data))
|
| 259 |
if MIN < 1: data = data / MIN
|
|
|
|
| 209 |
# uploaded_file = "NGC5813_example.fits"
|
| 210 |
|
| 211 |
# If file is uploaded, read in the data and plot it
|
| 212 |
+
|
| 213 |
if uploaded_file is not None:
|
| 214 |
data, wcs = load_file(uploaded_file)
|
| 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 example:
|
| 220 |
fname = "NGC4649_example"
|
| 221 |
data, wcs = load_file(f"{fname}.fits")
|
| 222 |
+
st.session_state['loaded'] = True
|
| 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 |
# 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
|