gpt4 book ai didi

astronomy - 破解 FITs 图像标题

转载 作者:行者123 更新时间:2023-12-01 08:41:27 26 4
gpt4 key购买 nike

我需要更改几个 FIT 图像标题中的一些值以适合我拥有的一些测试数据。因此,我正在尝试立即破解 FIT 图像标题以与应用程序一起运行。

然而此刻 - 我什至看不到标题,别介意破解它。我运行 Ubuntu。

任何人都可以建议一些软件查看 FIT - 甚至可能破解它?

最佳答案

有点旧,但我认为答案可以使用一些更新和附加信息。

查看 .fits 文件

我个人最喜欢查看“.fits”文件的 GUI 是 DS9 .安装后,您可以通过键入 ds9 /path/to/file.fits 来查看文件。 .或者,您可以仅使用 GUI 中的菜单来加载图像。在查看器中加载图像后,您可以使用最顶部的菜单栏并转到“文件 -> 显示标题”来查看标题信息。不幸的是,我不相信您可以修改 DS9 中的标题。

修改适合标题

对于修改 fits 标题,我发现最简单的方法是使用 astropy (一个python包)。由于您使用的是 Ubuntu,您应该可以通过 apt-get 下载它。 ,所以希望很容易。要实际编辑 fits 标题,您可以在 python 脚本中或从解释器 ( here's some additional help ) 中执行以下操作:

# Import the astropy fits tools
from astropy.io import fits

# Open the file header for viewing and load the header
hdulist = fits.open('yourfile.fits')
header = hdulist[0].header

# Print the header keys from the file to the terminal
header.keys

# Modify the key called 'NAXIS1' to have a value of 100
header['NAXIS1'] = '100'

# Modify the key called 'NAXIS1' and give it a comment
header['NAXIS1'] = ('100','This value has been modified!')

# Add a new key to the header
header.set('NEWKEY','50.5')

# Save the new file
hdulist.writeto('MyNewFile.fits')

# Make sure to close the file
hdulist.close()

您也可以将其放入循环中以进行多个文件操作。

关于astronomy - 破解 FITs 图像标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2221159/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com