import math import numpy as np import matplotlib.cm as cm import matplotlib.mlab as mlab import matplotlib.pyplot as plt
import mpl_toolkits from matplotlib.patches import Ellipse
x = np.arange(-crpixx*cdeltax+crvalx,(nx-1-crpixx)*cdeltax+crvalx,cdeltax) y = np.arange(-crpixy*cdeltay+crvaly,(ny-1-crpixy)*cdeltay+crvaly,cdeltay) z = np.arange(-crpixz*cdeltaz+crvalz,(nz-1-crpixz)*cdeltaz+crvalz,cdeltaz)
z = z/1000.0
# image[z,y,x]!!!! The first dimension is velocity channel!
Z = image[:,(centery-yscale):(centery+yscale+1),centerx]
ZT=Z.T
ax = plt.subplot(221) im = plt.imshow(ZT, cmap=cm.spectral, origin='lower', aspect='equal', extent=[min(z),max(z),min(y),max(y)])
xlabel('|')
Z = image[:,(centery-yscale):(centery+yscale+1),centerx] for i in range(-xscale,xscale+1): for j in range(0,nz): Z[j,i+xscale] = image[j,centery+i,centerx+i] ZT=Z.T ax = plt.subplot(222)
im = plt.imshow(ZT, cmap=cm.spectral, origin='lower', aspect='equal', extent=[min(z),max(z),min(y),max(y)]) xlabel('/')
Z = image[:,centery,(centerx-xscale):(centerx+xscale+1)]
ZT=Z.T ax = plt.subplot(223) im = plt.imshow(ZT, cmap=cm.spectral, origin='lower', aspect='equal', extent=[min(z),max(z),min(x),max(x)]) xlabel('velocity(km/s) -')
ylabel('position')
Z = image[:,centery,(centerx-xscale):(centerx+xscale+1)] for i in range(-xscale,xscale+1): for j in range(0,nz): Z[j,i+xscale] = image[j,centery-i,centerx+i] ZT=Z.T
ax = plt.subplot(224) im = plt.imshow(ZT, cmap=cm.spectral, origin='lower', aspect='equal', extent=[min(z),max(z),min(x),max(x)]) xlabel('\')