I have a Fits file with 12 different arrays of information about the image. I can find the maximum value of the array I want to look at, MAG_AUTO, by using the line.
a=pyfits.getdata(data1).MAG_AUTO
Where data1 is my data set from the fits file. 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