Unverified Commit 4b907b7c authored by Tammo Jan Dijkema's avatar Tammo Jan Dijkema
Browse files

Make resuming work

parent 071c69bb
......@@ -10,9 +10,11 @@ Tammo Jan Dijkema, 29 June 2020
import time
import matplotlib.pyplot as plt
import datetime
import sys
import zmq
import struct
import pandas as pd
import numpy as np
from telescope import Telescope
from astropy.coordinates import get_sun, SkyCoord, AltAz, EarthLocation, Angle
......@@ -54,8 +56,6 @@ dwl = EarthLocation(lon=Angle("6:23:46.21 degrees"),
plt.ion()
fig, ax = plt.subplots()
starttime = Time.now() + 2 * u.hour
#ax.set_ylim((0, None))
ax.set_xlabel("Lokale tijd (CEST)")
ax.set_ylabel("Signaalsterkte (ongekalibreerd)")
......@@ -66,12 +66,25 @@ prev_points = None
separation = None
maxsignal = 0.
file_dates = []
file_data_times = []
file_data = []
file_cal_times = []
file_caldata = []
starttime = Time.now() + 2 * u.hour
scatterplot = ax.scatter(file_dates, file_data, s=3, color='black')
calplot = ax.scatter(file_dates, file_caldata, s=3, color='lightgrey')
if len(sys.argv) > 1:
df = pd.read_csv(sys.argv[1], parse_dates=[0])
is_data = (df["tracker"] == 'suntracker') & \
(df["offset az (deg)"] < 0.01) & \
(df["offset el (deg)"] < 0.01)
file_data_times = (Time(df[is_data]["time (UTC)"]) + 2*u.hour).datetime
file_data = df[is_data]["signal"]
file_cal_times = (Time(df[~is_data]["time (UTC)"]) + 2*u.hour).datetime
file_caldata = df[~is_data]["signal"]
starttime = Time(df["time (UTC)"][0]) + 2 * u.hour
scatterplot = ax.scatter(file_data_times, file_data, s=3, color='black')
calplot = ax.scatter(file_cal_times, file_caldata, s=3, color='lightgrey')
ax.xaxis.set_major_formatter(mdates.DateFormatter('%H:%M'))
eclipse_starttime = Time("2021-06-10T11:21") + 2*u.hour
......@@ -85,7 +98,7 @@ if starttime < eclipse_endtime < starttime + 3*u.hour:
if len(sys.argv) == 1:
datafile = open(f"data{int(Time.now().unix)}.txt", "w")
print("Time (UTC),Tracker,Offset az (deg),Offset el(deg),azimuth from north (deg),elevation (deg),signal 70cm,signal 23cm", file=datafile)
print("time (UTC),tracker,offset az (deg),offset el (deg),azimuth from north (deg),elevation (deg),signal", file=datafile)
else:
datafile = open(f"{sys.argv[1]}", "a")
......@@ -97,12 +110,14 @@ while True:
now = Time.now()
print(now, dt.tracker.split("/")[-1], dt.offset_az.to(u.deg).value, dt.offset_el.to(u.deg).value, dt.az.to(u.deg).value, dt.el.to(u.deg).value, signal, flush=True, sep=',', file=datafile)
tracker = dt.tracker.split("/")[-1]
print(now, tracker, dt.offset_az.to(u.deg).value, dt.offset_el.to(u.deg).value, dt.az.to(u.deg).value, dt.el.to(u.deg).value, signal, flush=True, sep=',', file=datafile)
if signal > maxsignal:
maxsignal = signal
if dt.tracker == "console/suntracker" and dt.dist_az < 0.01 * u.deg and dt.dist_el < 0.01 * u.deg:
if tracker == "suntracker" and dt.dist_az < 0.01 * u.deg and dt.dist_el < 0.01 * u.deg:
plot_to_append_to = scatterplot
else:
plot_to_append_to = calplot
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment