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

Make quit work, prettify axes

parent 0135e4c9
......@@ -38,7 +38,8 @@ def signal_thread():
global signal
context = zmq.Context()
receiver = context.socket(zmq.PULL)
receiver.connect("tcp://mercurius.dt.camras.nl:5557")
#receiver.connect("tcp://mercurius.dt.camras.nl:5557")
receiver.connect("tcp://localhost:5557")
while True:
buff = receiver.recv()
signal = np.frombuffer(buff, dtype="float32")[-1]
......@@ -60,11 +61,19 @@ dwl = EarthLocation(lon=Angle("6:23:46.21 degrees"),
plt.ion()
fig, ax = plt.subplots()
stoprequest = False
def set_stoprequest(event):
global stoprequest
stoprequest = True
#ax.set_ylim((0, None))
ax.set_xlabel("Lokale tijd (CEST)")
ax.set_ylabel("Signaalsterkte (ongekalibreerd)")
ax.set_ylabel("(Radio) Helderheid van de zon\n← Minder helder Helderder →")
ax.set_yticks([])
fig.canvas.set_window_title('Live radiowaarneming gedeeltelijke zonsverduistering')
ax.set_title('Live radiowaarneming gedeeltelijke zonsverduistering')
fig.canvas.mpl_connect('close_event', set_stoprequest)
prev_points = None
separation = None
......@@ -122,7 +131,7 @@ else:
# Append to existing file
datafile = open(f"{sys.argv[1]}", "a")
while True:
while not(stoprequest):
time.sleep(0.2)
if signal == prev_signal:
continue
......@@ -156,8 +165,9 @@ while True:
prev_points = ax.scatter([(now+2*u.hour).datetime], [signal], s=50, color='red')
ax.set_ylim((0.5 * minsignal, 1.1 * maxsignal))
ax.set_xlim(starttime.datetime, (now+2.5*u.hour).datetime) # HIERO
ax.set_xlim(starttime.datetime, (now+2.3*u.hour).datetime) # HIERO
fig.tight_layout()
# show the plot
plt.show()
plt.pause(0.0001)
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