Commit f44a37ec authored by Tammo Jan Dijkema's avatar Tammo Jan Dijkema
Browse files

Use two scatterplots instead of n

parent b390612b
......@@ -67,11 +67,13 @@ ax.set_ylabel("Signaalsterkte (ongekalibreerd)")
fig.canvas.set_window_title('Live waarneming Dwingeloo radiotelescoop op 1330 MHz')
ax.set_title('Live waarneming Dwingeloo radiotelescoop op 1330 MHz')
prev_points = None
separation = None
maxsignal = 0.
scatterplot_sun = ax.scatter([1,2,3], [4,5,6], s=3, color='black')
scatterplot_cas = ax.scatter([1,2,3], [4,5,6], s=3, color='blue')
while True:
time.sleep(0.2)
if signal == prev_signal:
......@@ -88,7 +90,6 @@ while True:
az = Angle(az + 180 * u.deg)
color = 'black'
if SEPARATION_AZ:
dwl_altaz = AltAz(location=dwl, obstime=Time.now())
az_sun = get_sun(Time.now()).transform_to(dwl_altaz).az
az_cas = cas_a.transform_to(dwl_altaz).az
......@@ -96,13 +97,10 @@ while True:
separation_cas = (az - az_cas).wrap_at(180*u.deg).degree * np.cos(el)
if abs(separation_sun) < abs(separation_cas):
separation = separation_sun
scatterplot = scatterplot_sun
else:
separation = separation_cas
color = 'blue'
else:
separation_sun = get_sun(Time.now()).separation(pos).deg
separation_cas = cas_a.separation(pos).deg
separation = min(separation_sun, separation_cas)
scatterplot = scatterplot_cas
print(signal, flush=True)
......@@ -114,13 +112,15 @@ while True:
print(f"Out of range, separation is {separation:.1f}")
continue
scatter_data = scatterplot.get_offsets()
scatter_data = np.vstack((scatter_data, [separation, signal]))
scatterplot.set_offsets(scatter_data)
if prev_points is not None:
prev_points.remove()
ax.scatter([separation], [signal], s=3, color=color)
prev_points = ax.scatter([separation], [signal], s=30, color='red')
ax.set_ylim((3000, 1.3 * maxsignal))
# show the plot
plt.show()
plt.pause(0.0001) # <-- sets the current plot until refreshed
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