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

Use half degree in map

parent 6bc759b4
......@@ -55,7 +55,7 @@ s.start()
dt = Telescope(consoleHost='localhost')
data = np.zeros((180, 360), dtype=float)
data = np.zeros((360, 720), dtype=float)
npoints = np.zeros(data.shape, dtype='i8')
# create plot
......@@ -63,14 +63,14 @@ plt.ion()
fig, ax = plt.subplots()
fig.canvas.mpl_connect('close_event', set_stoprequest)
plot = ax.imshow(data, origin='lower', extent=(-180, 180, -90, 90))
plot = ax.imshow(data, origin='lower', extent=(-180.25, 179.75, -90.25, 89.75))
ax.set_xlabel("Galactische longitude (graden)")
ax.set_ylabel("Galactische latitude (graden)")
plt.show()
plt.pause(0.001)
prev_points = None
prev_point = None
maxsignal = 0.
minsignal = 1.0e9
......@@ -89,9 +89,9 @@ while not stoprequest:
l = round(pos.l.deg)
b = round(pos.b.deg)
if prev_points is not None:
if prev_point is not None:
try:
prev_points.remove()
prev_point.remove()
except:
pass
......@@ -102,9 +102,18 @@ while not stoprequest:
if signal < minsignal:
minsignal = signal
n = npoints[b + 90, l + 180]
data[b + 90, l + 180] = (signal + n * data[b + 90, l + 180]) / (n + 1)
npoints[b + 90, l + 180] += 1
def lon_to_pixel(lon):
return round(2 * lon) + 360
def lat_to_pixel(lat):
return round(2 * lat) + 180
l = lon_to_pixel(pos.l.deg)
b = lat_to_pixel(pos.b.deg)
n = npoints[b, l]
data[b, l] = (signal + n * data[b, l]) / (n + 1)
npoints[b, l] += 1
plot.set_data(data)
plot.set_clim(vmin=minsignal, vmax=maxsignal)
......@@ -112,7 +121,8 @@ while not stoprequest:
xmin, xmax = ax.get_xlim()
ymin, ymax = ax.get_ylim()
prev_points = ax.scatter([l+0.5], [b+0.5], s=100, facecolors='none', edgecolors='r')
prev_point = plt.Circle((pos.l.deg, pos.b.deg), radius=0.25, facecolor='none', edgecolor='r')
ax.add_patch(prev_point)
ax.set_xlim(xmin, xmax)
ax.set_ylim(ymin, ymax)
......
Markdown is supported
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