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