You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@kvangorkom reports that recent versions of NumPy emit a deprecation warning when arrays are indexed with non-integer indices. The formatter in imshow_with_mouseover seems to do a lot of this, emitting a DeprecationWarning on every mouse movement.
In [1]: import warnings, exceptions
In [2]: warnings.filterwarnings("error",category=exceptions.DeprecationWarning)
In [3]: import webbpsf
WebbPSF log messages of level INFO and above will be shown.
WebbPSF log outputs will be directed to the screen.
In [4]: nircam = webbpsf.NIRCam()
#...
In [6]: import matplotlib.pyplot as plt
#...
In [8]: plt.ion() #I don't remember having to explicitly declare this to get display to show up? Whatevs.
In [9]: nircam.display()
webbpsf : INFO Creating optical system model:
poppy : INFO Initialized OpticalSystem: JWST+NIRCam
poppy : INFO JWST Pupil: Loaded amplitude transmission from /Users/kgorkom/webbpsf-data/pupil_RevV.fits
poppy : INFO JWST Pupil: Loaded OPD from /Users/kgorkom/webbpsf-data//NIRCam/OPD/OPD_RevV_nircam_155.fits
poppy : INFO The supplied pupil OPD is a datacube but no slice was specified. Defaulting to use slice 0.
poppy : INFO Added pupil plane: JWST Pupil
poppy : INFO Added detector: NIRCam detector, with pixelscale=0.031700 arcsec/pixel and oversampling=2
poppy : INFO Displaying plane JWST Pupil in row 1 of 1
#Mouse over the plots
In [10]: Exception in Tkinter callback
Traceback (most recent call last):
File "/Users/kgorkom/STScI/ssbx/python/lib/python2.7/lib-tk/Tkinter.py", line 1470, in __call__
return self.func(*args)
File "/Users/kgorkom/STScI/ssbx/python/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-macosx-10.6-x86_64.egg/matplotlib/backends/backend_tkagg.py", line 380, in motion_notify_event
FigureCanvasBase.motion_notify_event(self, x, y, guiEvent=event)
File "/Users/kgorkom/STScI/ssbx/python/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-macosx-10.6-x86_64.egg/matplotlib/backend_bases.py", line 1834, in motion_notify_event
self.callbacks.process(s, event)
File "/Users/kgorkom/STScI/ssbx/python/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-macosx-10.6-x86_64.egg/matplotlib/cbook.py", line 527, in process
proxy(*args, **kwargs)
File "/Users/kgorkom/STScI/ssbx/python/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-macosx-10.6-x86_64.egg/matplotlib/cbook.py", line 405, in __call__
return mtd(*args, **kwargs)
File "/Users/kgorkom/STScI/ssbx/python/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-macosx-10.6-x86_64.egg/matplotlib/backend_bases.py", line 2788, in mouse_move
s = event.inaxes.format_coord(event.xdata, event.ydata)
File "/Users/kgorkom/STScI/ssbx/variants/common/src/poppy/poppy/utils.py", line 57, in <lambda>
np.floor( (x - imext[0])/(imext[1]-imext[0])*imsize[1] ).clip(0,imsize[1]-1)])
File "/Users/kgorkom/STScI/ssbx/variants/common/lib/python2.7/site-packages/numpy/ma/core.py", line 2999, in __getitem__
dout = ndarray.__getitem__(_data, indx)
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
The text was updated successfully, but these errors were encountered:
Comment by mperrin Monday Jan 26, 2015 at 23:49 GMT
This is perhaps related to a feature of astropy where it converts DeprecationWarnings into Errors in some cases. See astropy/astropy#2502
In any case we should fix this the right way in the code. In imshow_with_mousover, the code is already calling np.floor() on the results, but it's returning them as floats which still triggers this DeprecationWarning despite having an integer numeric value. Simple fix to add a cast to int there. I'd do it myself except trying to not multitask too much while at Gemini. Thanks.
Comment by josePhoenix Tuesday Jan 27, 2015 at 00:38 GMT
Oh, I had Kyle promote warnings to errors so he could figure out where this was happening. The 'bug', such as it is, is that every mouse move event generates a new DeprecationWarning, drowning his terminal in output.
It's a low priority issue, but I wanted to put it in so I don't forget about it.
Issue by josePhoenix
Monday Jan 26, 2015 at 22:07 GMT
Originally opened as mperrin/poppy#53
@kvangorkom reports that recent versions of NumPy emit a deprecation warning when arrays are indexed with non-integer indices. The formatter in
imshow_with_mouseover
seems to do a lot of this, emitting aDeprecationWarning
on every mouse movement.The text was updated successfully, but these errors were encountered: