GeoscienceAustralia / mtpy2

This Repository has been moved to https://github.com/MTgeophysics/mtpy
GNU General Public License v3.0
5 stars 1 forks source link

plotting a directory of edi files may crash out in some environ (ubuntu), but not other (WinPC, VDI) #10

Open zhang01GA opened 7 years ago

zhang01GA commented 7 years ago

fzhang@ubuntu-qosmio:/Softlab/Githubz/mtpy2$ python examples/plot_edis.py examples/data/edi_files/ Could not find any Tipper data. Read in edi file for station pb32 /Softlab/Githubz/mtpy2/mtpy/imaging/mtplottools.py:824: FutureWarning: comparison to None will result in an elementwise object comparison in the future. if edi_obj.Tipper.tipper == None: /Softlab/Githubz/mtpy2/mtpy/imaging/mtplottools.py:392: FutureWarning: comparison to None will result in an elementwise object comparison in the future. if self._Z.freq == None: /Softlab/Githubz/mtpy2/mtpy/imaging/mtplottools.py:471: RuntimeWarning: invalid value encountered in double_scalars zdetvar = np.array([np.linalg.det(zzv)*.5 for zzv in self._Z.z_err]) Could not find any Tipper data. Read in edi file for station pb40 Could not find any Tipper data. Read in edi file for station pb39 Could not find any Tipper data. Read in edi file for station pb25 Could not find any Tipper data. Read in edi file for station pb41 Could not find any Tipper data. Read in edi file for station pb30 Could not find any Tipper data. Read in edi file for station pb23 Could not find any Tipper data. Read in edi file for station pb33 Could not find any Tipper data. Read in edi file for station pb44 Could not find any Tipper data. Read in edi file for station pb27 Could not find any Tipper data. Read in edi file for station pb43 Could not find any Tipper data. Read in edi file for station pb29 Traceback (most recent call last): File "examples/plot_edis.py", line 56, in main(edi_path) File "examples/plot_edis.py", line 40, in main pr = mtpr.PlotResponse(fn=efile,plot_num=2,res_limits=(1,10000),phase_limits=(0,90)) File "/Softlab/Githubz/mtpy2/mtpy/imaging/plotresponse.py", line 499, in init self.plot() File "/Softlab/Githubz/mtpy2/mtpy/imaging/plotresponse.py", line 1341, in plot plt.show() File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 244, in show return _show(args, **kw) File "/usr/local/lib/python2.7/dist-packages/matplotlib/backend_bases.py", line 192, in call self.mainloop() File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_tkagg.py", line 74, in mainloop Tk.mainloop() File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 417, in mainloop _default_root.tk.mainloop(n) AttributeError: 'NoneType' object has no attribute 'tk'

YingzhiGou commented 6 years ago

this is because matplotlib is using backend that is based on tk, and tk is not properly set in the environment.

possible solutions:

  1. switch to Qt backend such as QtAgg
  2. make sure libtk, libtcl and libgtk are installed on ubuntu