Kevin12151011的个人博客分享 http://blog.sciencenet.cn/u/Kevin12151011

博文

Writing BZERO & BSCALE cards to fits headers using astropy

已有 321 次阅读 2019-7-30 11:06 |个人分类:天文软件|系统分类:科研笔记

Found a strange thing that the BZERO & BSCALE cards can't be written to the header by the code below


hdu = fits.open(fits_file)

h = hdu[0].header

img = hdu[0].data

h['BZERO'] = 0.

h['BSCALE'] = 1.

fits.writeto(fits_file,img,h)


This will cause problems when using getsources, since it reads these cards. A solution is (though I don't know why)


hdu = fits.open(fits_file)

hdu[0].header['BZERO'] = 0.

hdu[0].header['BSCALE'] = 1.

fits.writeto(fits_file,hdu[0].data,hdu[0].header)




http://blog.sciencenet.cn/blog-3296568-1191693.html

上一篇:Python格式化字符串的两种形式
下一篇:坑爹的复制语法

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备14006957 )

GMT+8, 2019-9-15 15:46

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部