[英]Finding a position in an array of a maxmum point from a fits file, pyfits
I have a Fits file with 12 different arrays of information about the image. 我有一个Fits文件,其中包含有关图像的12种不同信息的数组。 I can find the maximum value of the array I want to look at, MAG_AUTO, by using the line.
我可以通过使用该行找到要查看的数组的最大值MAG_AUTO。
a=pyfits.getdata(data1).MAG_AUTO
Where data1 is my data set from the fits file. 其中data1是我来自fits文件的数据集。 But I am after the position in the array where the maximum value occurs.
但是我在数组中出现最大值的位置之后。 How would I find this?
我怎么会找到这个?
I figured out the answer, the following command produces the maximum for a set a given files, 我想出了答案,下面的命令产生给定文件的最大值,
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.