Re: [sage-support] Re: Accentuated characters in axes_label

2011-02-16 Thread Ryan Krauss
Maybe this is a lame workaround, but I save all my matplotlib plots as
eps and then run epstopdf.  I actually call epstopdf through os.system
in a custom save function.  I have never had a problem with latex and
saving eps.

On Wed, Feb 16, 2011 at 9:13 PM, Maxim  wrote:
> But this workaround seems to prevent me from saving the fig in pdf (or
> svg):
>
>  File "/opt/SAGE/local/lib/python2.6/site-packages/matplotlib/
> dviread.py", line 727, in _register
>    assert encoding is None
> AssertionError
>
> Here's the code:
> # -*- coding: utf-8 -*-
> from sage.all import *
> import matplotlib as mpl
> mpl.rcParams['text.usetex'] = True
> plt = plot(sin, -pi, pi)
> plt.axes_labels([ 'Valeur', r"\'{E}chantillon" ])
> save(plt,filename='/home/maxim/test.pdf')
>
> Same thing happens if I try to use pyplot instead.
> Any clues or other ideas?
>
> Thanks,
> Maxim
>
> --
> To post to this group, send email to sage-support@googlegroups.com
> To unsubscribe from this group, send email to 
> sage-support+unsubscr...@googlegroups.com
> For more options, visit this group at 
> http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org
>

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: Accentuated characters in axes_label

2011-02-16 Thread Michael Anselmi
On 02/16/2011 10:13 PM, Maxim wrote:
> But this workaround seems to prevent me from saving the fig in pdf (or
> svg):
> 
>  File "/opt/SAGE/local/lib/python2.6/site-packages/matplotlib/
> dviread.py", line 727, in _register
> assert encoding is None
> AssertionError
> 
> Here's the code:
> # -*- coding: utf-8 -*-
> from sage.all import *
> import matplotlib as mpl
> mpl.rcParams['text.usetex'] = True
> plt = plot(sin, -pi, pi)
> plt.axes_labels([ 'Valeur', r"\'{E}chantillon" ])
> save(plt,filename='/home/maxim/test.pdf')
> 
> Same thing happens if I try to use pyplot instead.
> Any clues or other ideas?
> 
> Thanks,
> Maxim

Try replacing `dviread.py' with the latest version from matplotlib's
source code repository (svn trunk revision 8956 or later) and let me
know if this fixes your issue.  This smells of the issue I was having
not so long ago.  See here:
https://groups.google.com/d/topic/sage-support/3UqXw-Bugx8/discussion

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Accentuated characters in axes_label

2011-02-16 Thread Maxim
But this workaround seems to prevent me from saving the fig in pdf (or
svg):

 File "/opt/SAGE/local/lib/python2.6/site-packages/matplotlib/
dviread.py", line 727, in _register
assert encoding is None
AssertionError

Here's the code:
# -*- coding: utf-8 -*-
from sage.all import *
import matplotlib as mpl
mpl.rcParams['text.usetex'] = True
plt = plot(sin, -pi, pi)
plt.axes_labels([ 'Valeur', r"\'{E}chantillon" ])
save(plt,filename='/home/maxim/test.pdf')

Same thing happens if I try to use pyplot instead.
Any clues or other ideas?

Thanks,
Maxim

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Accentuated characters in axes_label

2011-02-16 Thread Maxim
Thanks Michael!

That's a nice workaround.

Should I open a ticket about it in trac? I haven't found this defect
listed there already.

Maxim

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Configuring sage at the bash prompt

2011-02-16 Thread akm
I did a quick-and-dirty edit to the source in devel/sagenb/sagenb/
notebook/run_notebook.py, replacing the raw input for domain name
with:

import socket
dn = socket.gethostname()

Also replaced the body of get_admin_passwd() like so:

def get_admin_passwd():
passwd = 'TopSecret'
return passwd

Seems to work fine for what we're doing; we assume anyone within our
company's firewall is trustworthy.

This way we can have operations write an init script that runs sage
with the reset=True flag, then with the interface='' flag, and we're
up and running.

Thanks again for everyone's suggestions..

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] braces in output of latex() command

2011-02-16 Thread Dmitry Shkirmanov
Hi everyone,  i  use Sage for working with big expressions. To receive
observable output  i use latex's package breqn that can automatically
divide the expression into several lines. But there is the problem
with latex() command. For example here is the code(in notebook):
#
var("a,b,c,d,f,g")
expr=(a - b)*f + (c - d)*g
latex(expr)
#
Output of this code is:
#
{\left(c - d\right)} g + {\left(a - b\right)} f
#
Breqn package can not divide expression into lines if it is included
ino braces { }. So, expression above can be automatically divided only
into two lines, like this:
{\left(c - d\right)} g + \\
 {\left(a - b\right)} f
But, if  the braces { } are removed, i.e
\left(c - d\right) g + \left(a - b\right) f
then the breqn package can divide this expression very well, for
example like this
(c - \\
d) g + \\
 (a - \\
 b) f \\
(Of course, it is just example, actual expression is more complicated)
#
Is it possible to remove braces { } from output of command latex()?
I.e. i want that the output of
#
var("a,b,c,d,f,g")
expr=(a - b)*f + (c - d)*g
latex(expr)
#
was
\left(c - d\right) g + \left(a - b\right) f
instead of
{\left(c - d\right)} g + {\left(a - b\right)} f

Help me please, i very need it.
P.S. Sorry for my rough english.


-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] [ANN] New package: SpaceFuncs (2D, 3D, ND geometric modeling, optimization, solving)

2011-02-16 Thread dmitrey
Hi all,
I'm glad to inform you about new, 4th OpenOpt Suite module:

SpaceFuncs - a tool for 2D, 3D, N-dimensional geometric modeling with
possibilities of parametrized calculations, numerical optimization and
solving systems of geometrical equations.

The module is written in Python + NumPy, requires FuncDesigner (and
OpenOpt, DerApproximator for some operations). It has completely free
license: BSD.

For details see its home page
http://openopt.org/SpaceFuncs
and documentation
http://openopt.org/SpaceFuncsDoc

Also, you can try it online via our Sage-server
http://sage.openopt.org/welcome

Regards,
Dmitrey.

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Accentuated characters in axes_label

2011-02-16 Thread Michael Anselmi
Maxim wrote:
> Hi all,
>
> I haven't figured out how to do this one. I'm trying the following:
>
> A=plot(sin,-2,2)
> A.axes_labels(['Valeur','Échantillon'])
> A
>
> The 'É' is shown as an empty block. [...]

Hi Maxim,

The only solution I've found is to direct Sage's matplotlib to process
plot text with LaTeX:


#!/usr/bin/env sage-python
# -*- coding: utf-8 -*-

from sage.all import *
import matplotlib as mpl
mpl.rcParams['text.usetex'] = True

plt = plot(sin, -pi, pi)
plt.axes_labels([ r'Valeur', r"\'{E}chantillon" ])

plt.show()


Interestingly enough, the following does work with the Enthought
Python Distribution, but *only* if the `coding: utf-8' line is
included (and LaTeX is not handling plot text):


#!/usr/bin/env python
# -*- coding: utf-8 -*-

import matplotlib.pyplot as plt
from numpy import linspace, sin

t = linspace(-2, 2, endpoint=True)
plt.plot(t, sin(t))

plt.xlabel('Valeur')
plt.ylabel(u'Échantillon')

plt.show()


This even works with LaTeX processing when EPD's `matplotlibrc'
configuration file contains `text.latex.unicode = True'.

Hope this helps.

Michael

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Accentuated characters in axes_label

2011-02-16 Thread Michael Anselmi
Maxim wrote:
> Hi all,
>
> I haven't figured out how to do this one. I'm trying the following:
>
> A=plot(sin,-2,2)
> A.axes_labels(['Valeur','Échantillon'])
> A
>
> The 'É' is shown as an empty block. [...]

Hi Maxim,

The only solution I've found is to direct Sage's matplotlib to process
plot text with LaTeX:


#!/usr/bin/env sage-python
# -*- coding: utf-8 -*-

from sage.all import *
import matplotlib as mpl
mpl.rcParams['text.usetex'] = True

plt = plot(sin, -pi, pi)
plt.axes_labels([ r'Valeur', r"\'{E}chantillon" ])

plt.show()


Interestingly enough, the following does work with the Enthought
Python Distribution, but *only* if the `coding: utf-8' line is
included (and LaTeX is not handling plot text):


#!/usr/bin/env python
# -*- coding: utf-8 -*-

import matplotlib.pyplot as plt
from numpy import linspace, sin

t = linspace(-2, 2, endpoint=True)
plt.plot(t, sin(t))

plt.xlabel('Valeur')
plt.ylabel(u'Échantillon')

plt.show()


This even works with LaTeX processing when EPD's `matplotlibrc'
configuration file contains `text.latex.unicode = True'.

Hope this helps.

Michael

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org