From 075a03a6e61bd8c910742ef268631406f952c5b7 Mon Sep 17 00:00:00 2001 From: davidruddell <69439720+davidruddell@users.noreply.github.com> Date: Mon, 27 Feb 2023 14:09:37 -0700 Subject: [PATCH 1/3] Add files via upload --- "pages/1_\360\237\214\216_TLE_file.py" | 42 +++++++++++++++++++++ "\360\237\224\255_Home.py" | 51 ++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 "pages/1_\360\237\214\216_TLE_file.py" create mode 100644 "\360\237\224\255_Home.py" diff --git "a/pages/1_\360\237\214\216_TLE_file.py" "b/pages/1_\360\237\214\216_TLE_file.py" new file mode 100644 index 0000000..e256007 --- /dev/null +++ "b/pages/1_\360\237\214\216_TLE_file.py" @@ -0,0 +1,42 @@ +import streamlit as st +import time +import numpy as np + +st.set_page_config(page_title="Telescope App", page_icon="🔭", layout="wide") + +st.title("TLE File / Settings") +st.sidebar.header("TLE File / Settings") + +uploaded_file = st.file_uploader("Select TLE file", type=["tle"], accept_multiple_files=False) +if uploaded_file is not None: + for i in range(len(uploaded_file)): + head, sep, tail = str(uploaded_file[i].name).partition(".") + st.write("file name:"+str(head)) + st.write("file type:"+str(tail)) + st.write(uploaded_file) + +c1, c2, c3 = st.columns(3) + +with c1: + num_images = st.number_input('Number of images', min_value = 1, max_value=None, value=1, key = 1) + + expose_time = st.number_input('Expose time', min_value = 0.0, max_value=None, value=1.0, key = 2) + + max_visits_per_field = st.number_input('Max visits per field', min_value = 1, max_value=None, value=5, key = 3) + + st.write('') + st.write('Shutdown time') + +col1, col2, col3, col4, col5, col6, col7 = st.columns(7) +with col1: + hour = st.number_input('Hour (0-23)', min_value = 0, max_value=23, value=19, key = 4) + +with col2: + minute = st.number_input('Minute (0-59)', min_value = 0, max_value=59, value=35, key = 5) + + +st.write('Current number of images:', num_images) +st.write('Current expose time:', expose_time, 'seconds') +st.write('Current max visits per field:', max_visits_per_field) +st.write('Current hour:', hour) +st.write('Current minute:', minute) \ No newline at end of file diff --git "a/\360\237\224\255_Home.py" "b/\360\237\224\255_Home.py" new file mode 100644 index 0000000..6b96b6e --- /dev/null +++ "b/\360\237\224\255_Home.py" @@ -0,0 +1,51 @@ +import streamlit as st +import time +import numpy as np +from alpaca.telescope import * # Multiple Classes including Enumerations +from alpaca.exceptions import * # Or just the exceptions you want to catch +import streamlit as st + +st.set_page_config(page_title="Telescope App", page_icon="🔭") + +st.title("🔭 Telescope App") + +st.sidebar.header("TXT File / Launch") + + +uploaded_file = st.file_uploader("Select txt file", type=["txt"], accept_multiple_files=False) +if uploaded_file is not None: + for i in range(len(uploaded_file)): + head, sep, tail = str(uploaded_file[i].name).partition(".") + st.write("file name:"+str(head)) + st.write("file type:"+str(tail)) + st.write(uploaded_file) + +col1, col2, col3, col4, col5, col6, col7 = st.columns(7) +with col1: + if st.button('Launch'): + st.write('Launching!') + + +T = Telescope('host.docker.internal:80', 0) # Local Omni Simulator + +try: + T.Connected = True + print(f'Connected to {T.Name}') + print(T.Description) + T.Tracking = True # Needed for slewing (see below) + print('Starting slew...') + T.SlewToCoordinatesAsync(T.SiderealTime + 2, 50) # 2 hrs east of meridian + while(T.Slewing): + time.sleep(5) # What do a few seconds matter? + print('... slew completed successfully.') + print(f'RA={T.RightAscension} DE={T.Declination}') + print('Turning off tracking then attempting to slew...') + T.Tracking = False + T.SlewToCoordinatesAsync(T.SiderealTime + 2, 55) # 5 deg slew N + # This will fail for tracking being off + print("... you won't get here!") +except Exception as e: # Should catch specific InvalidOperationException + print(f'Slew failed: {str(e)}') +finally: # Assure that you disconnect + print("Disconnecting...") + T.Connected = False From 540983f40d7f6caf662c6fdd8dad134389fa36b2 Mon Sep 17 00:00:00 2001 From: davidruddell <69439720+davidruddell@users.noreply.github.com> Date: Mon, 27 Feb 2023 14:10:13 -0700 Subject: [PATCH 2/3] =?UTF-8?q?Delete=20=F0=9F=8F=A0=5FHome.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "\360\237\217\240_Home.py" | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 "\360\237\217\240_Home.py" diff --git "a/\360\237\217\240_Home.py" "b/\360\237\217\240_Home.py" deleted file mode 100644 index 14893d2..0000000 --- "a/\360\237\217\240_Home.py" +++ /dev/null @@ -1,31 +0,0 @@ -import streamlit as st - -st.title("Telescope App") - -import time -from alpaca.telescope import * # Multiple Classes including Enumerations -from alpaca.exceptions import * # Or just the exceptions you want to catch - -T = Telescope('host.docker.internal:80', 0) # Local Omni Simulator - -try: - T.Connected = True - print(f'Connected to {T.Name}') - print(T.Description) - T.Tracking = True # Needed for slewing (see below) - print('Starting slew...') - T.SlewToCoordinatesAsync(T.SiderealTime + 2, 50) # 2 hrs east of meridian - while(T.Slewing): - time.sleep(5) # What do a few seconds matter? - print('... slew completed successfully.') - print(f'RA={T.RightAscension} DE={T.Declination}') - print('Turning off tracking then attempting to slew...') - T.Tracking = False - T.SlewToCoordinatesAsync(T.SiderealTime + 2, 55) # 5 deg slew N - # This will fail for tracking being off - print("... you won't get here!") -except Exception as e: # Should catch specific InvalidOperationException - print(f'Slew failed: {str(e)}') -finally: # Assure that you disconnect - print("Disconnecting...") - T.Connected = False \ No newline at end of file From ee90b4478acbb335fe8b69a95c9de12bed083002 Mon Sep 17 00:00:00 2001 From: davidruddell <69439720+davidruddell@users.noreply.github.com> Date: Mon, 27 Feb 2023 14:23:05 -0700 Subject: [PATCH 3/3] Add files via upload --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index abdc752..4116fc4 100644 --- a/README.md +++ b/README.md @@ -1 +1,11 @@ -# ascom-ui \ No newline at end of file +# ascom-ui + +cd into /ascom-ui +then use the command: docker compose -f docker-compose.yml up --build + +then command: docker build -t davidruddell/ascom-streamlit:latest . + +now we run the streamlit app +use command: docker run --rm -e PYTHONUNBUFFERED=1 -p 8501:8501 davidruddell/ascom-streamlit:latest + +to accesss streamlit app, on google go to localhost:8501 \ No newline at end of file