|||
通道积分是除了p-v图外又一件分析分子云气体运动的利器。在不同的通道查看,可以看到一些速度不同寻常的气体,这些气体就是恒星形成研究中十分感兴趣的高速气体。这些高速气体对于分子云中的能量平衡以及恒星的形成过程可能起着关键的作用。
下面是一个将每3个通道积分,画出积分强度的小程序。这个程序其实和画积分强度的程序如出一辙,只是为了方便和专用,另写一个。
============================================================
#!/usr/bin/env python
import pyfits
from pylab import *
import sys
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
hdulist = pyfits.open('xxx.fits')
image = hdulist[0].data
nx = hdulist[0].header['naxis1']
ny = hdulist[0].header['naxis2']
nz = hdulist[0].header['naxis3']
crvalx = hdulist[0].header['crval1']
cdeltax = hdulist[0].header['cdelt1']
crpixx = hdulist[0].header['crpix1']
crvaly = hdulist[0].header['crval2']
cdeltay = hdulist[0].header['cdelt2']
crpixy = hdulist[0].header['crpix2']
crvalz = hdulist[0].header['crval3']
cdeltaz = hdulist[0].header['cdelt3']
crpixz = hdulist[0].header['crpix3']
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
#X, Y = np.meshgrid(x, y)
# image[z,y,x]!!!! The first dimension is velocity channel!
print 'input'
print 'centerx,centery,xscale,yscale'
line = sys.stdin.readline()
[centerx,centery,xscale,yscale] = line.rstrip().split(',')
centerx=int(centerx)
centery=int(centery)
xscale=int(xscale)
yscale=int(yscale)
for i in range(25):
Z=image[i*3,(centery-yscale):(centery+yscale+1),
(centerx-xscale):(centerx+xscale+1)]
for j in range(2):
Z=Z+image[i*3+j+1,(centery-yscale):(centery+yscale+1),
(centerx-xscale):(centerx+xscale+1)]
ax = plt.subplot(5,5,i+1)
im = plt.imshow(Z, cmap=cm.spectral,
origin='lower', aspect='equal')
plt.show()
============================================================
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-5-14 16:45
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社