Re: [matplotlib-devel] matplotlib 1.0.1rc available for testing, building

2011-01-04 Thread Derek Homeier

On 04.01.2011, at 1:49AM, Russell E. Owen wrote:


I have uploaded Mac installers for python.org Python 2.6 and 32-bit
Python 2.7.

I'm not sure what to do about 64-bit Python 2.7. It does not even
support Mac OS X 10.5 due to tcl/tk issues that I think were resolved
too late for python 2.7.1. In my opinion a matplotlib built against
ActiveState's Python 2.7 (which is 64-bit and supports 10.5 and 10.6)
might be of more use. Opinions?


I cannot provide much input on those Python installations, but I've  
built rc1
against the fink installations of python/numpy for Intel and PPC 10.5  
as well
as Intel 10.6. I could not reproduce the  
missing .matplotlib/.fontconfig-related

crashes with this build.

With the 64-bit installation on 10.6 I encountered a problem discussed  
a few months
ago on the list, due to the MacOS module being removed from standard  
64-bit Python
builds (and being generally deprecated for Python 3); this had been  
resolved by
Michiel de Hoon in r8624 (and some parts in r8710, it seems), but  
those changes did
not make it into rc1. I have attached the patch in the form working  
for me.


HTH,
Derek



matplotlib-py.patch
Description: Binary data



P.S. Test outcome is somewhat different between calling pylab.test()  
from the interpreter


Python 2.6.6 (r266:84292, Jan  3 2011, 20:49:26)
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pylab
>>> pylab.test('full')
Running unit tests for numpy.linalg
/sw/lib/python2.6/site-packages/nose/plugins/manager.py:407:  
UserWarning: Module dap was already imported from None, but /sw/lib/ 
python2.6/site-packages is being added to sys.path

  import pkg_resources
NumPy version 1.5.1
NumPy is installed in /sw/lib/python2.6/site-packages/numpy
Python version 2.6.6 (r266:84292, Jan  3 2011, 20:49:26) [GCC 4.2.1  
(Apple Inc. build 5664)]

nose version 0.11.4
S 
...

--
Ran 156 tests in 0.374s


or directly calling nosetests in the matplotlib directory (same errors  
occurring with python2.7 and on
10.5 x86/ppc, just the FAIL:  
matplotlib.tests.test_mlab.test_recarray_csv_roundtrip only appears

on 64-bit 10.6):

> nosetests2.6
/sw/bin/nosetests2.6:5: UserWarning: Module dap was already imported  
from None, but /sw/lib/python2.6/site-packages is being added to  
sys.path

  from pkg_resources import load_entry_point
/sw/lib/python2.6/site-packages/matplotlib/rcsetup.py:302:  
UserWarning: tk.pythoninspect is obsolete, and has no effect

  warnings.warn("tk.pythoninspect is obsolete, and has no effect")
/sw/lib/python2.6/site-packages/matplotlib/numerix/__init__.py:18:  
DeprecationWarning:

**
matplotlib.numerix and all its subpackages are deprecated.
They will be removed soon.  Please use numpy instead.
**

  warnings.warn(msg, DeprecationWarning)
.Warning: divide by zero  
encountered in log

.Warning: divide by zero encountered in log
.Warning: divide by zero encountered in log
EE/sw/lib/python2.6/site-packages/ 
matplotlib/axes.py:2381: UserWarning: Attempting to set identical  
left==right results

in singular transformations; automatically expanding.
left=730139.0, right=730139.0
  + 'left=%s, right=%s') % (left, right))
...EE.Warning: invalid value encountered in  
absolute

Warning: invalid value encountered in absolute
F./sw/lib/python2.6/site-packages/ 
matplotlib/font_manager.py:1242: UserWarning: findfont: Font family  
['Foo'] not found. Falling back to Bitstream Vera Sans

  (prop.get_family(), self.defaultFamily[fontext]))
E.E
==
ERROR: matplotlib.tests.test_axes.test_pcolormesh
--
Traceback (most recent call last):
  File "/sw/lib/python2.6/site-packages/nose/case.py", line 186, in  
runTest

self.test(*self.arg)
  File "/sw/lib/python2.6/site-packages/matplotlib/testing/ 
decorators.py", line 32, in failer

result = f(*args, **kwargs)
  File "/sw/lib/python2.6/site-packages/matplotlib/testing/ 
decorators.py", line 126, in decorated_compare_images

'(RMS %(rms).3f)'%err)
ImageComparisonFailure: images not close: /sw/lib/python2.6/site- 
packages/matplotlib/result_images/test_axes/pcolormesh.png vs. /sw/lib/ 
python2.6/site-packages/matplotlib/result_images/test_axes/expected- 
pcolormesh.png (RMS 116.512)


==
ERROR: matplotli

Re: [matplotlib-devel] matplotlib 1.0.1rc available for testing, building

2011-01-04 Thread John Hunter
On Tue, Jan 4, 2011 at 9:15 AM, Derek Homeier <
de...@astro.physik.uni-goettingen.de> wrote:

>
>
> With the 64-bit installation on 10.6 I encountered a problem discussed a
> few months
> ago on the list, due to the MacOS module being removed from standard 64-bit
> Python
> builds (and being generally deprecated for Python 3); this had been
> resolved by
> Michiel de Hoon in r8624 (and some parts in r8710, it seems), but those
> changes did
> not make it into rc1. I have attached the patch in the form working for me.
>

Michiel, can you review this and if it looks good contribute it to the 1.0.1
branch?

http://matplotlib.sourceforge.net/devel/coding_guide.html#version-control

Thanks,
JDH
--
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Building documentation and matplotlibrc

2011-01-04 Thread Sandro Tosi
Hi all,

On Thu, Dec 9, 2010 at 23:04, Ben Gamari  wrote:
> On Thu, 09 Dec 2010 16:44:37 -0500, Ben Gamari  wrote:
>> rcdefaults()'s implementation appears to implement the latter, updating
>> rcParams from rcParamsDefault in rcsetup.py, which appears to describe
>> the factory default values. Perhaps we should
>> rcParamsDefault.update(rcParams) after loading matplotlibrc?
>>
> As expected, doing the update of rcParamsDefault proposed above (patch
> below) allows the examples.download setting to persist throughout the
> documentation build. It seems like either the documentation build
> process or rcParamsDefault has been badly broken for a very long
> time. Is rcParamsDefault really supposed to be the factory defaults or
> is this just a bug? If the former, we will need to introduce a variant
> of matplotlib.rcdefaults() to reset the configuration to that specified
> in matplotlibrc.
>
> - Ben
>
>
> diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py
> --- a/lib/matplotlib/__init__.py
> +++ b/lib/matplotlib/__init__.py
> @@ -764,13 +772,13 @@ Please do not ask for support with these customizations 
> active.
>
>  # this is the instance used by the matplotlib classes
>  rcParams = rc_params()
> -
> -rcParamsDefault = RcParams([ (key, default) for key, (default, converter) in 
> \
> -                    defaultParams.iteritems() ])
> -
>  rcParams['ps.usedistiller'] = 
> checkdep_ps_distiller(rcParams['ps.usedistiller'])
>  rcParams['text.usetex'] = checkdep_usetex(rcParams['text.usetex'])
>
> +rcParamsDefault = RcParams([ (key, default) for key, (default, converter) in 
> \
> +                     defaultParams.iteritems() ])
> +rcParamsDefault.update(rcParams)
> +
>  def rc(group, **kwargs):
>     """
>     Set the current rc params.  Group is the grouping for the rc, eg.

With this patch we can indeed finally use the sampledata local dir -
thanks Ben for that!! anyhow, it seems to be quite a radical change,
that might have a bit of impact on what the users can experience, so
I'd like to hear from mpl devels what's the feelings about that.

Anyhow, please note that examples.directory RC param, must not
contains apex (') at the beginning/end of the value, else it would
fail; the example in matplotlibrc.template seems to suggests it's
apex-enclosed:

  #examples.directory : ''   # directory to look in if download is false

else you would get:

  IOError: [Errno 2] No such file or directory:
"'/home/morph/deb/build-area/matplotlib-1.0.1~rc1/sampledata/'/axes_grid/bivariate_normal.npy"

it should be made it clearer (or make the get_sample_data() smarter) about that.

Cheers,
-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi

--
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] two gridspec patches (fix getitem bug and docs)

2011-01-04 Thread Paul Ivanov
Hi matplotlib developers,

I was answering a question on the -users list and came across a
gridspec __getitem__ bug which causes an infinite loop if the
user tries to iterate over it, because getitem never did a
sanity-check when given an integer key.

  from matplotlib import gridspec
  gs = gridspec.GridSpec(1,2)
  gs[100] # no error is given, a SubplotSpec is returned 
  [x for x in gs] # causes infinite loop before applying patch

  # after applying the patch - which is just lines 171-172 in the
  # traceback below
  In [9]: gs[100]
  --
  IndexError   Traceback (most recent call last)
  
  ./matplotlib/ in ()
  
  ./matplotlib/gridspec.pyc
  in __getitem__(self, key)
  170key += total
  171if key >= total or key < 0:
  --> 172raise IndexError("index out of range")
  173num1, num2 = key, None
  174 
  
  IndexError: index out of range
  
  In [10]: [x for x in gs]
  Out[10]: 
  
  [,
   ]


I'm also including a patch for the gridspec docs which create a
grid-of-grids using gridspec in a colorful manner. Note that
there, I explicitly create indexes in the right range, like so:

  outer_grid = GridSpec(4, 4)
  for i in xrange(16):
inner_grid = GridSpecFromSubplotSpec(3, 3, subplot_spec=outer_grid[i])
for j in xrange(9):
  ax = plt.Subplot(f, inner_grid[j])
  ...

because before applying the getitem patch described above, one
*can't* currently iterate over the spec itself like this:

  outer_grid = GridSpec(4, 4)
  for cell in outer_grid:
inner_grid = GridSpecFromSubplotSpec(3, 3, subplot_spec=cell)
for subcell in inner_grid:
  ax = plt.Subplot(f, subcell)
  ...

The doc patch also fixes the currently broken .. _gridspec-guide:
anchor name which can be seen peeking out at the top of:
http://matplotlib.sourceforge.net/users/gridspec.html

because there was previously a misplaced leading \ on line 1 of
doc/users/gridspec.rst

best,
-- 
Paul Ivanov
314 address only used for lists,  off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 
Index: doc/users/plotting/examples/demo_gridspec06.py
===
--- doc/users/plotting/examples/demo_gridspec06.py	(revision 0)
+++ doc/users/plotting/examples/demo_gridspec06.py	(revision 0)
@@ -0,0 +1,41 @@
+import matplotlib.pyplot as plt
+import matplotlib.gridspec as gridspec
+import numpy as np
+from itertools import product
+
+def squiggle_xy(a, b, c, d, i=np.arange(0.0, 2*np.pi, 0.05)):
+return np.sin(i*a)*np.cos(i*b), np.sin(i*c)*np.cos(i*d)
+
+f = plt.figure(figsize=(8, 8))
+
+# gridspec inside gridspec
+outer_grid = gridspec.GridSpec(4, 4, wspace=0.0, hspace=0.0)
+
+for i in xrange(16):
+inner_grid = gridspec.GridSpecFromSubplotSpec(3, 3,
+subplot_spec=outer_grid[i], wspace=0.0, hspace=0.0)
+a, b = int(i/4)+1,i%4+1
+for j, (c, d) in enumerate(product(range(1, 4), repeat=2)):
+ax = plt.Subplot(f, inner_grid[j])
+ax.plot(*squiggle_xy(a, b, c, d))
+ax.set_xticks([])
+ax.set_yticks([])
+f.add_subplot(ax)
+
+all_axes = f.get_axes()
+
+#show only the outside spines
+for ax in all_axes:
+for sp in ax.spines.values():
+sp.set_visible(False)
+if ax.is_first_row():
+ax.spines['top'].set_visible(True)
+if ax.is_last_row():
+ax.spines['bottom'].set_visible(True)
+if ax.is_first_col():
+ax.spines['left'].set_visible(True)
+if ax.is_last_col():
+ax.spines['right'].set_visible(True)
+
+plt.show()
+
Index: doc/users/gridspec.rst
===
--- doc/users/gridspec.rst	(revision 8885)
+++ doc/users/gridspec.rst	(working copy)
@@ -1,4 +1,4 @@
-\.. _gridspec-guide:
+.. _gridspec-guide:
 
 
 
@@ -129,6 +129,16 @@
 .. plot:: users/plotting/examples/demo_gridspec04.py
 
 
+A Complex Nested GridSpec using SubplotSpec
+===
+
+Here's a more sophisticated example of nested gridspec where we put
+a box around each cell of the outer 4x4 grid, by hiding appropriate 
+spines in each of the inner 3x3 grids. ::
+
+.. plot:: users/plotting/examples/demo_gridspec06.py
+
+
 GridSpec with Varying Cell Sizes
 
 
Index: lib/matplotlib/gridspec.py
===
--- lib/matplotlib/gridspec.py	(revision 8885)
+++ lib/matplotlib/gridspec.py	(working copy)
@@ -167,6 +167,8 @@
 else:
 if key < 0:
 key += total
+if key >= total or key < 0:
+raise IndexError("index out of range")
 num1, num2 = key, None
 
 


signature.asc
Description: Digital signature
--

Re: [matplotlib-devel] two gridspec patches (fix getitem bug and docs)

2011-01-04 Thread Benjamin Root
2011/1/4 Paul Ivanov 

> Hi matplotlib developers,
>
> I was answering a question on the -users list and came across a
> gridspec __getitem__ bug which causes an infinite loop if the
> user tries to iterate over it, because getitem never did a
> sanity-check when given an integer key.
>
>  from matplotlib import gridspec
>  gs = gridspec.GridSpec(1,2)
>  gs[100] # no error is given, a SubplotSpec is returned
>  [x for x in gs] # causes infinite loop before applying patch
>
>  # after applying the patch - which is just lines 171-172 in the
>  # traceback below
>  In [9]: gs[100]
>  --
>  IndexError   Traceback (most recent call last)
>
>  ./matplotlib/ in ()
>
>  ./matplotlib/gridspec.pyc
>  in __getitem__(self, key)
>  170key += total
>  171if key >= total or key < 0:
>  --> 172raise IndexError("index out of range")
>  173num1, num2 = key, None
>  174
>
>  IndexError: index out of range
>
>
Does this patch prevent the use of negative indexes?  If so, then we might
want to rethink that in order to be more consistent with numpy arrays and
python lists...

Ben Root
--
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] two gridspec patches (fix getitem bug and docs)

2011-01-04 Thread Paul Ivanov
Benjamin Root, on 2011-01-04 19:48,  wrote:
> 2011/1/4 Paul Ivanov 
> 
> > Hi matplotlib developers,
> >
> > I was answering a question on the -users list and came across a
> > gridspec __getitem__ bug which causes an infinite loop if the
> > user tries to iterate over it, because getitem never did a
> > sanity-check when given an integer key.
> >
> >  from matplotlib import gridspec
> >  gs = gridspec.GridSpec(1,2)
> >  gs[100] # no error is given, a SubplotSpec is returned
> >  [x for x in gs] # causes infinite loop before applying patch
> Does this patch prevent the use of negative indexes?  If so, then we might
> want to rethink that in order to be more consistent with numpy arrays and
> python lists...

No, it does not prevent the use of negative indexes, and ensures
that the negative index is within the allowed bounds, so we do
the right thing. Here's the full patch for context:

lib/matplotlib/gridspec.py
169 else:
170 if key < 0:
171 key += total
172+if key >= total or key < 0:
173+raise IndexError("index out of range")
174 num1, num2 = key, None


As you can see, the reason line 172 has the key < 0 check is
because the allowed range of negative indexes gets dealt with on
the two preceding lines. So for gs=gridspec.GridSpec(1,2);
Both gs[-1] and gs[-2] are legal, but gs[-3] will raise an
IndexError.

-- 
Paul Ivanov
314 address only used for lists,  off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 


signature.asc
Description: Digital signature
--
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel