Re: [Numpy-discussion] Advanced indexing advice

2009-06-19 Thread Cristi Constantin
:4,1:4] = np.where(mask,b,a[1:4,1:4]) otherwise consider Cython: http://docs.cython.org/docs/numpy_tutorial.html#tuning-indexing-further Robert >     2009/6/18 Cristi Constantin      >: >      > I have a question about advanced indexing. >      > >      > I have 2 matrices : >

Re: [Numpy-discussion] Advanced indexing advice?

2009-06-18 Thread Cristi Constantin
e speed. Thank you again. I will play with your method a little more. --- On Thu, 6/18/09, Stéfan van der Walt wrote: From: Stéfan van der Walt Subject: Re: [Numpy-discussion] Advanced indexing advice? To: "Discussion of Numerical Python" Date: Thursday, June 18, 2009, 2:16 AM Hi

[Numpy-discussion] Advanced indexing advice?

2009-06-18 Thread Cristi Constantin
Good day. I have a question about advanced indexing. I have 2 matrices : >>> a=array([[ 0,  1,  2,  3,  4,  5],         [ 6,  7,  8,  9, 10, 11], [12, 13, 14, 15, 16, 17], [18, 19, 20, 21, 22, 23]]) b=array([[1, 0, 1], [0, 2, 0], [0, 0, 3]]) >>> I want t

Re: [Numpy-discussion] Array resize question closed

2009-06-17 Thread Cristi Constantin
Thank you Neil Martinsen-Burrell and Scott Sinclair for your answers. :) It's exactly what i wanted to know. I will use hstack and vstack to "resize" my array. Have a nice day. --- On Wed, 6/17/09, Scott Sinclair wrote: The resize method of ndarray is currently broken when the 'order' keyword

[Numpy-discussion] Array resize question

2009-06-16 Thread Cristi Constantin
Good day. I have this array: a = array([[u'0', u'0', u'0', u'0', u'0', u' '],    [u'1', u'1', u'1', u'1', u'1', u' '],    [u'2', u'2', u'2', u'2', u'2', u' '],    [u'3', u'3', u'3', u'3', u'3', u' '],    [u'4', u'4', u'4', u'4', u'4', u'']],   dtype='http://docs.scipy.org/doc/

[Numpy-discussion] Unite a Rectangular Unicode Array into one newline-separated string

2009-06-12 Thread Cristi Constantin
Good day. I am trying to unite a Rectangular Unicode Array into one newline-separated string. Basically each line is separated by next line with '\n',   and all characters from one line are merged. For example: import numpy as np a = np.arange(12).reshape(3,4) a = np.asarray(a,'U') # Method

[Numpy-discussion] Rotate Left and Rotate Right

2009-05-20 Thread Cristi Constantin
Good day, me again. I have this string of data : String = 'i want\nto go\nto the\nbeach'. I want to rotate this data to left, or to right, after is split it after '\n'. Note that it's important to use 'U' array, because i might have unicode characters in this string. So normal, the text is: i wa

Re: [Numpy-discussion] Overlap arrays with "transparency"

2009-05-20 Thread Cristi Constantin
's the only one that works. --- On Mon, 5/18/09, Cristi Constantin wrote: From: Cristi Constantin Subject: [Numpy-discussion] Overlap arrays with "transparency" To: "Numpy Discussion" Date: Monday, May 18, 2009, 5:37 AM Good day. I am working on this algorithm for a few

[Numpy-discussion] Overlap arrays with "transparency"

2009-05-18 Thread Cristi Constantin
Good day. I am working on this algorithm for a few weeks now, so i tried almost everything... I want to overlap / overwrite 2 matrices, but completely ignore some values (in this case ignore 0) Let me explain: a = [ [1, 2, 3, 4, 5], [9,7], [0,0,0,0,0], [5,5,5] ] b = [ [0,0,9,9], [1,1,1,1], [2,2