[matplotlib-devel] Sage patches to matplotlib

2009-08-09 Thread jason-sage
Here are a few patches that we in Sage have been applying to our version 
of matplotlib.  I'm wondering if some or all of these might be 
incorporated into matplotlib, or if not, if you could comment on these 
patches.  I've updated the following diffs to be against 0.99.0.  I've 
separated the patches with a bunch of dashes.


lib/matplotlib/cbook.py: The background information for this patch is 
found at http://trac.sagemath.org/sage_trac/ticket/1967 and 
http://groups.google.com/group/sage-support/browse_thread/thread/edcf2740f7276e6a?hl=en#78ee7d78a0a99f12

--- src/lib/matplotlib/cbook.py2009-08-01 12:15:07.0 -0700
+++ patches/cbook.py2009-08-08 23:15:21.0 -0700
@@ -14,7 +14,10 @@
 
 
 # on some systems, locale.getpreferredencoding returns None, which can 
break unicode
-preferredencoding = locale.getpreferredencoding()
+try:
+preferredencoding = locale.getpreferredencoding()
+except:
+preferredencoding = None
 
 def unicode_safe(s):
 if preferredencoding is None: return unicode(s)



---


lib/matplotlib/patches.py:  The comment attached to this patch was  '* 
Add a patch for patches.py, which ignores the errors generated when 
trying to draw arrows that are "too short".'  I actually made this 
patch, so if it isn't obvious what the patch is doing and why it was 
causing an error before, I can try to remember and construct an example.

--- src/lib/matplotlib/patches.py2009-08-01 12:15:07.0 -0700
+++ patches/patches.py2009-08-08 23:25:09.0 -0700
@@ -2326,15 +2326,21 @@
 x, y = path.vertices[0]
 insideA = inside_circle(x, y, shrinkA)
 
-left, right = split_path_inout(path, insideA)
-path = right
+try:
+left, right = split_path_inout(path, insideA)
+path = right
+except ValueError:
+pass
 
 if shrinkB:
 x, y = path.vertices[-1]
 insideB = inside_circle(x, y, shrinkB)
 
-left, right = split_path_inout(path, insideB)
-path = left
+try:
+left, right = split_path_inout(path, insideB)
+path = left
+except ValueError:
+pass
 
 return path
 


---
ttconv/pprdrv_tt2.cpp: This patch is *only* applied when `uname` = 
"SunOS".  The comment is: Copy patched version of pprdrv_tt2.cpp for 
Solaris 10 that builds with gcc 4.3.2.


--- src/ttconv/pprdrv_tt2.cpp2009-08-01 12:15:15.0 -0700
+++ patches/pprdrv_tt2.cpp2009-08-08 23:33:24.0 -0700
@@ -104,7 +104,8 @@
 {/* have a log of points. */
 if(stack_depth == 0)
 {
-stream.put_char('{');
+//  Note the below is a hack to make it compile on Solaris 
10 with gcc 4.3.2
+stream.puts("{");
 stack_depth=1;
 }
 




setupext.py: The background for this patch is here: 
http://trac.sagemath.org/sage_trac/ticket/4176


--- src/setupext.py 2009-08-01 12:15:24.0 -0700
+++ patches/setupext.py 2009-08-08 23:43:29.0 -0700
@@ -1034,6 +1038,7 @@
 #  of distros.
 
 # Query Tcl/Tk system for library paths and version string
+tk_ver = ''
 try:
 tcl_lib_dir, tk_lib_dir, tk_ver = query_tcltk()
 except:



Thanks!

Jason





--
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] Adding Shades Keyword to 3D routines.

2009-08-09 Thread Reinier Heeres
Hi John,

I've seen them both and will apply try to fix them. I've also
submitted a support request to sourceforge to see if they can fix the
bug assignment issue. It's ok if you assign mplot3d bugs to me then.

Cheers,
Reinier

On Sat, Aug 8, 2009 at 2:33 PM, John Hunter wrote:
> On Fri, Aug 7, 2009 at 8:27 AM, Reinier Heeres wrote:
>> Hi,
>>
>> This looks great! I'd be happy to try and work on this for mplot3d as well.
>>
>> Ryan: as for your patch, I'll look at it over the weekend or next week
>> and see if I can apply it to trunk.
>
> Hey Reinier, while you are looking these over, I just wanted to make
> sure you saw these two mplo3d bugs posted on the tracker
>
>  https://sourceforge.net/tracker/?func=detail&aid=2830483&group_id=80706&atid=560720
>  https://sourceforge.net/tracker/?func=detail&aid=2834105&group_id=80706&atid=560720
>
> Normally, I can assign bugs on the tracker to a developer, but for
> some reason even though you are permissioned in the
> "Members" area for the tracker, your sf login isn't showing up in the
> drop down of developers on the bugs page.  If you are unable o manage
> the bug, eg to change the resolution or status, let me know after you
> have taken a look at these and I can close or update them as
> necessary.
>
> JDH
>



-- 
Reinier Heeres
Tel: +31 6 10852639

--
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

2009-08-09 Thread Jouni K . Seppänen
John Hunter  writes:

> * 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 did that in case someone wanted to retrieve files from several
different locations -- my version of the cache handler was not tied to
any particular base URL. Since all cached files were in one flat
directory, there was the danger of filename collisions. 

> * 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 think mirroring a directory structure is somewhat more complicated
than caching a set of arbitrary URLs in a flat cache directory. For
example, I think the remove_stale_files method will need to be changed
to walk all subdirectories, and handling cases such as having a
subdirectory named foo that is replaced by a file named foo could be
complicated.

One thing that's still missing is off-line usage: if the user does not
have net connectivity at the moment but does have the file in the cache,
it should not cause an error.

Perhaps the base URL should be 
http://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/sample_data/
instead of
http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/sample_data/
to avoid dependency on the viewvc service of SourceForge.

-- 
Jouni K. Seppänen
http://www.iki.fi/jks


--
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] Sage patches to matplotlib

2009-08-09 Thread Eric Firing
jason-s...@creativetrax.com wrote:
> Here are a few patches that we in Sage have been applying to our version 
> of matplotlib.  I'm wondering if some or all of these might be 
> incorporated into matplotlib, or if not, if you could comment on these 
> patches.  I've updated the following diffs to be against 0.99.0.  I've 
> separated the patches with a bunch of dashes.

Jason,

I have committed versions of all but the third to the v0.99 branch. 
Please check svn r7442-7444.  I also propagated them to the trunk.  If 
you have any questions or reservations about the modifications I made, 
please raise them!  (The modification to #1 is because blanket "except:" 
is highly discouraged in mpl, and seemed unnecessary here.  The 
modification to #4 is for code clarity, to make it even more obvious 
that the empty string is used as the version only in case of an exception.)

I did not commit #3.  Apart from my lack of c++ expertise, I don't know 
how to implement it so that it takes effect only in the Solaris case. 
Therefore I am leaving this for John; or maybe he will pass it to Mike 
when he comes back from vacation.  Below, I am deleting all but #3, to 
make it easier for John to see what we are talking about.

Eric

> ---
> ttconv/pprdrv_tt2.cpp: This patch is *only* applied when `uname` = 
> "SunOS".  The comment is: Copy patched version of pprdrv_tt2.cpp for 
> Solaris 10 that builds with gcc 4.3.2.
> 
> 
> --- src/ttconv/pprdrv_tt2.cpp2009-08-01 12:15:15.0 -0700
> +++ patches/pprdrv_tt2.cpp2009-08-08 23:33:24.0 -0700
> @@ -104,7 +104,8 @@
>  {/* have a log of points. */
>  if(stack_depth == 0)
>  {
> -stream.put_char('{');
> +//  Note the below is a hack to make it compile on Solaris 
> 10 with gcc 4.3.2
> +stream.puts("{");
>  stack_depth=1;
>  }
>  
> 
> 
> 

--
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

2009-08-09 Thread John Hunter
On Sun, Aug 9, 2009 at 2:01 PM, Jouni K. Seppänen wrote:

> I think mirroring a directory structure is somewhat more complicated
> than caching a set of arbitrary URLs in a flat cache directory. For
> example, I think the remove_stale_files method will need to be changed
> to walk all subdirectories, and handling cases such as having a
> subdirectory named foo that is replaced by a file named foo could be
> complicated.
>
> One thing that's still missing is off-line usage: if the user does not
> have net connectivity at the moment but does have the file in the cache,
> it should not cause an error.
>
> Perhaps the base URL should be
> http://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/sample_data/
> instead of
> http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/sample_data/
> to avoid dependency on the viewvc service of SourceForge.

Would you like to take a crack at these fixes?  I have scipy coming up
and need to start getting my tutorial material together, so I am not
going to have a lot of time for bug fixes, though I would be happy to
get as many fixes and patches in next week and try to get one bugfix
0.99.1 out before scipy.

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] Sage patches to matplotlib

2009-08-09 Thread John Hunter
On Sun, Aug 9, 2009 at 7:48 PM, Eric Firing wrote:

> I did not commit #3.  Apart from my lack of c++ expertise, I don't know how
> to implement it so that it takes effect only in the Solaris case. Therefore
> I am leaving this for John; or maybe he will pass it to Mike when he comes
> back from vacation.  Below, I am deleting all but #3, to make it easier for
> John to see what we are talking about.

I can try and take a look at this tomorrow.  I do have a solaris box
at work to test on, but we are on an older version of gcc.  Ideally,
we could find a c preprocessor macro to indicate the platform rather
than do an uname conditioned patch.  If anyone knows of a platform
macro for solaris to check for, let me know.

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