Re: [matplotlib-devel] mkpg on OSX
On Tue, Aug 4, 2009 at 11:04 PM, Russell Owen wrote: > Thank you very much. Unfortunately it doesn't work for me. Trying to import > pylab results in a bus error (I appended the log in case it has anything > useful in it). > > My configuration: > - Intel Mac > - MacOS X 10.5.7 > - Python 2.5.2 (in /Library/Frameworks... from python.org) > - Tcl/Tk 8.4.19 (in /Library/Frameworks... from ActiveState) > - this occurs with or without a ~/.matplotlib/matplotlibrc file (that uses > TkAgg) and with or without a ~/.matplotlib directory at all > I have confirmed that Tkinter works fine.\ Can you create a small test script that creates an mpl figure and saves it with savefig, and run it with > python myscript.py -dTkAgg > python myscript.py -dWXAgg > python myscript.py -dAgg > python myscript.py -dmacosx and let me know if all segfault, and if not, which ones do? JDH -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] example data in example code
On Tue, Aug 4, 2009 at 2:45 PM, Jouni K. Seppänen wrote: > The mod_dav_svn server sends an ETag header that happens to contain the > revision number where the file was last modified, and a Last-Modified > header that contains the date of that revision. The clean http way to > make use of these is to make a conditional request - I hacked up a > processor class for urllib2 that does this, and checked it in. Wow, that is really clever and cool. Nicely done. I added mpl_data/testdata.csv which is easier to modify than lena.png to test the revision control and it worked beautifully (examples/misc/mpl_data_test.py) I didn't understand this part of the code: fn = rightmost while os.path.exists(self.in_cache_dir(fn)): fn = rightmost + '.' + str(random.randint(0,999)) when would there be a name clash that would require the randint appended? Also, how hard would it be to add support for a directory structure? I see you are getting the filename from the url as the last thing past the '/'. Is there any way to generalize this so a relative path could be supported in the svn repo and local cache dir? JDH -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] example data in example code
On Tue, Aug 4, 2009 at 2:45 PM, Jouni K. Seppänen wrote: > John Hunter writes: > >> # TODO: how to handle stale data in the cache that has been >> # updated from svn -- is there a clean http way to get the current >> # revision number that will not leave us at the mercy of html >> # changes at sf? > > The mod_dav_svn server sends an ETag header that happens to contain the > revision number where the file was last modified, and a Last-Modified > header that contains the date of that revision. The clean http way to > make use of these is to make a conditional request - I hacked up a > processor class for urllib2 that does this, and checked it in. Also, it would be preferable for the returned file object which supports the "seek" method. This is what cbook.to_filehandle checks for, and what mlab.csv2rec uses to rewind the file after doing a data introspection pass through to get the data types. Eg, >>> import matplotlib.mlab as mlab >>> import matplotlib.cbook as cbook >>> r = mlab.csv2rec( cbook.get_mpl_data('testdata.csv') ) Traceback (most recent call last): File "", line 1, in File "/Users/jdhunter/dev/lib/python2.6/site-packages/matplotlib/mlab.py", line 2108, in csv2rec fh = cbook.to_filehandle(fname) File "/Users/jdhunter/dev/lib/python2.6/site-packages/matplotlib/cbook.py", line 339, in to_filehandle raise ValueError('fname must be a string or file handle') ValueError: fname must be a string or file handle Perhaps we could return a plain file handle pointing to the cached data? JDH -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] example data in example code
On Wed, Aug 5, 2009 at 7:11 AM, John Hunter wrote: > >>> import matplotlib.mlab as mlab > >>> import matplotlib.cbook as cbook > >>> r = mlab.csv2rec( cbook.get_mpl_data('testdata.csv') ) > Traceback (most recent call last): > File "", line 1, in > File "/Users/jdhunter/dev/lib/python2.6/site-packages/matplotlib/mlab.py", > line 2108, in csv2rec >fh = cbook.to_filehandle(fname) > File > "/Users/jdhunter/dev/lib/python2.6/site-packages/matplotlib/cbook.py", > line 339, in to_filehandle >raise ValueError('fname must be a string or file handle') > ValueError: fname must be a string or file handle > > Perhaps we could return a plain file handle pointing to the cached data? Another option is to use StringIO to create a new file-like object after read()-ing in all the data. Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] example data in example code
On Wed, Aug 5, 2009 at 7:11 AM, John Hunter wrote: > Perhaps we could return a plain file handle pointing to the cached data? OK, I've made a few changes to the code so Jouni you will probably want to review them * I renamed the svn repo and function to be "sample_data" rather than "mpl_data" to avoid confusion with lib/matplotlib/mpl-data. The svn repo, the examples and the cbook function have all been renamed. The repo is :: svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/sample_data and the examples are:: jo...@udesktop191:mpl> ls examples/misc/sam*.py examples/misc/sample_data_demo.py examples/misc/sample_data_test.py * I added support for nested subdirs, so you can now do, as in examples/misc/sample_data_test.py:: datafile = 'testdir/subdir/testsub.csv' fh = cbook.get_sample_data(datafile) * I commented out the random number appending, because I do not see the use case, but we can re-add it when you enlighten me :-) * I always return a file handle to the cached file, so seek works, and is exercised in examples/misc/sample_data_test.py It is probably worth doing a little more work to make the processor plus the "get_sample_data" function all part of one class, so other people can reuse it with other repos and other dirs. Eg, something like the following in cbook:: myserver = ViewVCCacheServer(mycachedir, myurlbase) get_sample_data = myserver.get_sample_data -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] mkpg on OSX
On Wed, Aug 5, 2009 at 10:53 AM, Russell Owen wrote: > The segfault I reported on was on home computer. Today at work I tried the > same installer and it works fine on my work machine. I performed the tests > (though I doubt they're relevant since TkAgg works) and came up with: > I don't have wxPython installed so it fails as expected. > > python myscript.py -dAgg If you made a call to savefig('somefile'), this will create somefile.png -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] mkpg on OSX
The segfault I reported on was on home computer. Today at work I tried the same installer and it works fine on my work machine. I performed the tests (though I doubt they're relevant since TkAgg works) and came up with: python myscript.py -dTkAgg works (at work) python myscript.py -dWXAgg I don't have wxPython installed so it fails as expected. python myscript.py -dAgg Works but I have no idea where the output goes. python myscript.py -dmacosx Works. I can try more tests at home, but not until this evening. My *guess* based on past experience with matplotlib segfaults in TkAgg is that all those tests will pass except TkAgg, and that TkAgg will work if I move my /Library/Frameworks Tcl/Tk aside. -- Russell On Aug 5, 2009, at 3:27 AM, John Hunter wrote: On Tue, Aug 4, 2009 at 11:04 PM, Russell Owen wrote: Thank you very much. Unfortunately it doesn't work for me. Trying to import pylab results in a bus error (I appended the log in case it has anything useful in it). My configuration: - Intel Mac - MacOS X 10.5.7 - Python 2.5.2 (in /Library/Frameworks... from python.org) - Tcl/Tk 8.4.19 (in /Library/Frameworks... from ActiveState) - this occurs with or without a ~/.matplotlib/matplotlibrc file (that uses TkAgg) and with or without a ~/.matplotlib directory at all I have confirmed that Tkinter works fine.\ Can you create a small test script that creates an mpl figure and saves it with savefig, and run it with python myscript.py -dTkAgg python myscript.py -dWXAgg python myscript.py -dAgg python myscript.py -dmacosx and let me know if all segfault, and if not, which ones do? JDH -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
[matplotlib-devel] bug in imshow for PDF, EPS output
Hi all, I've come across an apparent bug in imshow when outputting to PDF and EPS files. (I haven't tested other vector formats.) It manifests as a small scaling error between the raster image and the axes coordinates. I have attached a test script to illustrate the problem. The (correct) PNG output file shows a green 'X' at the common point between four pixels near the center of the raster image. The extent is chosen such that the coordinates refer to pixel centers. The PDF and EPS output files show a misalignment between the X and the pixel boundaries -- zoom in to see it clearly. Also, the topmost row and rightmost column appear truncated. I am using svn r7395. Thanks for the attention, Mike import numpy as n import matplotlib as mpl import pylab ny, nx = 50, 50 im = n.arange(ny*nx) % 3 im.shape = (ny, nx) extent = (-0.5, nx-0.5, -0.5, ny-0.5) fig = pylab.figure(0, figsize=(5,5)) fig.clear() fig.hold(True) ax = fig.add_subplot(111) ax.imshow(im, extent=extent, interpolation='nearest', cmap=mpl.cm.gray, origin='lower') ax.set_autoscale_on(False) ax.plot(((nx-1)/2.,), ((ny-1)/2.,), 'x', c='g', ms=4, mew=1.25) pylab.draw() #pylab.show() dpi = 300 pylab.savefig('test.png', dpi=dpi) pylab.savefig('test.pdf', dpi=dpi) pylab.savefig('test.eps', dpi=dpi) -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel