Deprecation warning?
Is there a way to avoid this? Using matplotlib.pyplot. /Users/graeme/svn/cctbx_plus/base/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_wx.py:1382: wxPyDeprecationWarning: Using deprecated class PySimpleApp. wxapp = wx.PySimpleApp() Thanks, Graeme -- This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail. Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message. Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
On Tue, Aug 7, 2012 at 3:04 AM,
Is there a way to avoid this?
Using matplotlib.pyplot.
/Users/graeme/svn/cctbx_plus/base/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_wx.py:1382: wxPyDeprecationWarning: Using deprecated class PySimpleApp. wxapp = wx.PySimpleApp()
You can do this: import warnings warnings.filterwarnings("ignore", category=DeprecationWarning) But that's somewhat dangerous. How are you starting pyplot? I don't get this error when I try something trivial like this: nat@clover:~> phenix.wxpython
import matplotlib.pyplot as plt f = plt.figure() p = plt.plot([1,2,3],[4,5,6]) plt.show()
But if I do this, I get the same warning:
import wx app = wx.PySimpleApp() __main__:1: wxPyDeprecationWarning: Using deprecated class.
So I suspect matplotlib is suppressing the warning somehow. Alternately, it looks as though if a wx.App instance has already been created, matplotlib will use that instead. -Nat
Hi Nat, Interesting, here is the offending code def plot_shoebox(shoebox): ''' Render a shoebox as a sequence of png images using matplotlib. ''' frame, slow, fast = shoebox.accessor().all() max_value = 100 for j in range(frame): from scitbx.array_family import flex import numpy import matplotlib from matplotlib import pyplot grid = flex.grid((slow, fast)) slice = flex.double(grid) for s in range(slow): for f in range(fast): if shoebox[(j, s, f)] < 0: slice[(s, f)] = max_value else: slice[(s, f)] = shoebox[(j, s, f)] image = numpy.reshape(slice.as_numpy_array(), (slow, fast)) pyplot.imshow(image, cmap = matplotlib.cm.Greys, vmax = max_value, interpolation = 'nearest', norm = None, filternorm = 0.0) pyplot.savefig('frame%02d.png' % (j)) i.e. pretty similar to your example, and the error Graemes-MacBook-Pro:cube graeme$ cctbx.python cube.py /Users/graeme/svn/cctbx_plus/base/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_wx.py:1382: wxPyDeprecationWarning: Using deprecated class PySimpleApp. wxapp = wx.PySimpleApp() That said, I am using a home-brewed cctbx.python which should correspond to the cctbx plus build - I used the same script to make it as you guys use to make the python base. I will add the deprecation-avoiding code you include below with a loud warning that really this should not be needed. Thanks, Graeme On 7 Aug 2012, at 18:49, Nathaniel Echols wrote:
On Tue, Aug 7, 2012 at 3:04 AM,
wrote: Is there a way to avoid this?
Using matplotlib.pyplot.
/Users/graeme/svn/cctbx_plus/base/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_wx.py:1382: wxPyDeprecationWarning: Using deprecated class PySimpleApp. wxapp = wx.PySimpleApp()
You can do this:
import warnings warnings.filterwarnings("ignore", category=DeprecationWarning)
But that's somewhat dangerous. How are you starting pyplot? I don't get this error when I try something trivial like this:
nat@clover:~> phenix.wxpython
import matplotlib.pyplot as plt f = plt.figure() p = plt.plot([1,2,3],[4,5,6]) plt.show()
But if I do this, I get the same warning:
import wx app = wx.PySimpleApp() __main__:1: wxPyDeprecationWarning: Using deprecated class.
So I suspect matplotlib is suppressing the warning somehow. Alternately, it looks as though if a wx.App instance has already been created, matplotlib will use that instead.
-Nat _______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
-- This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail. Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message. Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
Hi Nat, Interestingly I added this import warnings warnings.filterwarnings("ignore", category=DeprecationWarning) and it did not make the warnings go away… even though I tried both where I import matplotlib and also in the top of the main() routine. That seems odd to me - any ideas? Many thanks, Graeme On 7 Aug 2012, at 18:49, Nathaniel Echols wrote:
On Tue, Aug 7, 2012 at 3:04 AM,
wrote: Is there a way to avoid this?
Using matplotlib.pyplot.
/Users/graeme/svn/cctbx_plus/base/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_wx.py:1382: wxPyDeprecationWarning: Using deprecated class PySimpleApp. wxapp = wx.PySimpleApp()
You can do this:
import warnings warnings.filterwarnings("ignore", category=DeprecationWarning)
But that's somewhat dangerous. How are you starting pyplot? I don't get this error when I try something trivial like this:
nat@clover:~> phenix.wxpython
import matplotlib.pyplot as plt f = plt.figure() p = plt.plot([1,2,3],[4,5,6]) plt.show()
But if I do this, I get the same warning:
import wx app = wx.PySimpleApp() __main__:1: wxPyDeprecationWarning: Using deprecated class.
So I suspect matplotlib is suppressing the warning somehow. Alternately, it looks as though if a wx.App instance has already been created, matplotlib will use that instead.
-Nat _______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
-- This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail. Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message. Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
On Wed, Aug 8, 2012 at 3:52 AM,
Interestingly I added this
import warnings warnings.filterwarnings("ignore", category=DeprecationWarning)
and it did not make the warnings go away… even though I tried both where I import matplotlib and also in the top of the main() routine.
That seems odd to me - any ideas?
I guess my assumption about the inheritance of wxPyDeprecationWarning was incorrect - at any rate, this seems to work: warnings.filterwarnings("ignore", category=wx.wxPyDeprecationWarning) -Nat
Thanks Nat, that squashed it! Best wishes, Graeme On 8 Aug 2012, at 19:14, Nathaniel Echols wrote:
On Wed, Aug 8, 2012 at 3:52 AM,
wrote: Interestingly I added this
import warnings warnings.filterwarnings("ignore", category=DeprecationWarning)
and it did not make the warnings go away… even though I tried both where I import matplotlib and also in the top of the main() routine.
That seems odd to me - any ideas?
I guess my assumption about the inheritance of wxPyDeprecationWarning was incorrect - at any rate, this seems to work:
warnings.filterwarnings("ignore", category=wx.wxPyDeprecationWarning)
-Nat _______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
-- This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail. Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message. Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
participants (2)
-
Graeme.Winter@diamond.ac.uk
-
Nathaniel Echols