将不同的拟合扩展标头和数据组合到新的拟合文件中

发布于 2025-01-20 16:31:48 字数 666 浏览 4 评论 0原文

我有一个fits.gz文件,其中包含

No.    Name      Ver    Type      Cards   Dimensions   Format
  0  PRIMARY       1 PrimaryHDU     720   ()      
  1  VidInp1       1 ImageHDU       359   (577, 2048)   int16 (rescales to uint16)   
  2  VidInp2       1 ImageHDU       359   (577, 2048)   int16 (rescales to uint16)   
  3  VidInp3       1 ImageHDU       359   (577, 2048)   int16 (rescales to uint16)   
  4  VidInp4       1 ImageHDU       359   (577, 2048)   int16 (rescales to uint16)

我试图从Exten [0]中获取标头的5个不同扩展名,并且来自Exten [3]的数据创建了一个新的拟合文件,该文件仅具有1个扩展名。我目前正在尝试使用Astropy.io..fit来实现这一目标,但是如果有一种干净的方法可以做到这一点,我从文档中尚不清楚。是否可以使用更好的软件包,或者这是一个混乱的过程?

I have a fits.gz file which contains 5 different extensions

No.    Name      Ver    Type      Cards   Dimensions   Format
  0  PRIMARY       1 PrimaryHDU     720   ()      
  1  VidInp1       1 ImageHDU       359   (577, 2048)   int16 (rescales to uint16)   
  2  VidInp2       1 ImageHDU       359   (577, 2048)   int16 (rescales to uint16)   
  3  VidInp3       1 ImageHDU       359   (577, 2048)   int16 (rescales to uint16)   
  4  VidInp4       1 ImageHDU       359   (577, 2048)   int16 (rescales to uint16)

I'm trying to take the header from exten[0] and the data from exten[3] to create a new fits file which only has 1 extension. I'm currently trying to use astropy.io.fits to achieve this, but it's not clear to me from the documentation if there's a clean way to do this. Is there a better package to use, or is this a messy process no matter what?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

空城缀染半城烟沙 2025-01-27 16:31:48

该解决方案原来非常简单/优雅,这是我所希望的。

fits.writeto(splitFileName, fits.getdata(fileName, 3), fits.getheader(fileName, 0))

文件名是原始拟合文件,而splitfileName是创建的文件

The solution turns out to be very simple/elegant, a one liner which is what I was hoping for.

fits.writeto(splitFileName, fits.getdata(fileName, 3), fits.getheader(fileName, 0))

where fileName is the original fits file and splitFileName is the created file

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文