[Numpy-discussion] How to unitize a array in numpy?

2008-12-09 Thread Grissiom
Hi all,

Nice to neet you all. I am a newbie in numpy. Is there any function that
could unitize a array?
Thanks in advance.

-- 
Cheers,
Grissiom
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] How to unitize a array in numpy?

2008-12-09 Thread Robert Kern
On Tue, Dec 9, 2008 at 20:24, Grissiom [EMAIL PROTECTED] wrote:
 Hi all,

 Nice to neet you all. I am a newbie in numpy. Is there any function that
 could unitize a array?

What do you mean by unitize?

-- 
Robert Kern

I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth.
  -- Umberto Eco
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] How to unitize a array in numpy?

2008-12-09 Thread Robert Kern
On Tue, Dec 9, 2008 at 20:24, Grissiom [EMAIL PROTECTED] wrote:
 Hi all,

 Nice to neet you all. I am a newbie in numpy. Is there any function that
 could unitize a array?

If you mean like the Mathematica function Unitize[] defined here:

  http://reference.wolfram.com/mathematica/ref/Unitize.html

Then .astype(bool) is probably sufficient.

-- 
Robert Kern

I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth.
  -- Umberto Eco
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] How to unitize a array in numpy?

2008-12-09 Thread Grissiom
On Wed, Dec 10, 2008 at 10:36, Robert Kern [EMAIL PROTECTED] wrote:

 On Tue, Dec 9, 2008 at 20:24, Grissiom [EMAIL PROTECTED] wrote:
  Hi all,
 
  Nice to neet you all. I am a newbie in numpy. Is there any function that
  could unitize a array?

 If you mean like the Mathematica function Unitize[] defined here:

  http://reference.wolfram.com/mathematica/ref/Unitize.html

 Then .astype(bool) is probably sufficient.

 --
 Robert Kern


I'm sorry for my poor English. I mean a function that could return a unit
vector which have the same direction with the original one. Thanks.

-- 
Cheers,
Grissiom
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] How to unitize a array in numpy?

2008-12-09 Thread Robert Kern
On Tue, Dec 9, 2008 at 20:56, Grissiom [EMAIL PROTECTED] wrote:
 On Wed, Dec 10, 2008 at 10:36, Robert Kern [EMAIL PROTECTED] wrote:

 On Tue, Dec 9, 2008 at 20:24, Grissiom [EMAIL PROTECTED] wrote:
  Hi all,
 
  Nice to neet you all. I am a newbie in numpy. Is there any function that
  could unitize a array?

 If you mean like the Mathematica function Unitize[] defined here:

  http://reference.wolfram.com/mathematica/ref/Unitize.html

 Then .astype(bool) is probably sufficient.

 --
 Robert Kern

 I'm sorry for my poor English. I mean a function that could return a unit
 vector which have the same direction with the original one. Thanks.

v / numpy.linalg.norm(v)

-- 
Robert Kern

I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth.
  -- Umberto Eco
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] How to unitize a array in numpy?

2008-12-09 Thread Grissiom
On Wed, Dec 10, 2008 at 11:04, Robert Kern [EMAIL PROTECTED] wrote:

 v / numpy.linalg.norm(v)


Thanks a lot ~;)

-- 
Cheers,
Grissiom
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion