Re: [matplotlib-devel] "ValueError: too many values to unpack" building docs
On Tue, Sep 22, 2009 at 16:21, Michael Droettboom wrote: > On second look, I think it's the "--small" commandline option that breaks > this. I hadn't tested my recent changes to the plot directive with that > flag. The new version of make.py in SVN r7815 should fix this. Thanks for your reply! I should have find it myself :) Anyhow, from a clean checked-out trunk, doc doesn't build: $ MATPLOTLIBDATA=../lib/matplotlib/mpl-data/ PYTHONPATH=../build/lib.linux-x86_64-2.5/ ./make.py --small all Running Sphinx v0.6.2 Exception occurred while building, starting debugger: Traceback (most recent call last): File "/usr/lib/pymodules/python2.5/sphinx/cmdline.py", line 171, in main warningiserror, tags) File "/usr/lib/pymodules/python2.5/sphinx/application.py", line 94, in __init__ self.config = Config(confdir, CONFIG_FILENAME, confoverrides, self.tags) File "/usr/lib/pymodules/python2.5/sphinx/config.py", line 120, in __init__ execfile(config['__file__'], config) File "/home/morph/deb/tmp/matplotlib/doc/conf.py", line 23, in import ipython_console_highlighting ImportError: No module named ipython_console_highlighting > /home/morph/deb/tmp/matplotlib/doc/conf.py(23)() -> import ipython_console_highlighting indeed matplotlib/doc$ grep -ri ipython_console_highlighting * conf.py:import ipython_console_highlighting $ Is that module benn {re.}moved? Regards, -- Sandro Tosi (aka morph, morpheus, matrixhasu) My website: http://matrixhasu.altervista.org/ Me at Debian: http://wiki.debian.org/SandroTosi -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] 0.99.1 and the setup.cfg file
On Wed, Sep 23, 2009 at 8:47 AM, Lev Givon wrote: > contain a setup.cfg file: > > $ tar zft matplotlib-0.99.1.tar.gz |grep setup.cfg > matplotlib-0.99.1/setup.cfg > matplotlib-0.99.1/setup.cfg.template It seems to depend on which mirror you get the file from. From Voxel, I see setup.cfg but from "German Research Network (Berlin, Germany) " I do not see it. We may just need time for the mirrors to update. I probably should have used a different file name... JDH -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] 0.99.1 and the setup.cfg file
Received from John Hunter on Tue, Sep 22, 2009 at 09:57:37PM EDT: > On Tue, Sep 22, 2009 at 5:38 PM, wrote: > > I just downloaded 0.99.1 and ran into some problems using it in Sage. > > Basically, in the tar.gz file, there was a setup.cfg file, which had the > > following: > > This was a bug in the tarball -- mpl doesn't keep a copy of setup.cfg > in svn and shouldn't ship with it. We do ship setup.cfg.template > which you can use to create and customize a setup.cfg, but there > shouldn't be one by default. > > It's not listed in MANIFEST.in, but apparently when I built the > tarball I had not done an svn-clean. setup.cfg *was* in my MANIFEST > (which is autogenerated at build time) on my build machine, but I am > not sure why it was added since it isn't in MANIFEST.in. > > In any case, I just rebuilt and reuploaded the tarball with no > setup.cfg from a clean dir > > > https://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-0.99.1/ > > Thanks for the report. > > JDH The latest tarball (downloaded as of a few minutes ago) still seems to contain a setup.cfg file: $ tar zft matplotlib-0.99.1.tar.gz |grep setup.cfg matplotlib-0.99.1/setup.cfg matplotlib-0.99.1/setup.cfg.template L.G. -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Comparing pdf output in tests
Andrew Straw writes: > Jouni - I don't think this would be hard to add, but I'm swamped at > work. If this is an itch you'd like to scratch, feel free to hack away > on the image_comparison() function in > lib/matplotlib/testing/decorators.py -- it's a pretty straightforward > piece of code. Changing that is probably easy enough, but how should the overall code path look? I was planning to switch backends in matplotlib.test after it runs the Agg tests, so that the same test cases could be used to produce pdf files (that's why they save files without extensions, right?) but this seems to be impossible. The matplotlib.use function is a no-op if matplotlib.backends has been imported, regardless of the warn argument. For example, the following code produces two png files: #!/usr/bin/env python import matplotlib matplotlib.use('agg') from matplotlib import pyplot pyplot.plot([3,1,4,1]) pyplot.savefig('foo1') pyplot.switch_backend('pdf') pyplot.plot([5,9,2,6]) pyplot.savefig('foo2') If you interchange the 'agg' and 'pdf' strings, you get two pdf files. It looks like the following change to matplotlib/__init__.py would fix this, but I'm a little doubtful since maybe there was a good reason to make it like it is: --- __init__.py (revision 7815) +++ __init__.py (working copy) @@ -822,8 +822,8 @@ make the backend switch work (in some cases, eg pure image backends) so one can set warn=False to supporess the warnings """ -if 'matplotlib.backends' in sys.modules: -if warn: warnings.warn(_use_error_msg) +if 'matplotlib.backends' in sys.modules and warn: +warnings.warn(_use_error_msg) return arg = arg.lower() if arg.startswith('module://'): -- Jouni K. Seppänen http://www.iki.fi/jks -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Comparing pdf output in tests
On Wed, Sep 23, 2009 at 10:48 AM, Jouni K. Seppänen wrote: > Andrew Straw writes: > >> Jouni - I don't think this would be hard to add, but I'm swamped at >> work. If this is an itch you'd like to scratch, feel free to hack away >> on the image_comparison() function in >> lib/matplotlib/testing/decorators.py -- it's a pretty straightforward >> piece of code. > > Changing that is probably easy enough, but how should the overall code > path look? > > I was planning to switch backends in matplotlib.test after it runs the > Agg tests, so that the same test cases could be used to produce pdf > files (that's why they save files without extensions, right?) but this > seems to be impossible. The matplotlib.use function is a no-op if > matplotlib.backends has been imported, regardless of the warn argument. > For example, the following code produces two png files: > > #!/usr/bin/env python > import matplotlib > > matplotlib.use('agg') > from matplotlib import pyplot > pyplot.plot([3,1,4,1]) > pyplot.savefig('foo1') Take a look at the pyplot "switch_backends" function. Alternatively, agg knows how to save pdf if given the extension, so we could wire up the testing to use a module level extension set somewhere which could be updated for each backend. This is probably safer and cleaner than switch_backends JDH -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Comparing pdf output in tests
John Hunter writes: >> pyplot.savefig('foo1') > > Take a look at the pyplot "switch_backends" function. Yes, that function was on the next line after the part you quoted. :-) It calls matplotlib.use with warn=False, but that function ends up doing nothing. > Alternatively, agg knows how to save pdf if given the extension, so we > could wire up the testing to use a module level extension set > somewhere which could be updated for each backend. This is probably > safer and cleaner than switch_backends That sounds complicated. How about having the test cases call savefig with all the relevant file formats? That doesn't look so nice if the test cases end up with a big block of savefig calls, but it has the advantage that there is no magic involved and it is very obvious what is going on. -- Jouni K. Seppänen http://www.iki.fi/jks -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] "ValueError: too many values to unpack" building docs
That file was moved. I think I had a lingering .pyc lying around which is why it didn't fail on me. I have updated conf.py to import it from the right place. Hopefully it's working now. Cheers, Mike On 09/23/2009 10:09 AM, Sandro Tosi wrote: > On Tue, Sep 22, 2009 at 16:21, Michael Droettboom wrote: > >> On second look, I think it's the "--small" commandline option that breaks >> this. I hadn't tested my recent changes to the plot directive with that >> flag. The new version of make.py in SVN r7815 should fix this. >> > Thanks for your reply! I should have find it myself :) > > Anyhow, from a clean checked-out trunk, doc doesn't build: > > $ MATPLOTLIBDATA=../lib/matplotlib/mpl-data/ > PYTHONPATH=../build/lib.linux-x86_64-2.5/ ./make.py --small all > Running Sphinx v0.6.2 > Exception occurred while building, starting debugger: > Traceback (most recent call last): >File "/usr/lib/pymodules/python2.5/sphinx/cmdline.py", line 171, in main > warningiserror, tags) >File "/usr/lib/pymodules/python2.5/sphinx/application.py", line 94, > in __init__ > self.config = Config(confdir, CONFIG_FILENAME, confoverrides, self.tags) >File "/usr/lib/pymodules/python2.5/sphinx/config.py", line 120, in __init__ > execfile(config['__file__'], config) >File "/home/morph/deb/tmp/matplotlib/doc/conf.py", line 23, in > import ipython_console_highlighting > ImportError: No module named ipython_console_highlighting > >> /home/morph/deb/tmp/matplotlib/doc/conf.py(23)() >> > -> import ipython_console_highlighting > > indeed > > matplotlib/doc$ grep -ri ipython_console_highlighting * > conf.py:import ipython_console_highlighting > $ > > Is that module benn {re.}moved? > > Regards, > -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Comparing pdf output in tests
Jouni K. Seppänen wrote: > John Hunter writes: > > >>>pyplot.savefig('foo1') >>> >> Take a look at the pyplot "switch_backends" function. >> > > Yes, that function was on the next line after the part you quoted. :-) > It calls matplotlib.use with warn=False, but that function ends up doing > nothing. > > >> Alternatively, agg knows how to save pdf if given the extension, so we >> could wire up the testing to use a module level extension set >> somewhere which could be updated for each backend. This is probably >> safer and cleaner than switch_backends >> > > That sounds complicated. How about having the test cases call savefig > with all the relevant file formats? That doesn't look so nice if the > test cases end up with a big block of savefig calls, but it has the > advantage that there is no magic involved and it is very obvious what is > going on. > Sorry, I should have been more clear. I was thinking that the image_compare() decorator would call the test function multiple times, having switched the backend between invocations. Thus, the call to savefig() would continue not to explicitly set the extension. I've quickly modified the source to reflect my idea, but I haven't had a chance to flesh it out or test it. It should show the idea, though. See attached. -Andrew diff --git a/lib/matplotlib/testing/decorators.py b/lib/matplotlib/testing/decorators.py index 6363663..53b276b 100644 --- a/lib/matplotlib/testing/decorators.py +++ b/lib/matplotlib/testing/decorators.py @@ -48,42 +48,50 @@ def image_comparison(baseline_images=None): raise ValueError('baseline_images must be specified') def compare_images_decorator(func): def decorated_compare_images(*args,**kwargs): -result = func(*args,**kwargs) -extension = '.png' # TODO: test more backends -for fname in baseline_images: -# FIXME: place "actual", or current images, images in -# a more reasonable location than the current -# directory. Also, perhaps put them in sub-directory -# according to the name of the test module like the -# baseline images. -actual = fname + extension -# compute filename for baseline image -module_name = func.__module__ -if module_name=='__main__': -# FIXME: this won't work for nested packages in matplotlib.tests -import warnings -warnings.warn('test module run as script. guessing baseline image locations') -script_name = sys.argv[0] -basedir = os.path.abspath(os.path.dirname(script_name)) -subdir = os.path.splitext(os.path.split(script_name)[1])[0] -else: -mods = module_name.split('.') -assert mods.pop(0)=='matplotlib' -assert mods.pop(0)=='tests' -subdir = os.path.join(*mods) -basedir = os.path.dirname(matplotlib.tests.__file__) -baseline_dir = os.path.join(basedir,'baseline_images',subdir) -expected = os.path.join(baseline_dir,fname) + extension +# compute baseline image directory +module_name = func.__module__ +if module_name=='__main__': +# FIXME: this won't work for nested packages in matplotlib.tests +import warnings +warnings.warn('test module run as script. guessing baseline image locations') +script_name = sys.argv[0] +basedir = os.path.abspath(os.path.dirname(script_name)) +subdir = os.path.splitext(os.path.split(script_name)[1])[0] +else: +mods = module_name.split('.') +assert mods.pop(0)=='matplotlib' +assert mods.pop(0)=='tests' +subdir = os.path.join(*mods) +basedir = os.path.dirname(matplotlib.tests.__file__) +baseline_dir = os.path.join(basedir,'baseline_images',subdir) -# compare the images -tol=1e-3 # default tolerance -err = compare_images( expected, actual, tol, - in_decorator=True ) -if err: -raise ImageComparisonFailure( -'images not close: %(actual)s vs. %(expected)s ' -'(RMS %(rms).3f)'%err) -return result +for extension in ['.png', '.pdf']: +switch_backends_somehow(extension) # FIXME: implement this +last_result = func(*args,**kwargs) # actually call the test function +for fname in baseline_images: +# FIXME: place "actual", or current images, images in +# a more reasonable location than the current +
Re: [matplotlib-devel] Comparing pdf output in tests
On Wed, Sep 23, 2009 at 12:42 PM, Andrew Straw wrote: > Sorry, I should have been more clear. I was thinking that the > image_compare() decorator would call the test function multiple times, > having switched the backend between invocations. Thus, the call to > savefig() would continue not to explicitly set the extension. I've > quickly modified the source to reflect my idea, but I haven't had a > chance to flesh it out or test it. It should show the idea, though. See > attached. Why not have the decorator pass the extension in to the test funcs -- agg can print to pdf, ps, svg and png -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Comparing pdf output in tests
John Hunter wrote: > On Wed, Sep 23, 2009 at 12:42 PM, Andrew Straw wrote: > > >> Sorry, I should have been more clear. I was thinking that the >> image_compare() decorator would call the test function multiple times, >> having switched the backend between invocations. Thus, the call to >> savefig() would continue not to explicitly set the extension. I've >> quickly modified the source to reflect my idea, but I haven't had a >> chance to flesh it out or test it. It should show the idea, though. See >> attached. >> > > Why not have the decorator pass the extension in to the test funcs -- > agg can print to pdf, ps, svg and png > I'm not sure what you're suggesting. Presumably if we're driving agg OK to draw .png, it will also draw .pdf OK (or does it have a pdf vector backend independent of the MPL pdf backend that we want to test separately?) I was just thinking it would be easiest to have test functions that look like: @image_comparison('my_figure') def my_figure_test(): plt.plot([1,2,3],[4,5,6]) plt.savefig('my_figure') This could automatically test all backends we have the infrastructure and the baseline images for. It doesn't force the test writer to worry about that stuff. -Andrew -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] plt.figure() causes crash on OS X 10.5.7, Py26 binaries
(reply-all this time, I'm too used to scipy.org's reply-to munging) On 18-Sep-09, at 9:36 PM, John Hunter wrote: > On Fri, Sep 18, 2009 at 7:01 PM, Andrew Straw > wrote: > >> Maybe the MPL binary was built with a numpy svn version that had API >> incompatibilities with numpy releases? > > I built the python2.6 OSX 0.99.1rc1 binary with the numpy from the > 1.3.0 dmg installer from the sf site, intentionally not using my local > numpy from svn since I understand there are some ABI incompatibilities > between 1.3.0 and 1.4.0svn and I wanted to target the latest release. > What version are you using David? Sorry for leaving this thread dangling. I was using the latest numpy SVN head, that was probably the issue. I've since built matplotlib from source without incident. David -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] "ValueError: too many values to unpack" building docs
On Wed, Sep 23, 2009 at 19:21, Michael Droettboom wrote: > That file was moved. I think I had a lingering .pyc lying around which is > why it didn't fail on me. yeah, here too: I saw it only after cleaning up the svn checkout. > I have updated conf.py to import it from the > right place. Hopefully it's working now. Yeah, it works fine: thanks for the fixes. Cheers, -- Sandro Tosi (aka morph, morpheus, matrixhasu) My website: http://matrixhasu.altervista.org/ Me at Debian: http://wiki.debian.org/SandroTosi -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Comparing pdf output in tests
On Wed, Sep 23, 2009 at 12:56 PM, Andrew Straw wrote: > John Hunter wrote: >> On Wed, Sep 23, 2009 at 12:42 PM, Andrew Straw wrote: >> >> >>> Sorry, I should have been more clear. I was thinking that the >>> image_compare() decorator would call the test function multiple times, >>> having switched the backend between invocations. Thus, the call to >>> savefig() would continue not to explicitly set the extension. I've >>> quickly modified the source to reflect my idea, but I haven't had a >>> chance to flesh it out or test it. It should show the idea, though. See >>> attached. >>> >> >> Why not have the decorator pass the extension in to the test funcs -- >> agg can print to pdf, ps, svg and png >> > I'm not sure what you're suggesting. Presumably if we're driving agg OK > to draw .png, it will also draw .pdf OK (or does it have a pdf vector > backend independent of the MPL pdf backend that we want to test separately?) No, it doesn't have a separate backend, but the backend_agg figure canvas savefig method knows how to create FigureCanvasPDF etc to use that backend to write the file w/o having to switch the default backend with all the attendant hassles. So if you are using *Agg, and do savefig(somefile.pdf) agg will load the native pdf backend and use it. So I was envisioning def test_something(ext): make_plot fig.savefig('myfile.%s'%ext) and having the decorator pass in the extensions it wants one-by-one JDH -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Comparing pdf output in tests
John Hunter wrote: > On Wed, Sep 23, 2009 at 12:56 PM, Andrew Straw wrote: > >> John Hunter wrote: >> >>> On Wed, Sep 23, 2009 at 12:42 PM, Andrew Straw wrote: >>> >>> >>> Sorry, I should have been more clear. I was thinking that the image_compare() decorator would call the test function multiple times, having switched the backend between invocations. Thus, the call to savefig() would continue not to explicitly set the extension. I've quickly modified the source to reflect my idea, but I haven't had a chance to flesh it out or test it. It should show the idea, though. See attached. >>> Why not have the decorator pass the extension in to the test funcs -- >>> agg can print to pdf, ps, svg and png >>> >>> >> I'm not sure what you're suggesting. Presumably if we're driving agg OK >> to draw .png, it will also draw .pdf OK (or does it have a pdf vector >> backend independent of the MPL pdf backend that we want to test separately?) >> > > No, it doesn't have a separate backend, but the backend_agg figure > canvas savefig method knows how to create FigureCanvasPDF etc to use > that backend to write the file w/o having to switch the default > backend with all the attendant hassles. So if you are using *Agg, and > do > > savefig(somefile.pdf) > > agg will load the native pdf backend and use it. So I was envisioning > > def test_something(ext): >make_plot >fig.savefig('myfile.%s'%ext) > > and having the decorator pass in the extensions it wants one-by-one > I see. Is there something like backend_agg.set_default_savefig_extension()? That would achieve both of our goals. So maybe if it doesn't exist it would be easy to add in? -Andrew -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel