Skip to content

Instantly share code, notes, and snippets.

@Cadair
Created September 17, 2012 13:38
Show Gist options
  • Save Cadair/3737317 to your computer and use it in GitHub Desktop.
Save Cadair/3737317 to your computer and use it in GitHub Desktop.
Comparision of IDL and SunPy bicubic rotation
# -*- coding: utf-8 -*-
"""
:Created on: Fri Sep 14 15:03:51 2012
:author: Stuart Mumford
Test Sunpy.map.rotate() against idl rot()
"""
import numpy as np
import sunpy
import matplotlib.pyplot as plt
from scipy.io import readsav
idl = readsav("IDL_cubic_rot.sav")
aiamap = sunpy.make_map("aia.lev1.193A_2012-06-10T13:00:07.84Z.image_lev1.fits")
sunpyrotate = aiamap.rotate(np.pi/2.,interpolation='bicubic',interp_param=-0.5)
idlrotate = np.array(idl['rotated_cubic'],dtype=np.float32)
sdoaia193 = sunpy.cm.get_cmap('sdoaia193')
plt.figure(figsize=(10,10))
plt.subplot(224)
plt.title("Raw data from sunpy - raw data from IDL")
plt.imshow(aiamap-idl['data'],origin='lower',cmap=sdoaia193)
plt.colorbar()
plt.subplot(221)
plt.title("IDL bicubic rotated $cubic=-0.5$")
plt.imshow(idlrotate,origin='lower',cmap=sdoaia193)
plt.colorbar()
plt.subplot(222)
plt.title("Sunpy Rotated bicubic $interp\_param=-0.5$")
plt.imshow(sunpyrotate,origin='lower',cmap=sdoaia193)
plt.colorbar()
plt.subplot(223)
plt.title("Difference between IDL\n rot and sunpy rotate")
plt.imshow(idlrotate-sunpyrotate,origin='lower')
plt.colorbar()
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment