1

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?

astrochris
  • 1,756
  • 5
  • 20
  • 42

1 Answers1

1

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
astrochris
  • 1,756
  • 5
  • 20
  • 42
  • thanks for updating. i was curious about this after seeing the question but couldn't work out how to do it from the docs. – andrew cooke May 29 '13 at 15:52
  • No worries, looking back on the question i probably should have worded it better. And it didnt really matter that I was using pyfits because that was about the only line of code i actually had working! I think the pyfits might have made some people ignore my question. – astrochris May 29 '13 at 15:59