[Matplotlib-users] Runtime Error on Solaris - Error Closing Dupe File Handle
Good afternoon, My name is Bryan Williams. I work for the Florida Forest Service in their Forest Logistics and Support Bureau. I’m working on a program that takes weather data and visualizes it using matplotlib and Basemap. I’m currently having an issue with matplotlib 1.4.3 for Python 3.4.3 running under Solaris 5.10. I am getting a Runtime Error whenever I try calling the read_png file from matplotlib._png. (I’m using this to add a small .png file of the Forest Service’s sheld to the picture). The error is the following: Traceback (most recent call last): File "drawmaps.py", line 845, in arr_lena = read_png(fn) RuntimeError: Error closing dupe file handle I don’t quite understand the error I’m getting, and as you can see, the traceback gives very little information. I also tried Google for help, but to no avail; entering the error message as is into Google doesn’t return anything relating to the problem, and putting quotes around “Error closing dupe file handle” yields about 10 results, with one of them being an unanswered question from 2014 regarding the same issue. As per your request on the website, here’s what I get from uname –a: SunOS [server name withheld] 5.10 Generic_141444-09 sun4v sparc SUNW,SPARC-Enterprise-T5220 I built Python 3.4.3 from source and installed matplotlib through pip, and didn’t make any changes to the matplotlibrc file. I was able to reproduce the problem again running these commands in the Python interactive prompt, which emulates the snippet of script that causes the error: Python 3.4.3 (default, May 15 2015, 13:52:23) [GCC 4.9.2] on sunos5 Type "help", "copyright", "credits" or "license" for more information. >>> from matplotlib._png import read_png >>> from matplotlib.cbook import get_sample_data >>> import os; path=os.getcwd() >>> fn = get_sample_data(path + '/resources/shield.png', asfileobj=False) >>> arr_lena = read_png(fn) Traceback (most recent call last): File "", line 1, in RuntimeError: Error closing dupe file handle If you’d like a copy of the problem script, please let me know. Any and all help is greatly appreciated. Thank you in advance! -- BMW -- One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Error on gridspec.py
Hi dear all, I have installed matplot and also six.py and so on. If i start an example from matplot i get the following eror message: File "C:\Python26\lib\site-packages\matplotlib\pyplot.py", line 1087, in subplots ax0 = fig.add_subplot(gs[0, 0], **subplot_kw) File "C:\Python26\lib\site-packages\matplotlib\figure.py", line 964, in add_subplot a = subplot_class_factory(projection_class)(self, *args, **kwargs) File "C:\Python26\lib\site-packages\matplotlib\axes\_subplots.py", line 75, in __init__ self.update_params() File "C:\Python26\lib\site-packages\matplotlib\axes\_subplots.py", line 115, in update_params return_all=True) File "C:\Python26\lib\site-packages\matplotlib\gridspec.py", line 425, in get_position gridspec.get_grid_positions(fig) File "C:\Python26\lib\site-packages\matplotlib\gridspec.py", line 86, in get_grid_positions subplot_params = self.get_subplot_params(fig) File "C:\Python26\lib\site-packages\matplotlib\gridspec.py", line 271, in get_subplot_params subplotpars.update(**update_kw) TypeError: update() keywords must be strings Maybe someone can help me, thanks a lot JAn -- One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Confused about rgb_to_hsv and hsv_to_rgb
Nice idea I will try Sent from my iPhone > On May 23, 2015, at 2:23 PM, Jody Klymak wrote: > > >> On May 23, 2015, at 12:07 PM, Eric Firing wrote: >> >> You might get something more to your liking if you were to start with a >> colormap in which V is uniform--all variation is in H and S--and then >> impose the shading on the V. Cubehelix starts with a full range of V, >> so replacing V with your shading channel completely changes the set of >> colors you end up with. > > Or maybe instead of replacing hsv[:,:,2] with dip you scale it by hsv[:,:,2]: > > hsv[:,:,2]=dip*hsv[:,:,2] > > Cheers, Jody > > -- > One dashboard for servers and applications across Physical-Virtual-Cloud > Widest out-of-the-box monitoring support with 50+ applications > Performance metrics, stats and reports that give you Actionable Insights > Deep dive visibility with transaction tracing using APM Insight. > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y > ___ > Matplotlib-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Error on gridspec.py
Jan, If you subscribe to the user list you will be able to post with out moderation. Can you point us to which example you are running? From what you have sent is is very hard to sort out what is going wrong as we have to guess what you are doing. Tom On Sun, May 24, 2015 at 1:38 PM Albrecht, Jan < [email protected]> wrote: > Hi dear all, > > > > I have installed matplot and also six.py and so on. > > > > If i start an example from matplot i get the following eror message: > > > > File "C:\Python26\lib\site-packages\matplotlib\pyplot.py", line 1087, in > subplots > > ax0 = fig.add_subplot(gs[0, 0], **subplot_kw) > > File "C:\Python26\lib\site-packages\matplotlib\figure.py", line 964, in > add_subplot > > a = subplot_class_factory(projection_class)(self, *args, **kwargs) > > File "C:\Python26\lib\site-packages\matplotlib\axes\_subplots.py", line > 75, in __init__ > > self.update_params() > > File "C:\Python26\lib\site-packages\matplotlib\axes\_subplots.py", line > 115, in update_params > > return_all=True) > > File "C:\Python26\lib\site-packages\matplotlib\gridspec.py", line 425, in > get_position > > gridspec.get_grid_positions(fig) > > File "C:\Python26\lib\site-packages\matplotlib\gridspec.py", line 86, in > get_grid_positions > > subplot_params = self.get_subplot_params(fig) > > File "C:\Python26\lib\site-packages\matplotlib\gridspec.py", line 271, > in get_subplot_params > > subplotpars.update(**update_kw) > > TypeError: update() keywords must be strings > > > > Maybe someone can help me, thanks a lot > > JAn > > -- > One dashboard for servers and applications across Physical-Virtual-Cloud > Widest out-of-the-box monitoring support with 50+ applications > Performance metrics, stats and reports that give you Actionable Insights > Deep dive visibility with transaction tracing using APM Insight. > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y > ___ > Matplotlib-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Runtime Error on Solaris - Error Closing Dupe File Handle
Bryan, First off, avoid importing things from modules that start with an underscore. Because Python doesn't have semantics for public/private APIs like C++ and Java does, the underscore is treated as an indicator to developers that it is to be treated as private. The implication is that we are free to change the API of "private" modules and functions between releases, without warning or recourse, which would lead to breakage of your scripts if you use them. So, use it at your peril. I would recommend using plt.imread() instead, or use the Pillow package to read your data as a numpy array that you can then plot. Now, onto your issue. I suspect it might be related to changes we made in 1.4 to have a cross-platform file-handle. However, the solaris platform is not regularly tested by anybody, so it is quite likely we broke something there. Now, in the master branch on github, we completely rewrote nearly all of the C++ code, so I while it may still be broken there, perhaps we might get a more useful error message or something different entirely? Can you try building from the master branch and letting us know? Cheers! Ben Root P.S. - The script in question wasn't perhaps written originally by a former Meteorologist colleague from the University of Oklahoma? ;-) If it was, he was my officemate! On Thu, May 21, 2015 at 4:08 PM, Bryan Williams < [email protected]> wrote: > Good afternoon, > > > > My name is Bryan Williams. I work for the Florida Forest Service in their > Forest Logistics and Support Bureau. > > > > I’m working on a program that takes weather data and visualizes it using > matplotlib and Basemap. I’m currently having an issue with matplotlib 1.4.3 > for Python 3.4.3 running under Solaris 5.10. I am getting a Runtime Error > whenever I try calling the read_png file from matplotlib._png. (I’m using > this to add a small .png file of the Forest Service’s sheld to the > picture). The error is the following: > > > > Traceback (most recent call last): > > File "drawmaps.py", line 845, in > > arr_lena = read_png(fn) > > RuntimeError: Error closing dupe file handle > > > > I don’t quite understand the error I’m getting, and as you can see, the > traceback gives very little information. I also tried Google for help, but > to no avail; entering the error message as is into Google doesn’t return > anything relating to the problem, and putting quotes around “Error closing > dupe file handle” yields about 10 results, with one of them being an > unanswered question from 2014 regarding the same issue. > > > > As per your request on the website, here’s what I get from uname –a: > > > > SunOS [server name withheld] 5.10 Generic_141444-09 sun4v sparc > SUNW,SPARC-Enterprise-T5220 > > > > I built Python 3.4.3 from source and installed matplotlib through pip, and > didn’t make any changes to the matplotlibrc file. > > > > I was able to reproduce the problem again running these commands in the > Python interactive prompt, which emulates the snippet of script that causes > the error: > > > > Python 3.4.3 (default, May 15 2015, 13:52:23) > > [GCC 4.9.2] on sunos5 > > Type "help", "copyright", "credits" or "license" for more information. > > >>> from matplotlib._png import read_png > > >>> from matplotlib.cbook import get_sample_data > > >>> import os; path=os.getcwd() > > >>> fn = get_sample_data(path + '/resources/shield.png', asfileobj=False) > > >>> arr_lena = read_png(fn) > > Traceback (most recent call last): > > File "", line 1, in > > RuntimeError: Error closing dupe file handle > > > > > > If you’d like a copy of the problem script, please let me know. Any and > all help is greatly appreciated. > > > > Thank you in advance! > > > > -- BMW > > > -- > One dashboard for servers and applications across Physical-Virtual-Cloud > Widest out-of-the-box monitoring support with 50+ applications > Performance metrics, stats and reports that give you Actionable Insights > Deep dive visibility with transaction tracing using APM Insight. > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y > ___ > Matplotlib-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Runtime Error on Solaris - Error Closing Dupe File Handle
Bryan, If you subscribe to the list you will be able to post with out moderation. Does this happen with any of the other sample data? I don't think that `get_sample_data` is doing you any good here as you are passing it an absolute path (from `os.getcwd()`) which is passed into `os.path.join` which when it encounters and absolute path discards everything to the left so that line is just returning back your input. Does it work to open any other png or does _only_ this png have issues? You are reaching into the nominally private parts of the mpl api here, I would suggest using `mpl.image.imread` instead. It might be worth using something like PIL/pillow, imread ( https://pypi.python.org/pypi/imread), imageio (https://imageio.github.io/) or scikit-image for alternate implementations of png readers. None of the core developers have access to a Solaris machine so it is very difficult for us to provide much better help on this. Tom On Sun, May 24, 2015 at 1:38 PM Bryan Williams wrote: > Good afternoon, > > > > My name is Bryan Williams. I work for the Florida Forest Service in their > Forest Logistics and Support Bureau. > > > > I’m working on a program that takes weather data and visualizes it using > matplotlib and Basemap. I’m currently having an issue with matplotlib 1.4.3 > for Python 3.4.3 running under Solaris 5.10. I am getting a Runtime Error > whenever I try calling the read_png file from matplotlib._png. (I’m using > this to add a small .png file of the Forest Service’s sheld to the > picture). The error is the following: > > > > Traceback (most recent call last): > > File "drawmaps.py", line 845, in > > arr_lena = read_png(fn) > > RuntimeError: Error closing dupe file handle > > > > I don’t quite understand the error I’m getting, and as you can see, the > traceback gives very little information. I also tried Google for help, but > to no avail; entering the error message as is into Google doesn’t return > anything relating to the problem, and putting quotes around “Error closing > dupe file handle” yields about 10 results, with one of them being an > unanswered question from 2014 regarding the same issue. > > > > As per your request on the website, here’s what I get from uname –a: > > > > SunOS [server name withheld] 5.10 Generic_141444-09 sun4v sparc > SUNW,SPARC-Enterprise-T5220 > > > > I built Python 3.4.3 from source and installed matplotlib through pip, and > didn’t make any changes to the matplotlibrc file. > > > > I was able to reproduce the problem again running these commands in the > Python interactive prompt, which emulates the snippet of script that causes > the error: > > > > Python 3.4.3 (default, May 15 2015, 13:52:23) > > [GCC 4.9.2] on sunos5 > > Type "help", "copyright", "credits" or "license" for more information. > > >>> from matplotlib._png import read_png > > >>> from matplotlib.cbook import get_sample_data > > >>> import os; path=os.getcwd() > > >>> fn = get_sample_data(path + '/resources/shield.png', asfileobj=False) > > >>> arr_lena = read_png(fn) > > Traceback (most recent call last): > > File "", line 1, in > > RuntimeError: Error closing dupe file handle > > > > > > If you’d like a copy of the problem script, please let me know. Any and > all help is greatly appreciated. > > > > Thank you in advance! > > > > -- BMW > > -- > One dashboard for servers and applications across Physical-Virtual-Cloud > Widest out-of-the-box monitoring support with 50+ applications > Performance metrics, stats and reports that give you Actionable Insights > Deep dive visibility with transaction tracing using APM Insight. > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y > ___ > Matplotlib-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlibrc has no effect on the plot? (windows7)
Shawn, This might better be sent to the IPython mailing lists. Tom On Tue, May 19, 2015 at 5:56 PM Yuxiang Wang wrote: > Here is what I did: > > Put a 00_matplotlib_rc.py in ipython's profile_default/startup folder > (you might need to run ipython profile create, or ipython profile > locate to create/find them), and in the file specify my matplotlib rc > parameters. For example: > > import matplotlib as mpl > > > # Figure formatting > mpl.rcParams['savefig.dpi'] = 300 > mpl.rcParams['figure.figsize'] = (3.27, 3.27) > > # Font setting > mpl.rcParams['mathtext.default'] = 'regular' > mpl.rcParams['font.family'] = ['sans-serif'] > mpl.rcParams['font.sans-serif'] = ['Arial'] > mpl.rcParams['font.size'] = 8 > mpl.rcParams['pdf.fonttype'] = 42 > mpl.rcParams['ps.fonttype'] = 42 > > # Line properties > mpl.rcParams['lines.linewidth'] = 1. > mpl.rcParams['lines.markersize'] = 4 > > # Legends > mpl.rcParams['legend.frameon'] = False > mpl.rcParams['legend.fontsize'] = 8 > mpl.rcParams['legend.handlelength'] = 3 > > # Subplot frame line > mpl.rcParams['axes.linewidth'] = .5 > > > > I would be happy to know if there's a better/different way to do it. > > Shawn > > On Tue, May 19, 2015 at 5:49 PM, mato wrote: > > This might be the case (I'm running Anaconda/Spyder/Ipython) however so > far I > > haven't been able to locate the appropriate settings file... > > > > > > Yuxiang Wang wrote > >> Are you using IPython QtConsole / Notebook? I think they have their > >> own settings on their backend. > >> > >> Shawn > > > > > > > > > > > > -- > > View this message in context: > http://matplotlib.1069221.n5.nabble.com/matplotlibrc-has-no-effect-on-the-plot-windows7-tp45573p45575.html > > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > > > -- > > One dashboard for servers and applications across Physical-Virtual-Cloud > > Widest out-of-the-box monitoring support with 50+ applications > > Performance metrics, stats and reports that give you Actionable Insights > > Deep dive visibility with transaction tracing using APM Insight. > > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y > > ___ > > Matplotlib-users mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > -- > Yuxiang "Shawn" Wang > Gerling Research Lab > University of Virginia > [email protected] > +1 (434) 284-0836 > https://sites.google.com/a/virginia.edu/yw5aj/ > > > -- > One dashboard for servers and applications across Physical-Virtual-Cloud > Widest out-of-the-box monitoring support with 50+ applications > Performance metrics, stats and reports that give you Actionable Insights > Deep dive visibility with transaction tracing using APM Insight. > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y > ___ > Matplotlib-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to get the value of a cell in pcolormesh
To get the index of the grid you clicked on requires some knowledge of what artist you are working with. See https://github.com/matplotlib/matplotlib/pull/3989 for some brand new code which makes this easier to implement in a general way. While we catch up with that you will need to implement your own mapping of x/y in data space -> i, j See http://matplotlib.org/examples/api/image_zcoord.html for an example. Tom On Tue, May 12, 2015 at 2:21 AM GoogleWind wrote: > Hi everyone! > It is cool to use the pcolormesh in matplotlib. However, is there a way to > get the i, j indexes of the clicked cell? I have try > event.mouseevent.xdata > and event.mouseevent.x. But they did not return the index I need. > > Thanks in advanced for your help. > > Dr. Jiacong Huang > Nanjing Institute of Geography & Limnology > Chinese Academy of Sciences > 73 East Beijing Road, Nanjing 210008, China > Tel./Fax: +86-25-86882127 > Homepage: http://www.escience.cn/people/elake/index.html > > > > ---Code to generate pcolormesh--- > import numpy as np > from matplotlib.pyplot import figure, show > from numpy import ma > > n = 12 > x = np.linspace(-1.5,1.5,n) > y = np.linspace(-1.5,1.5,n*2) > X,Y = np.meshgrid(x,y); > Qx = np.cos(Y) - np.cos(X) > Qz = np.sin(Y) + np.sin(X) > Qx = (Qx + 1.1) > Z = np.sqrt(X**2 + Y**2)/5; > Z = (Z - Z.min()) / (Z.max() - Z.min()) > > # The color array can include masked values: > Zm = ma.masked_where(np.fabs(Z) > 100, Z) > > fig = figure() > ax = fig.add_subplot(111) > col = ax.pcolormesh(Qx[:5,:4],Qz[:5,:4],Zm[:4,:3]) > show() > - > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/How-to-get-the-value-of-a-cell-in-pcolormesh-tp45499.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > -- > One dashboard for servers and applications across Physical-Virtual-Cloud > Widest out-of-the-box monitoring support with 50+ applications > Performance metrics, stats and reports that give you Actionable Insights > Deep dive visibility with transaction tracing using APM Insight. > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y > ___ > Matplotlib-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to get the value of a cell in pcolormesh
Hi Tom, It is nice to receive your hints. I would like to try it. Best regards, Jiacong Huang -- View this message in context: http://matplotlib.1069221.n5.nabble.com/How-to-get-the-value-of-a-cell-in-pcolormesh-tp45499p45610.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
