gpt4 book ai didi

python - 从拟合文件 pyfits 中查找最大值点数组中的位置

转载 作者:太空宇宙 更新时间:2023-11-03 18:58:06 25 4
gpt4 key购买 nike

我有一个 Fits 文件,其中包含有关图像的 12 个不同的信息数组。我可以使用该行找到我想要查看的数组的最大值 MAG_AUTO。

a=pyfits.getdata(data1).MAG_AUTO

其中data1是来自fits文件的我的数据集。但我在数组中出现最大值的位置之后。我该如何找到这个?

最佳答案

我找到了答案,以下命令生成给定文件集的最大值,

 for arg in sys.argv[1:]:
a=pyfits.getdata(arg).MAG_AUTO
arr=numpy.array(a)
indices = heapq.nlargest(10,xrange(len(arr)),key=arr.__getitem__)
print indices

关于python - 从拟合文件 pyfits 中查找最大值点数组中的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16790639/

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