Skip to content

Instantly share code, notes, and snippets.

@Cadair
Created September 17, 2012 13:40
Show Gist options
  • Save Cadair/3737327 to your computer and use it in GitHub Desktop.
Save Cadair/3737327 to your computer and use it in GitHub Desktop.
Bicubic vs Spline interpolation
# -*- coding: utf-8 -*-
"""
:Created on: Fri Sep 14 15:03:51 2012
:author: Stuart Mumford
Test scipy's spline rotation against sunpy's bicubic rotation.
"""
import numpy as np
import sunpy
import matplotlib.pyplot as plt
aiamap = sunpy.make_map("aia.lev1.193A_2012-06-10T13:00:07.84Z.image_lev1.fits")
cubicrotate = aiamap.rotate(np.pi/2.,interpolation='bicubic',interp_param=-0.5)
splinerotate = aiamap.rotate(np.pi/2.,interpolation='spline',interp_param=3)
sdoaia193 = sunpy.cm.get_cmap('sdoaia193')
plt.figure(figsize=(10,10))
plt.subplot(221)
plt.title("bicubic rotated $interp\_param=-0.5$")
plt.imshow(cubicrotate,origin='lower',cmap=sdoaia193)
plt.colorbar()
plt.subplot(222)
plt.title("Sunpy Rotated cubic spline")
plt.imshow(splinerotate,origin='lower',cmap=sdoaia193)
plt.colorbar()
plt.subplot(223)
plt.title("Difference between spline\n and cubic rotate")
plt.imshow(splinerotate-cubicrotate,origin='lower')
plt.colorbar()
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment