Mathematical Operations on Array

2011-04-01 Thread bryan.fodn...@gmail.com
I am loading text into an array and would like to convert the values.

from math import *
from numpy import *
from pylab import *

data=loadtxt('raw.dat')
mincos=degrees(acos(data[:,0]))
minazi=degrees(data[:,1])
minthick=data[:,2]/0.006858

I am not sure why degrees()  works, but acos() does not.

I receive the following

Traceback (most recent call last):
  File "C:\ test.py", line 6, in ?
mincos=degrees(acos(float(data[:,0])))
TypeError: only length-1 arrays can be converted to Python scalars

Can anyone tell me what I am doing wrong?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Mathematical Operations on Array

2011-04-01 Thread bryan.fodn...@gmail.com
On Apr 1, 9:52 am, Peter Otten <[email protected]> wrote:
> [email protected] wrote:
> > I am loading text into an array and would like to convert the values.
>
> > from math import *
> > from numpy import *
> > from pylab import *
>
> > data=loadtxt('raw.dat')
> > mincos=degrees(acos(data[:,0]))
> > minazi=degrees(data[:,1])
> > minthick=data[:,2]/0.006858
>
> > I am not sure why degrees()  works, but acos() does not.
>
> > I receive the following
>
> > Traceback (most recent call last):
> >   File "C:\ test.py", line 6, in ?
> >     mincos=degrees(acos(float(data[:,0])))
> > TypeError: only length-1 arrays can be converted to Python scalars
>
> > Can anyone tell me what I am doing wrong?
>
> Using star-imports.
>
> Among other things it makes it hard to keep track of where things are coming
> from:
>
> >>> from math import *
> >>> from numpy import *
> >>> degrees
> 
> >>> acos
>
> >>> acos.__module__
> 'math'
> >>> arccos
>
> - Hide quoted text -
>
> - Show quoted text -

Thank you.
-- 
http://mail.python.org/mailman/listinfo/python-list


Extract an image from a RTF file

2009-02-14 Thread bryan.fodn...@gmail.com
I have a large amount of RTF files where the only thing in them is an
image.  I would like to extract them an save them as a png.
Eventually, I would like to also grab some text that is on the image.
I think PIL has something for this.

Does anyone have any suggestion on how to start this?
--
http://mail.python.org/mailman/listinfo/python-list