||
Montage包里的mRotate函数可以实现fits文件的旋转, 但是注意, 位置精度会有丢失!! 我的例子里面, 一个1°的fits会有几个"的误差, 无法容忍!
我尝试把大fits分割成小fits旋转, 仍不能解决问题.
如果仅仅是做demo, 推荐用aplpy里的FITSFigure函数里的 north=True命令, 精度要高很多. 但是有时函数会报错:
Linear transformation matrix is singular.
ERROR 3 in linset() at line 607 of file cextern/wcslib/C/lin.c:
PCi_ja matrix is singular.
这主要是因为fits不是二维图像所致, 此时需要修改header信息和data的shape, 例如
hdu = fits.open('1.fits')
h = hdu[0].header
img = hdu[0].data[0]
h['naxis'] = 2
h.remove('LBOUND3')
h.remove('NAXIS3')
h.remove('CRPIX3')
h.remove('CRVAL3')
h.remove('CTYPE3')
h.remove('CD3_3')
h.remove('CUNIT3')
fits.writeto('11.fits',img,h,overwrite=True)
这样就可以了.
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-6-3 23:19
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社