Re: [Numpy-discussion] 3D array problem in Python

2012-12-30 Thread oc-spam66
Hello, else: val11[i][j], val22[i][j] = integrate.quad(lambda x: F1(x)*F2(x), 0, pi) But, this calculation takes so long time, let's say about 1 hour (theoretically)... Is there any better way to easily and fast calculate the process such as [ F( i ) for i in xlist ] or something like

Re: [Numpy-discussion] array.tofile() refuses to write into a StringIO

2011-09-27 Thread oc-spam66
if you want to write to a string, why not use .tostring()? Because A.tostring() returns the binary data, while I would like the text representation. More precisely, I would like to use A.tofile(sep=\t). Yes, this is a known shortcoming of .tofile(). Is it worth filing a bug report ? --

Re: [Numpy-discussion] array.tofile() refuses to write into a StringIO

2011-09-27 Thread oc-spam66
Ah, I found a workaround: savetxt() can work with a StringIO - savetxt(file_buffer, A) This is only a workaround. I still think A.tofile() should be capable of writing into a StringIO. -- O.C. ___ NumPy-Discussion mailing list

[Numpy-discussion] numpy.r_[True, False] is not a boolean array

2010-12-03 Thread oc-spam66
Hello, I observe the following behavior: numpy.r_[True, False] - array([1, 0], dtype=int8) numpy.r_[True] - array([ True], dtype=bool) I would expect the first line to give a boolean array: array([ True, False], dtype=bool) Is it normal? Is it a bug? -- O.C. numpy.__version__ =

[Numpy-discussion] Vectorization of the product of several matrices ?

2008-09-28 Thread oc-spam66
Hello, I have two lists of numpy matrices : LM = [M_i, i=1..N] and LN = [N_i, i =1..N] and I would like to compute the list of the products : LP = [M_i * N_i, i=1..N]. I can do : P=[] for i in range(N) : P.append(LM[i]*LN[i]) But this is not vectorized. Is there a faster solution ? Can

[Numpy-discussion] How to import data where the decimal separator is a comma ?

2008-09-04 Thread oc-spam66
Hello, I have data files where the decimal separator is a comma. Can I import this data with numpy.loadtxt ? Notes : - I tried to set the locale LC_NUMERIC=fr_FR.UTF-8 but it didn't change anything. - Python 2.5.2, Numpy 1.1.0 Have a nice day, O.C. Créez votre adresse électronique

Re: [Numpy-discussion] numpy.fromstring() : error handling ?

2008-08-08 Thread oc-spam66
Thank you for the answers, I am now disturbed by this result : In [1]: import numpy In [2]: numpy.fromstring(abcd, dtype = float, sep = ' ') Out[2]: array([ 0.]) Shouldn't it raise an exception ValueError ? (because abcd is not a float) Regards, O.C. Créez votre adresse électronique

[Numpy-discussion] Appending data to a big ndarray

2008-08-08 Thread oc-spam66
Hello, I would like to build a big ndarray by adding rows progressively. I considered the following functions : append, concatenate, vstack and the like. It appears to me that they all create a new array (which requires twice the memory). Is there a method for just adding a row to a ndarray

Re: [Numpy-discussion] numpy.fromstring() : error handling ?

2008-08-08 Thread oc-spam66
Shouldn't it raise an exception ValueError ? (because abcd is not a float) I don't think so, but it shouldn't return a zero either. That call should mean: scan this whitespace separated string for as many floating point numbers as it has. There are none, so it should return and empty

[Numpy-discussion] numpy.fromstring() : error handling ?

2008-08-07 Thread oc-spam66
Hello, the following code drives python into an endless loop : import numpy numpy.fromstring(abcd, dtype = float, sep = ' ') I think the function numpy.fromstring is lacking an adequate error handling for that case. Is it a bug ? Regards, -- O.C. Python 2.5.2 Debian Lenny Créez