Exemplo n.º 1
0
"""
==========
Test the Python rotate_Map() function to see if it looks like it's working.
==========
"""
testarr = np.zeros((101, 101))
testarr[40:60, :] = testarr[:, 40:60] = 1.0

fig = plt.figure("Python rotate_map() function")
original = fig.add_subplot(231)
plt.imshow(testarr, cmap=cm.coolwarm)
original.set_title("Original image")
plt.colorbar(orientation="horizontal")

rotmap_test = rotate(testarr, np.radians(360.0), int_method="bicubic", int_param=-0.5)
rotated = fig.add_subplot(232)
plt.imshow(rotmap_test, cmap=cm.coolwarm)
rotated.set_title("Image rotated 360 degrees")
plt.colorbar(orientation="horizontal")

diff_im = testarr - rotmap_test
print "SunPy full rotation difference range: {!s}.".format(diff_im.max() - diff_im.min())
diff = fig.add_subplot(233)
plt.imshow(diff_im, cmap=cm.coolwarm)
diff.set_title("Difference between images")
plt.colorbar(orientation="horizontal")

original = fig.add_subplot(234)
plt.imshow(testarr, cmap=cm.coolwarm)
original.set_title("Original image")