musevlt / mpdaf

MUSE Python Data Analysis Framework
BSD 3-Clause "New" or "Revised" License
15 stars 4 forks source link

issue with non integer indices in `mpdaf.Image.peak` #4

Closed jzabl closed 5 years ago

jzabl commented 5 years ago

Hi,

When trying to find the peak position with mpdaf.Image.peak(), I ran into an issue (mpdaf version 3.2 from pip)

im1.peak(center=(9.20491636110484, 3.7216928164120873), radius=5.)
 File "/Users/johannes/anaconda3/envs/3p7main/lib/python3.7/site-packages/mpdaf/obj/image.py", line 1230, in peak
    d = self.data[imin:imax, jmin:jmax]
  File "/Users/johannes/anaconda3/envs/3p7main/lib/python3.7/site-packages/numpy/ma/core.py", line 3174, in __getitem__
    dout = self.data[indx]

The issue seems to be that these indices are not integers: https://github.com/musevlt/mpdaf/blob/77def22802754c060d8a333d6acaf7b288218c21/lib/mpdaf/obj/image.py#L1232 So I guess imin, imax, jmin, jmax should be converted to integers before this line?

Thanks, Johannes

saimn commented 5 years ago

Thanks Johannes, the issue is fixed.

jzabl commented 5 years ago

Thanks Simon!