[sage-support] Image processing

2015-06-16 Thread avi kaur
Hello Everybody


I am trying to do image processing in sage but unable to do so. I started 
with following code and got an error while reading an image.


sage: pylab.imshow(misc.lena())

sage: from numpy import *
sage: import scipy.ndimage
sage: import matplotlib.image
sage: import matplotlib.pyplot
sage: img = matplotlib.image.imread('/home/avi/Desktop/cat.jpg')
---
IOError   Traceback (most recent call last)
 in ()
> 1 img = matplotlib.image.imread('/home/avi/Desktop/cat.jpg')

/opt/sageL/local/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/image.pyc
 
in imread(fname, format)
   1240 
   1241 if ext not in handlers.iterkeys():
-> 1242 im = pilread(fname)
   1243 if im is None:
   1244 raise ValueError('Only know how to handle extensions: 
%s; '


-- Avi kaur

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] quaternion norm

2015-06-16 Thread Ben P
I am tracking rotation of an object using quaternions by accumulating each 
successive rotation using quaternion composition.
I notice that probably due to rounding errors, the norm of each successive 
quaternion is drifting from being 1, which means I need to normalize the 
quaternion.
Is there an in-build function that would let me do this? 
Otherwise, I can divide the quaternion by its norm. Is there a method I can 
call on the quaternion to extract its norm?

I looked at the Quaternion documentation page but did not find anything 
there Here is the page I am referring 
to: 
http://doc.sagemath.org/html/en/reference/quat_algebras/sage/algebras/quatalg/quaternion_algebra.html


Thanks
Ben

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Is there a way to disable "fastest mirror search"

2015-06-16 Thread Volker Braun
On Tuesday, June 16, 2015 at 9:43:21 PM UTC+2, Emmanuel Charpentier wrote:
>
> In this thread 
> ,  
> tenth post from the top (sorry : I use Google groups, which doe not give 
> very precise references...)
>
>> the fastest mirror code does not use ICMP. 
>>
>
Yes and that is wrong. I had forgotten what I wrote because it was many 
months ago (=review duration). 

Post your logs

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Is there a way to disable "fastest mirror search"

2015-06-16 Thread Emmanuel Charpentier


Le mardi 16 juin 2015 19:03:27 UTC+2, Volker Braun a écrit :
>
> On Tuesday, June 16, 2015 at 3:37:30 PM UTC+2, Emmanuel Charpentier wrote:
>>
>> IIRC, you evoked the possibility of ICMP-induced trouble during a 
>> previous episode of firewall-related trouble. What did you have in mind ?
>>
>
> I had just forgotten what I did;
>

In this thread 
,  tenth 
post from the top (sorry : I use Google groups, which doe not give very 
precise references...)

> the fastest mirror code does not use ICMP. 
>

HTH,
--
Emmanuel Charpentier 

>
> Can you post the actual output?
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Is there a way to disable "fastest mirror search"

2015-06-16 Thread Emmanuel Charpentier


Le mardi 16 juin 2015 19:03:27 UTC+2, Volker Braun a écrit :
>
> On Tuesday, June 16, 2015 at 3:37:30 PM UTC+2, Emmanuel Charpentier wrote:
>>
>> IIRC, you evoked the possibility of ICMP-induced trouble during a 
>> previous episode of firewall-related trouble. What did you have in mind ?
>>
>
> I had just forgotten what I did; the fastest mirror code does not use 
> ICMP. 
>
> Can you post the actual output?
>

I'll have a look tomorrow (back at home...).

--
Emmanuel Charpentier
 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Is there a way to disable "fastest mirror search"

2015-06-16 Thread Volker Braun
On Tuesday, June 16, 2015 at 3:37:30 PM UTC+2, Emmanuel Charpentier wrote:
>
> IIRC, you evoked the possibility of ICMP-induced trouble during a previous 
> episode of firewall-related trouble. What did you have in mind ?
>

I had just forgotten what I did; the fastest mirror code does not use ICMP. 

Can you post the actual output?

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: Spurious legend item

2015-06-16 Thread John Cremona
Thanks for the helpful suggestions. I am not sure who wrote the
plotting funtion, but it goes back to the early days of Sage.  I have
a feeling that David Roe most recently worked on it, and if so then we
might be able to fix it at the upcoming LMFDB workshop when he, and
Nicolas and I will be there.

John

On 16 June 2015 at 13:30, kcrisman  wrote:
> This is indeed odd.
>
>>
>> X=plot([])
>
>
> You shouldn't have to do this - let us know if it doesn't plot otherwise.
> And the canonical way to do it if you really wanted to is X = Graphics() .
>
>>
>> X+=E.base_extend(S[0]).plot(color="red",legend_label=str(exp(1.)))
>> X
>>
>> the legend appears twice (tried with 6.4.1, 6.6, 6.7). Is it a bug ?
>
>
> I would think so.
>
> sage: F = E.base_extend(S[0])
> sage: F.plot(legend_label='b')
> Launched png viewer for Graphics object consisting of 2 graphics primitives
>
> So note that it really is two objects.
>
> sage: F.plot()
> Launched png viewer for Graphics object consisting of 2 graphics primitives
>
> And it is even without the label!  That just makes it obvious.  In fact,
> this is even documented (!)
>
> sage: E = EllipticCurve('37a')
> sage: plot(E)
> Graphics object consisting of 2 graphics primitives
>
> So the question is what to do about it with things like legends.  The code
> for plotting is very ugly, presumably to take care of the 'bounded' and
> 'unbounded' components, but I did find where it comes in.
>
> for j in range(len(I)):
> 
> if shape == 'o':
> g += plot.line(v + list(reversed(w)) + [v[0]], **args)
> elif shape == '<':
> g += plot.line(list(reversed(v)) + w, **args)
> elif shape == '>':
> g += plot.line(v + list(reversed(w)), **args)
> else:
> g += plot.line(v, **args)
> g += plot.line(w, **args)
> return g
>
> So *each* component gets all optional arguments.  Which ordinarily makes
> sense (things like color or F.plot(marker='^') or F.plot(linestyle='--'))
> but in this case does not.
>
> I've opened http://trac.sagemath.org/ticket/18711 but I would appreciate if
> any number theorists could comment there what they expect and so forth,
> because one wouldn't want some nasty side effects from anything done.  One
> could monkey in a solution for legend stuff but in truth there are a lot of
> legend options and so it would be better to have a cleaner solution, such as
> one that did the plots first and *then* passed in keyword arguments, if that
> were possible.
>
> - kcrisman
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Is there a way to disable "fastest mirror search"

2015-06-16 Thread Emmanuel Charpentier
Our firewall attempts to filter downloads (for virus scanning purpose, or 
se we are told) more or less transparently : when I use wget, I see a 
waitong period with on byte per second, then a fast (Ethernet speed)) 
download of the target file.

IIRC, you evoked the possibility of ICMP-induced trouble during a previous 
episode of firewall-related trouble. What did you have in mind ?

Anyway : any idea to disable this mirror selection ?

--
Emmanuel Charpentier

Le mardi 16 juin 2015 15:12:31 UTC+2, Volker Braun a écrit :
>
> The timings are cached (assuming that they find a mirror).
>
> The timing is based on an actual connection on port 80, no ICMP involved I 
> think. If your firewall blocks it then it will also block downloads.
>
>
>
> On Tuesday, June 16, 2015 at 2:52:55 PM UTC+2, Emmanuel Charpentier wrote:
>>
>> Dear all,
>>
>> The new all-shiny all-singing all-dancing fastest mirror selection is 
>> probably useful for large tasks (maybe not so much for small spkgs). I note 
>> however that it is launced once fopr each package/tarball/item that has to 
>> be downloaded, not once per job.
>>
>> Furthermore, behind some firewalls (most notably those that block ICMP), 
>> this feature is a royal pain in the ass^Hymptote : mirror selection 
>> failure, hence task failure, hence job failure. Hosed upgrade.
>>
>> I foud no way to disable this err...feature  Defining SAGE_SERVER is 
>> ignored.
>>
>> Am I missearching the doc ? Any other idea ?
>>
>> --
>> Emmanuel Charpentier
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Is there a way to disable "fastest mirror search"

2015-06-16 Thread Volker Braun
The timings are cached (assuming that they find a mirror).

The timing is based on an actual connection on port 80, no ICMP involved I 
think. If your firewall blocks it then it will also block downloads.



On Tuesday, June 16, 2015 at 2:52:55 PM UTC+2, Emmanuel Charpentier wrote:
>
> Dear all,
>
> The new all-shiny all-singing all-dancing fastest mirror selection is 
> probably useful for large tasks (maybe not so much for small spkgs). I note 
> however that it is launced once fopr each package/tarball/item that has to 
> be downloaded, not once per job.
>
> Furthermore, behind some firewalls (most notably those that block ICMP), 
> this feature is a royal pain in the ass^Hymptote : mirror selection 
> failure, hence task failure, hence job failure. Hosed upgrade.
>
> I foud no way to disable this err...feature  Defining SAGE_SERVER is 
> ignored.
>
> Am I missearching the doc ? Any other idea ?
>
> --
> Emmanuel Charpentier
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Is there a way to disable "fastest mirror search"

2015-06-16 Thread Emmanuel Charpentier
Dear all,

The new all-shiny all-singing all-dancing fastest mirror selection is 
probably useful for large tasks (maybe not so much for small spkgs). I note 
however that it is launced once fopr each package/tarball/item that has to 
be downloaded, not once per job.

Furthermore, behind some firewalls (most notably those that block ICMP), 
this feature is a royal pain in the ass^Hymptote : mirror selection 
failure, hence task failure, hence job failure. Hosed upgrade.

I foud no way to disable this err...feature  Defining SAGE_SERVER is 
ignored.

Am I missearching the doc ? Any other idea ?

--
Emmanuel Charpentier

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Spurious legend item

2015-06-16 Thread kcrisman
This is indeed odd.
 

> X=plot([])
>
>
You shouldn't have to do this - let us know if it doesn't plot otherwise. 
 And the canonical way to do it if you really wanted to is X = Graphics() . 
 

> X+=E.base_extend(S[0]).plot(color="red",legend_label=str(exp(1.)))
> X
>
> the legend appears twice (tried with 6.4.1, 6.6, 6.7). Is it a bug ?
>
>
I would think so.

sage: F = E.base_extend(S[0])
sage: F.plot(legend_label='b')
Launched png viewer for Graphics object consisting of 2 graphics primitives

So note that it really is two objects.

sage: F.plot()
Launched png viewer for Graphics object consisting of 2 graphics primitives

And it is even without the label!  That just makes it obvious.  In fact, 
this is even documented (!)

sage: E = EllipticCurve('37a')
sage: plot(E)
Graphics object consisting of 2 graphics primitives

So the question is what to do about it with things like legends.  The code 
for plotting is very ugly, presumably to take care of the 'bounded' and 
'unbounded' components, but I did find where it comes in.

for j in range(len(I)):

if shape == 'o':
g += plot.line(v + list(reversed(w)) + [v[0]], **args)
elif shape == '<':
g += plot.line(list(reversed(v)) + w, **args)
elif shape == '>':
g += plot.line(v + list(reversed(w)), **args)
else:
g += plot.line(v, **args)
g += plot.line(w, **args)
return g

So *each* component gets all optional arguments.  Which ordinarily makes 
sense (things like color or F.plot(marker='^') or F.plot(linestyle='--')) 
but in this case does not.

I've opened http://trac.sagemath.org/ticket/18711 but I would appreciate if 
any number theorists could comment there what they expect and so forth, 
because one wouldn't want some nasty side effects from anything done.  One 
could monkey in a solution for legend stuff but in truth there are a lot of 
legend options and so it would be better to have a cleaner solution, such 
as one that did the plots first and *then* passed in keyword arguments, if 
that were possible.

- kcrisman

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Spurious legend item

2015-06-16 Thread Nicolas Mascot

Dear Sage support team,

I am puzzled at this:

E=EllipticCurve([1.6,0.3])
X=plot([])
X+=E.plot(color="green",legend_label=str(exp(1.)))
X

works fine (the legend is ok), but when I do

Qx.=PolynomialRing(QQ)
K. = NumberField(x^2-2)
S = K.embeddings(RR)
E=EllipticCurve([a,0])
X=plot([])
X+=E.base_extend(S[0]).plot(color="red",legend_label=str(exp(1.)))
X

the legend appears twice (tried with 6.4.1, 6.6, 6.7). Is it a bug ?

Best regards,
Nicolas Mascot

--
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.