Re: [Numpy-discussion] how to use the name of a ndarray as a string

2011-11-10 Thread Olivier Delalleau
In such a situation you should probably use a dictionary from the start, i.e.: d3['index'] = np.arange(100) then use d3['index'] everywhere instead of index. It can be more convenient (notation-wise) to use an object instead, i.e. either work within a class method (self.index =

Re: [Numpy-discussion] Rebinning numpy array

2011-11-13 Thread Olivier Delalleau
Just one thing: numpy.interp says it doesn't check that the x coordinates are increasing, so make sure it's the case. Assuming this is ok, I could still see how you may get some non-smooth behavior: this may be because your spike can either be split between two bins (which dilutes it somehow), or

Re: [Numpy-discussion] Rebinning numpy array

2011-11-13 Thread Olivier Delalleau
Also: it seems like you are using values at the boundaries of the bins, while I think it would make more sense to compute interpolated values at the middle point of a bin. I'm not sure it'll make a big difference visually, but it may be more appropriate. -=- Olivier 2011/11/13 Olivier Delalleau

Re: [Numpy-discussion] Rebinning numpy array

2011-11-13 Thread Olivier Delalleau
the closest bins (t_k and t_{k+1} such that t_k t t_{k+1}), so that data stored in many of the bins will not be used at all. I haven't looked closely at the suggestion from Robert but it may be a better way to achieve what you want. -=- Olivier 2011/11/13 Olivier Delalleau sh...@keba.be Also

Re: [Numpy-discussion] Rebinning numpy array

2011-11-13 Thread Olivier Delalleau
2011/11/13 Robert Kern robert.k...@gmail.com On Sun, Nov 13, 2011 at 17:48, Olivier Delalleau sh...@keba.be wrote: Also: it seems like you are using values at the boundaries of the bins, while I think it would make more sense to compute interpolated values at the middle point of a bin

Re: [Numpy-discussion] Copy netcdf attributes between different files

2011-11-14 Thread Olivier Delalleau
In Python you use setattr to set an object's attribute whose name is stored into a variable: setattr(file2, att, file1.getncatt(att)) -=- Olivier 2011/11/14 Giovanni Plantageneto g.plantagen...@gmail.com Hi everybody, I am using netCDF4 library to read and write from netcdf files. I would

Re: [Numpy-discussion] numpy.int32 is not subclass of int, but numpy.int64 is

2011-11-15 Thread Olivier Delalleau
2011/11/14 Robert Kern robert.k...@gmail.com On Mon, Nov 14, 2011 at 20:18, MACKEITH Andrew andrew.macke...@3ds.com wrote: Could someone explain this? An instance of numpy.int32 is not an instance of int or numpy.int. An instance of numpy.int64 is an instance of int and numpy.int. I

Re: [Numpy-discussion] numpy.int32 is not subclass of int, but numpy.int64 is

2011-11-15 Thread Olivier Delalleau
2011/11/15 MACKEITH Andrew andrew.macke...@3ds.com *From:* numpy-discussion-boun...@scipy.org [mailto: numpy-discussion-boun...@scipy.org] *On Behalf Of *Olivier Delalleau *Sent:* Tuesday, November 15, 2011 7:03 AM *To:* Discussion of Numerical Python *Subject:* Re: [Numpy-discussion

Re: [Numpy-discussion] mask one array using another array

2011-11-21 Thread Olivier Delalleau
If your new array is x, you can use: numpy.ma.masked_array(x, mask=mask.mask) -=- Olivier 2011/11/21 questions anon questions.a...@gmail.com I am trying to mask one array using another array. I have created a masked array using mask=MA.masked_equal(myarray, 0), that looks something like:

Re: [Numpy-discussion] mask one array using another array

2011-11-21 Thread Olivier Delalleau
']._FillValue TSFC=MA.masked_values(TSFC, fillvalue) ncfile.close() TSFC=MA.masked_array(TSFC, mask=newmask.mask) On Tue, Nov 22, 2011 at 11:21 AM, Olivier Delalleau sh...@keba.be

Re: [Numpy-discussion] compiling and linking MKL with numpy/scipy

2011-11-23 Thread Olivier Delalleau
I attached a site.cfg file for numpy 1.3 compiled with MKL on some Linux 64 bit architecture, in case it might help. I always had trouble getting programs (other than numpy though) to link and execute properly with MKL. You might also try to play with LD_PRELOAD. Good luck, -=- Olivier

Re: [Numpy-discussion] binary to ascii

2011-11-29 Thread Olivier Delalleau
Would numpy.fromstring and ndarray.tostring fit your needs? -=- Olivier 2011/11/29 Alex Ter-Sarkissov ater1...@gmail.com hi eveyone, is there a simple command in numpy similar to matlab char(bin2dec('//some binary value//')) to convert binary to characters and back? thanks

Re: [Numpy-discussion] Apparently non-deterministic behaviour of complex array multiplication

2011-11-30 Thread Olivier Delalleau
I guess it's just a typo on your part, but just to make sure, you are using .transpose(), not .transpose, correct? -=- Olivier 2011/11/30 Karl Kappler magnetotellur...@gmail.com Hello, I am somewhat new to scipy/numpy so please point me in the right direction if I am posting to an incorrect

Re: [Numpy-discussion] upsample or scale an array

2011-12-03 Thread Olivier Delalleau
You can also use numpy.tile -=- Olivier 2011/12/3 Robin Kraft rkra...@gmail.com Thanks Warren, this is great, and even handles giant arrays just fine if you've got enough RAM. I also just found this StackOverflow post with another solution. a.repeat(2, axis=0).repeat(2, axis=1).

Re: [Numpy-discussion] upsample or scale an array

2011-12-03 Thread Olivier Delalleau
work with the result of np.tile? -Robin On Dec 3, 2011, at 11:05 AM, Olivier Delalleau wrote: You can also use numpy.tile -=- Olivier 2011/12/3 Robin Kraft Thanks Warren, this is great, and even handles giant arrays just fine if you've got enough RAM. I also just found

Re: [Numpy-discussion] stacking scalars with column vector

2011-12-04 Thread Olivier Delalleau
You can do it in one shot with: x = np.vstack((Xstart, A[:, 0:1], Xend)) Using A[:, 0:1] instead of A[:, 0] lets you keep it as a 2d matrix (this should answer your last question). Then the scalars Xstart and Xend will automatically be broadcasted to accomodate the shape of A[:, 0:1], so you

Re: [Numpy-discussion] loop through values in a array and find maximum as looping

2011-12-06 Thread Olivier Delalleau
It may not be the most efficient way to do this, but you can do: mask = b a a[mask] = b[mask] -=- Olivier 2011/12/6 questions anon questions.a...@gmail.com I would like to produce an array with the maximum values out of many (1s) of arrays. I need to loop through many multidimentional

Re: [Numpy-discussion] loop through values in a array and find maximum as looping

2011-12-06 Thread Olivier Delalleau
am I missing another step whereever b is greater than a replace b with a? thanks On Wed, Dec 7, 2011 at 11:55 AM, Olivier Delalleau sh...@keba.be wrote: It may not be the most efficient way to do this, but you can do: mask = b a a[mask] = b[mask] -=- Olivier 2011/12/6 questions anon

Re: [Numpy-discussion] loop through values in a array and find maximum as looping

2011-12-06 Thread Olivier Delalleau
) but because I have so many arrays I end up with a memory error so I need to find a way to get the maximum while looping. On Wed, Dec 7, 2011 at 12:36 PM, josef.p...@gmail.com wrote: On Tue, Dec 6, 2011 at 7:55 PM, Olivier Delalleau sh...@keba.be wrote: It may not be the most efficient way to do

Re: [Numpy-discussion] loop through values in a array and find maximum as looping

2011-12-06 Thread Olivier Delalleau
with a memory error so I need to find a way to get the maximum while looping. On Wed, Dec 7, 2011 at 12:36 PM, josef.p...@gmail.com wrote: On Tue, Dec 6, 2011 at 7:55 PM, Olivier Delalleau sh...@keba.be wrote: It may not be the most efficient way to do this, but you can do: mask = b a a[mask] = b

Re: [Numpy-discussion] loop through values in a array and find maximum as looping

2011-12-06 Thread Olivier Delalleau
appropriate but I am not sure how to loop it over thousands of files. I need to keep the first array to compare with but replace any greater values as I loop through each array comparing back to the same array. does that make sense? On Wed, Dec 7, 2011 at 1:12 PM, Olivier Delalleau sh

Re: [Numpy-discussion] loop through values in a array and find maximum as looping

2011-12-06 Thread Olivier Delalleau
am doing wrong whether it is something with the loop or with the command. On Wed, Dec 7, 2011 at 1:44 PM, josef.p...@gmail.com wrote: On Tue, Dec 6, 2011 at 9:36 PM, Olivier Delalleau sh...@keba.be wrote: The out=a keyword will ensure your first array will keep being updated. So you can do

Re: [Numpy-discussion] loop through values in a array and find maximum as looping

2011-12-06 Thread Olivier Delalleau
) print max is, Max,a is, a On Wed, Dec 7, 2011 at 2:34 PM, Olivier Delalleau sh...@keba.be wrote: Is 'a' a regular numpy array or something fancier? -=- Olivier 2011/12/6 questions anon questions.a...@gmail.com thanks again my only problem though is that the out=a in the loop does

Re: [Numpy-discussion] Apparently non-deterministic behaviour of complex array multiplication

2011-12-07 Thread Olivier Delalleau
I was trying to see if I could reproduce this problem, but your code fails with numpy 1.6.1 with: AttributeError: 'numpy.ndarray' object has no attribute 'H' Is X supposed to be a regular ndarray with dtype = 'complex128', or something else? -=- Olivier 2011/12/5 kneil magnetotellur...@gmail.com

Re: [Numpy-discussion] Simple way to launch python processes?

2011-12-07 Thread Olivier Delalleau
Maybe try stackoverflow, since this isn't really a numpy question. To run a command like python myscript.py arg1 arg2 in a separate process, you can do: p = subprocess.Popen(python myscript.py arg1 arg2.split()) You can launch many of these, and if you want to know if a process p is over, you

Re: [Numpy-discussion] type checking, what's recommended?

2011-12-07 Thread Olivier Delalleau
We have indeed been using type(a) is np.ndarray in Theano to check that. If there's a better way, I'm interested to know as well :) -=- Olivier 2011/12/7 josef.p...@gmail.com If I want to know whether something that might be an array is really a plain ndarray and not a subclass, is using

Re: [Numpy-discussion] Getting non-normalized eigenvectors from generalized eigenvalue solution?

2011-12-20 Thread Olivier Delalleau
I'm probably missing something, but... Why would you want non-normalized eigenvectors? -=- Olivier 2011/12/20 Fahreddın Basegmez mangab...@gmail.com Howdy, Is it possible to get non-normalized eigenvectors from scipy.linalg.eig(a, b)? Preferably just by using numpy. BTW, Matlab/Octave

Re: [Numpy-discussion] Getting non-normalized eigenvectors from generalized eigenvalue solution?

2011-12-20 Thread Olivier Delalleau
mangab...@gmail.com I am computing normal-mode frequency response of a mass-spring system. The algorithm I am using requires it. On Tue, Dec 20, 2011 at 8:10 PM, Olivier Delalleau sh...@keba.be wrote: I'm probably missing something, but... Why would you want non-normalized eigenvectors

Re: [Numpy-discussion] Getting non-normalized eigenvectors from generalized eigenvalue solution?

2011-12-20 Thread Olivier Delalleau
.]]) On Tue, Dec 20, 2011 at 8:40 PM, Olivier Delalleau sh...@keba.be wrote: Hmm... ok ;) (sorry, I can't follow you there) Anyway, what kind of non-normalization are you after? I looked at the doc for Matlab and it just says eigenvectors are not normalized, without additional details... so it looks

Re: [Numpy-discussion] Getting non-normalized eigenvectors from generalized eigenvalue solution?

2011-12-20 Thread Olivier Delalleau
numpy. -=- Olivier 2011/12/20 Fahreddın Basegmez mangab...@gmail.com I don't think I can do that. I can go to the normalized results but not the other way. On Tue, Dec 20, 2011 at 9:45 PM, Olivier Delalleau sh...@keba.be wrote: Hmm, sorry, I don't see any obvious logic that would explain

Re: [Numpy-discussion] find location of maximum values

2011-12-20 Thread Olivier Delalleau
I'm sorry I don't have time to look closely at your code and this may not be helpful, but just in case... I find it suspicious that you *seem* (by quickly glancing at the code) to be taking TIME[max(temperature)] instead of TIME[argmax(temperature)]. -=- Olivier 2011/12/20 questions anon

Re: [Numpy-discussion] Getting non-normalized eigenvectors from generalized eigenvalue solution?

2011-12-21 Thread Olivier Delalleau
Aaah, thanks a lot Lennart, I knew there had to be some logic to Octave's output, but I couldn't see it... -=- Olivier 2011/12/21 Lennart Fricke pge08...@studserv.uni-leipzig.de Dear Fahreddın, I think, the norm of the eigenvectors corresponds to some generic amplitude. But that is something

Re: [Numpy-discussion] How's our broadcasting?

2011-12-28 Thread Olivier Delalleau
2011/12/28 Jordi Gutiérrez Hermoso jord...@octave.org On 28 December 2011 13:41, Ralf Gommers ralf.gomm...@googlemail.com wrote: 2011/12/28 Jordi Gutiérrez Hermoso jord...@octave.org Just FYI, the next stable release of Octave (3.6) will have broadcasting. I used Numpy as an

Re: [Numpy-discussion] filling an alice of array of object with a reference to an object that has a __getitem__ method

2012-01-08 Thread Olivier Delalleau
You could try A[...].fill(MyObject(...)). I haven't tried it myself, so not sure it would work though... -=- Olivier 2012/1/6 David Köpfer dkoep...@gmx.de Dear numpy community, I'm trying to create an array of type object. A = empty(9, dtype=object) A[ array(0,1,2) ] = MyObject(1) A[

Re: [Numpy-discussion] filling an alice of array of object with a reference to an object that has a __getitem__ method

2012-01-09 Thread Olivier Delalleau
Original-Nachricht Datum: Sun, 8 Jan 2012 16:16:33 -0500 Von: Olivier Delalleau sh...@keba.be An: Discussion of Numerical Python numpy-discussion@scipy.org Betreff: Re: [Numpy-discussion] filling an alice of array of object with a reference to an object that has a __getitem__ method

Re: [Numpy-discussion] find location of maximum values

2012-01-09 Thread Olivier Delalleau
Do you mean that listval[0] is systematically equal to 0, or is it something else? -=- Olivier 2012/1/9 questions anon questions.a...@gmail.com thank you, I seem to have made some progress (with lots of help)!! I still seem to be having trouble with the time. Because it is hourly data for a

Re: [Numpy-discussion] (no subject)

2012-01-20 Thread Olivier Delalleau
Not sure if there's a better way, but you can do it with assert not numpy.allclose(numpy_result, result) -=- Olivier 2012/1/20 Hänel Nikolaus Valentin valentin.hae...@epfl.ch Hi, I would like to make a sanity test to check that calling the same function with different parameters actually

Re: [Numpy-discussion] condense array along one dimension

2012-01-20 Thread Olivier Delalleau
What do you mean by summarize? If for instance you want to sum along Y, just do my_array.sum(axis=1) -=- Olivier 2012/1/20 Ruby Stevenson ruby...@gmail.com hi, all Say I have a three dimension array, X, Y, Z, how can I condense into two dimensions: for example, compute 2-D array with (X,

Re: [Numpy-discussion] Easy module installation with less human intervention.

2012-01-21 Thread Olivier Delalleau
You can try easy_install or pip. -=- Olivier 2012/1/21 Peng Yu pengyu...@gmail.com Hi, Perl has something like ppm so that I can just use one command to download and install perl modules. But I don't find such thing in python. As shown on http://docs.python.org/install/index.html, it

Re: [Numpy-discussion] 'Advanced' save and restore operation

2012-01-23 Thread Olivier Delalleau
Note sure if there's a better way, but you can do it with some custom load and save functions: with open('f.txt', 'w') as f: ... f.write(str(x.dtype) + '\n') ... numpy.savetxt(f, x) with open('f.txt') as f: ... dtype = f.readline().strip() ... y = numpy.loadtxt(f).astype(dtype)

Re: [Numpy-discussion] numpy.percentile multiple arrays

2012-01-24 Thread Olivier Delalleau
Note that if you are ok with an approximate solution, and you can assume your data is somewhat shuffled, a simple online algorithm that uses no memory consists in: - choosing a small step size delta - initializing your percentile p to a more or less random value (a meaningful guess is better

Re: [Numpy-discussion] need advice on installing NumPy onto a Windows 7 with Python2.7 (32-bit)

2012-01-27 Thread Olivier Delalleau
It seems weird that it wouldn't work, as this is a pretty standard setup. Here's a few ideas of things to check: - Double-check it's really 32 bit Python (checking sys.maxint) - Is there another Python installation that may cause some conflicts? - Did you download the numpy superpack from the

Re: [Numpy-discussion] need advice on installing NumPy onto a Windows 7 with Python2.7 (32-bit)

2012-01-27 Thread Olivier Delalleau
, 2012 at 4:55 AM, Olivier Delalleau sh...@keba.be wrote: It seems weird that it wouldn't work, as this is a pretty standard setup. Here's a few ideas of things to check: - Double-check it's really 32 bit Python (checking sys.maxint) - Is there another Python installation that may cause some

Re: [Numpy-discussion] NetCDF4/numpy question

2012-01-27 Thread Olivier Delalleau
Eric's probably right and it's indexing with a masked array that's causing you trouble. Since you seem to say your NaN values correspond to your mask, you should be able to simply do: modelData[modeData.mask] = dataMin Note that in further processing it may then make more sense to remove the

Re: [Numpy-discussion] numpy all unexpected result (generator)

2012-01-31 Thread Olivier Delalleau
Le 31 janvier 2012 10:50, Robert Kern robert.k...@gmail.com a écrit : On Tue, Jan 31, 2012 at 15:35, Benjamin Root ben.r...@ou.edu wrote: On Tue, Jan 31, 2012 at 9:18 AM, Robert Kern robert.k...@gmail.com wrote: On Tue, Jan 31, 2012 at 15:13, Benjamin Root ben.r...@ou.edu wrote:

Re: [Numpy-discussion] combination of list of indices and newaxis not allowed?

2012-02-01 Thread Olivier Delalleau
I think you just can't use newaxis in advanced indexing (doc says The newaxishttp://docs.scipy.org/doc/numpy/reference/arrays.indexing.html#numpy.newaxisobject can be used in the basic slicing syntax, and does not mention newaxis in the advanced indexing part). -=- Olivier Le 1 février 2012

Re: [Numpy-discussion] histogram help

2012-02-02 Thread Olivier Delalleau
Sorry but I don't understand your last question. Better / more efficient than what? -=- Olivier Le 2 février 2012 07:14, Ruby Stevenson ruby...@gmail.com a écrit : Exactly, histogram of Z, which itself is an array, for each (x, y). sorry for getting everyone including myself confused :-) I

Re: [Numpy-discussion] Masked array elements where mask = True?

2012-02-03 Thread Olivier Delalleau
numpy.where(x.mask) should do it. -=- Olivier Le 3 février 2012 14:02, Howard how...@renci.org a écrit : Is there a method that gives an array of all the array indices of a masked array where the mask is True? I've been looking through the docs and don't see it yet... Thanks Howard --

Re: [Numpy-discussion] ValueError: total size of new array must be unchanged only on Windows

2012-02-05 Thread Olivier Delalleau
It should mean that matrix.size != a * b * c. -=- Olivier Le 5 février 2012 09:32, Paolo p.zaff...@yahoo.it a écrit : Hello, I wrote a function that works on a numpy matrix and it works fine on Mac OS and GNU/Linux (I didn't test it on python 3). Now I have a problem with numpy: the same

Re: [Numpy-discussion] ValueError: total size of new array must be unchanged only on Windows

2012-02-05 Thread Olivier Delalleau
type. Am I wrong? Thanks for your support! -- * From: * Olivier Delalleau sh...@keba.be; * To: * Discussion of Numerical Python numpy-discussion@scipy.org; * Subject: * Re: [Numpy-discussion] ValueError: total size of new array must be unchanged only on Windows

Re: [Numpy-discussion] Logical indexing and higher-dimensional arrays.

2012-02-08 Thread Olivier Delalleau
Le 8 février 2012 00:01, Travis Oliphant tra...@continuum.io a écrit : On Feb 7, 2012, at 12:24 PM, Sturla Molden wrote: On 07.02.2012 19:17, Benjamin Root wrote: print x.shape (2, 3, 4) print x[0, :, :].shape (3, 4) print x[0, :, idx].shape (2, 3) That looks like a bug to

Re: [Numpy-discussion] Change in scalar upcasting rules for 1.6.x?

2012-02-13 Thread Olivier Delalleau
It hasn't changed: since float is of a fundamentally different kind of data, it's expected to upcast the result. However, if I may add a personal comment on numpy's casting rules: until now, I've found them confusing and somewhat inconsistent. Some of the inconsistencies I've found were bugs,

Re: [Numpy-discussion] Numpy 1.6.1 installation problem

2012-02-14 Thread Olivier Delalleau
Really not an expert here, but it looks like it's trying various compilation options, some work and some don't, and for some reason it's really unhappy about the one where it can't find Python.h. Maybe add /usr/include/python2.6 to your CPATH, see if that helps (and make sure permissions are

Re: [Numpy-discussion] addition to numpy discussion list

2012-02-14 Thread Olivier Delalleau
Hi, You can subscribe here: http://mail.scipy.org/mailman/listinfo/numpy-discussion -=- Olivier Le 14 février 2012 14:22, pulkit yadav yadavpul...@gmail.com a écrit : Hello, I am a Python enthusiast and developer. Please add me to numpy mailing list so that I can contribute to the FLOSS

Re: [Numpy-discussion] Numpy 1.6.1 installation problem

2012-02-15 Thread Olivier Delalleau
Le 15 février 2012 07:29, Martin Raspaud martin.rasp...@smhi.se a écrit : -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 14/02/12 16:48, Bruce Southey wrote: On 02/14/2012 09:40 AM, Olivier Delalleau wrote: Really not an expert here, but it looks like it's trying various compilation

Re: [Numpy-discussion] change the mask state of one element in a masked array

2012-02-18 Thread Olivier Delalleau
There may be a better way to do it, but you can first do: a.mask = np.zeros_like(a) then afterwards e.g. a.mask[0, 0] = True will work. -=- Olivier Le 18 février 2012 10:52, Chao YUE chaoyue...@gmail.com a écrit : Dear all, I built a new empty masked array: In [91]: a=np.ma.empty((2,5))

Re: [Numpy-discussion] ndarray and lazy evaluation (was: Proposed Rodmap Overview)

2012-02-20 Thread Olivier Delalleau
Never mind. The link Francesc posted answered my question :) -=- Olivier Le 20 février 2012 12:54, Olivier Delalleau delal...@iro.umontreal.ca a écrit : Le 20 février 2012 12:46, Dag Sverre Seljebotn d.s.seljeb...@astro.uio.no a écrit : On 02/20/2012 09:24 AM, Olivier Delalleau wrote: Hi

Re: [Numpy-discussion] How to modify an array

2012-02-26 Thread Olivier Delalleau
This should do what you want: array_copy = my_array.copy() array_copy[array_copy == 2] = 0 -=- Olivier Le 26 février 2012 19:53, tetsuro_kiku...@jesc.or.jp a écrit : Dear sirs, Please allow me to ask you a beginner's question. I have an nparray whose shape is (144, 91, 1). The elements

Re: [Numpy-discussion] Numpy fitting

2012-03-01 Thread Olivier Delalleau
Sorry I can't help, but I'd just suggest to post this on the scipy mailing list as you may get more replies there. -=- Olivier Le 1 mars 2012 10:24, Pierre Barthelemy bart...@gmail.com a écrit : Dear all, i am writing a program for data analysis. One of the functions of this program gives

Re: [Numpy-discussion] Floating point close function?

2012-03-03 Thread Olivier Delalleau
Le 3 mars 2012 10:27, Robert Kern robert.k...@gmail.com a écrit : On Sat, Mar 3, 2012 at 14:34, Robert Kern robert.k...@gmail.com wrote: On Sat, Mar 3, 2012 at 14:31, Ralf Gommers ralf.gomm...@googlemail.com wrote: Because this is also bad: np.TAB Display all 561 possibilities? (y or

Re: [Numpy-discussion] Floating point close function?

2012-03-03 Thread Olivier Delalleau
Le 3 mars 2012 11:03, Robert Kern robert.k...@gmail.com a écrit : On Sat, Mar 3, 2012 at 15:51, Olivier Delalleau sh...@keba.be wrote: Le 3 mars 2012 10:27, Robert Kern robert.k...@gmail.com a écrit : On Sat, Mar 3, 2012 at 14:34, Robert Kern robert.k...@gmail.com wrote: On Sat, Mar 3

Re: [Numpy-discussion] Floating point close function?

2012-03-03 Thread Olivier Delalleau
Le 3 mars 2012 13:07, Joe Kington jking...@wisc.edu a écrit : On Sat, Mar 3, 2012 at 9:26 AM, Robert Kern robert.k...@gmail.com wrote: On Sat, Mar 3, 2012 at 15:22, Benjamin Root ben.r...@ou.edu wrote: On Saturday, March 3, 2012, Robert Kern robert.k...@gmail.com wrote: On Sat, Mar

Re: [Numpy-discussion] copy mask from existing masked array?

2012-03-04 Thread Olivier Delalleau
Should work with: b = numpy.ma.masked_array(b, mask=a.mask) -=- Olivier Le 4 mars 2012 13:01, Chao YUE chaoyue...@gmail.com a écrit : Dear all, I have a matrix with dimension of (360,720) but with all global data. I have another land-sea mask matrix with only 2 unique values in it (land=1,

Re: [Numpy-discussion] all elements equal

2012-03-05 Thread Olivier Delalleau
Le 5 mars 2012 14:29, Keith Goodman kwgood...@gmail.com a écrit : On Mon, Mar 5, 2012 at 11:24 AM, Neal Becker ndbeck...@gmail.com wrote: Keith Goodman wrote: On Mon, Mar 5, 2012 at 11:14 AM, Neal Becker ndbeck...@gmail.com wrote: What is a simple, efficient way to determine if all

Re: [Numpy-discussion] Looking for people interested in helping with Python compiler to LLVM

2012-03-12 Thread Olivier Delalleau
One major difference is that Theano doesn't attempt to parse existing Python (byte)code: you need to explicitly code with the Theano syntax (which tries to be close to Numpy, but can end up looking quite different, especially if you want to control the program flow with loops and ifs for

Re: [Numpy-discussion] Looking for people interested in helping with Python compiler to LLVM

2012-03-20 Thread Olivier Delalleau
This sounds a lot like Theano, did you look into it? -=- Olivier Le 20 mars 2012 13:49, mark florisson markflorisso...@gmail.com a écrit : On 13 March 2012 18:18, Travis Oliphant tra...@continuum.io wrote: (Mark F., how does the above match how you feel about this?) I would like

Re: [Numpy-discussion] Looking for people interested in helping with Python compiler to LLVM

2012-03-20 Thread Olivier Delalleau
... Dag -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. Olivier Delalleau sh...@keba.be wrote: This sounds a lot like Theano, did you look into it? -=- Olivier Le 20 mars 2012 13:49, mark florisson markflorisso...@gmail.com a écrit : On 13 March 2012 18:18, Travis

Re: [Numpy-discussion] How to Extract the Number of Rows and Columns in a Matrix

2012-03-26 Thread Olivier Delalleau
len(M) will give you the number of rows of M. For columns I just use M.shape[1] myself, I don't know if there exists a shortcut. -=- Olivier Le 26 mars 2012 19:03, Stephanie Cooke cooke.stepha...@gmail.com a écrit : Hello, I would like to extract the number of rows and columns of a matrix

Re: [Numpy-discussion] AttributeError with shape command

2012-03-26 Thread Olivier Delalleau
It means array is a regular Python list and not a numpy array. Use numpy.array(array) to convert it into an array. -=- Olivier Le 26 mars 2012 20:07, Stephanie Cooke cooke.stepha...@gmail.com a écrit : Hello, I am new to numpy. When I try to use the command array.shape, I get the following

Re: [Numpy-discussion] Numpy Memory Error with corrcoef

2012-03-27 Thread Olivier Delalleau
Le 27 mars 2012 06:04, Nicole Stoffels nicole.stoff...@forwind.de a écrit : ** Hi Pierre, thanks for the fast answer! I actually have timeseries of 24 hours for 459375 gridpoints in Europe. The timeseries of every grid point is stored in a column. That's why in my real program I already

Re: [Numpy-discussion] how to check type of array?

2012-03-29 Thread Olivier Delalleau
if type(a) == numpy.ndarray: ... if a.dtype == 'int32': ... -=- Olivier Le 29 mars 2012 07:54, Chao YUE chaoyue...@gmail.com a écrit : Dear all, how can I check type of array in if condition expression? In [75]: type(a) Out[75]: type 'numpy.ndarray' In [76]: a.dtype Out[76]:

Re: [Numpy-discussion] ndarray sub-classing and append function

2012-03-31 Thread Olivier Delalleau
It doesn't work because numpy.append(a, ...) doesn't modify the array a in-place: it returns a copy. Then in your append method, doing self = numpy.append(...) won't have any effect: in Python such a syntax means the self local variable will now point to the result of numpy.append, but it won't

Re: [Numpy-discussion] small bug in ndarray.flatten()?

2012-04-05 Thread Olivier Delalleau
It works for me, which version of numpy are you using? What do you get when you type help(b.flatten)? -=- Olivier Le 5 avril 2012 04:45, Chao YUE chaoyue...@gmail.com a écrit : Dear all, Is there a small bug in following? In [2]: b Out[2]: array([[ 0, 1, 2, 3, 4, 5], [ 6,

Re: [Numpy-discussion] apply 'getitem to each element of obj array?

2012-04-05 Thread Olivier Delalleau
Le 5 avril 2012 11:45, Neal Becker ndbeck...@gmail.com a écrit : Adam Hughes wrote: If you are storing objects, then can't you store them in a list and just do: for obj in objectlist: obj.attribute = value Or am I misunderstanding? It's multi-dimensional, and I wanted to

Re: [Numpy-discussion] Fancy-indexing reorders output in corner cases?

2012-05-15 Thread Olivier Delalleau
2012/5/15 Travis Oliphant tra...@continuum.io On May 14, 2012, at 7:07 PM, Stéfan van der Walt wrote: Hi Zach On Mon, May 14, 2012 at 4:33 PM, Zachary Pincus zachary.pin...@yale.edu wrote: The below seems to be a bug, but perhaps it's unavoidably part of the indexing mechanism?

Re: [Numpy-discussion] command for retrieving unmasked data from a mask array?

2012-05-23 Thread Olivier Delalleau
Should be dt3.compressed() -=- Olivier 2012/5/23 Chao YUE chaoyue...@gmail.com Dear all, is there a command for retrieving unmasked data from a mask array? excepting using dt3[~dt3.mask].flatten()? thanks, Chao --

Re: [Numpy-discussion] Should arr.diagonal() return a copy or a view? (1.7 compatibility issue)

2012-05-23 Thread Olivier Delalleau
2012/5/23 Nathaniel Smith n...@pobox.com On Wed, May 23, 2012 at 6:29 PM, Travis Oliphant tra...@continuum.io wrote: Then are you suggesting that we need to back out the changes to the casting rules as well, because this will also cause code to stop working. This is part of my point.

Re: [Numpy-discussion] Meta: help, devel and stackoverflow

2012-06-28 Thread Olivier Delalleau
+1 for a numpy-users list without dev noise. -=- Olivier 2012/6/28 Travis Oliphant tra...@continuum.io There are some good ideas here. I propose splitting this list into devel and users lists. This might best be done by creating a new list for users and using this list for development.

Re: [Numpy-discussion] Dropping support for Python 2.4 in NumPy 1.8

2012-06-28 Thread Olivier Delalleau
2012/6/28 David Cournapeau courn...@gmail.com Hi Travis, On Thu, Jun 28, 2012 at 1:25 PM, Travis Oliphant tra...@continuum.io wrote: Hey all, I'd like to propose dropping support for Python 2.4 in NumPy 1.8 (not the 1.7 release). What does everyone think of that? I think it

Re: [Numpy-discussion] Dropping support for Python 2.4 in NumPy 1.8

2012-06-28 Thread Olivier Delalleau
2012/6/28 Ralf Gommers ralf.gomm...@googlemail.com On Thu, Jun 28, 2012 at 4:44 PM, Olivier Delalleau sh...@keba.be wrote: 2012/6/28 David Cournapeau courn...@gmail.com Hi Travis, On Thu, Jun 28, 2012 at 1:25 PM, Travis Oliphant tra...@continuum.io wrote: Hey all, I'd like

Re: [Numpy-discussion] Do we want scalar casting to behave as it does at the moment?

2012-11-12 Thread Olivier Delalleau
2012/11/12 Nathaniel Smith n...@pobox.com On Mon, Nov 12, 2012 at 8:54 PM, Matthew Brett matthew.br...@gmail.com wrote: Hi, I wanted to check that everyone knows about and is happy with the scalar casting changes from 1.6.0. Specifically, the rules for (array, scalar) casting have

Re: [Numpy-discussion] Do we want scalar casting to behave as it does at the moment?

2012-11-13 Thread Olivier Delalleau
2012/11/12 Matthew Brett matthew.br...@gmail.com Hi, On Mon, Nov 12, 2012 at 8:15 PM, Benjamin Root ben.r...@ou.edu wrote: On Monday, November 12, 2012, Olivier Delalleau wrote: 2012/11/12 Nathaniel Smith n...@pobox.com On Mon, Nov 12, 2012 at 8:54 PM, Matthew Brett matthew.br

Re: [Numpy-discussion] Numpy's policy for releasing memory

2012-11-13 Thread Olivier Delalleau
How are you monitoring memory usage? Personally I've been using psutil and it seems to work well, although I've used it only on Windows and not in applications with large numpy arrays, so I can't tell whether it would work you. Also, keep in mind that: - The auto-delete object when it goes out of

Re: [Numpy-discussion] float32 to float64 casting

2012-11-16 Thread Olivier Delalleau
2012/11/16 Charles R Harris charlesr.har...@gmail.com On Thu, Nov 15, 2012 at 8:24 PM, Gökhan Sever gokhanse...@gmail.comwrote: Hello, Could someone briefly explain why are these two operations are casting my float32 arrays to float64? I1 (np.arange(5, dtype='float32')).dtype O1

Re: [Numpy-discussion] float32 to float64 casting

2012-11-16 Thread Olivier Delalleau
2012/11/16 Olivier Delalleau olivier.delall...@gmail.com 2012/11/16 Charles R Harris charlesr.har...@gmail.com On Thu, Nov 15, 2012 at 11:37 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Thu, Nov 15, 2012 at 8:24 PM, Gökhan Sever gokhanse...@gmail.comwrote: Hello, Could

Re: [Numpy-discussion] float32 to float64 casting

2012-11-17 Thread Olivier Delalleau
2012/11/17 Gökhan Sever gokhanse...@gmail.com On Sat, Nov 17, 2012 at 9:47 AM, Nathaniel Smith n...@pobox.com wrote: On Fri, Nov 16, 2012 at 9:53 PM, Gökhan Sever gokhanse...@gmail.com wrote: Thanks for the explanations. For either case, I was expecting to get float32 as a resulting

Re: [Numpy-discussion] the mean, var, std of empty arrays

2012-11-21 Thread Olivier Delalleau
Current behavior looks sensible to me. I personally would prefer no warning but I think it makes sense to have one as it can be helpful to detect issues faster. -=- Olivier 2012/11/21 Charles R Harris charlesr.har...@gmail.com What should be the value of the mean, var, and std of empty arrays?

Re: [Numpy-discussion] ImportError: libatlas.so.3: cannot open shared object file

2012-12-10 Thread Olivier Delalleau
2012/12/10 Allan Kamau kamaual...@gmail.com I did add the paths to LD_LIBRARY_PATH as advised (see below), then python setup.py clean;python setup.py build;python setup.py install; but the same error persists. export LAPACK=/usr/lib/lapack/liblapack.so;export

Re: [Numpy-discussion] Support for python 2.4 dropped. Should we drop 2.5 also?

2012-12-13 Thread Olivier Delalleau
I'd say it's a good idea, although I hope 1.7.x will still be maintained for a while for those who are still stuck with Python 2.4-5 (sometimes you don't have a choice). -=- Olivier 2012/12/13 Charles R Harris charlesr.har...@gmail.com The previous proposal to drop python 2.4 support garnered

Re: [Numpy-discussion] Support for python 2.4 dropped. Should we drop 2.5 also?

2012-12-13 Thread Olivier Delalleau
2012/12/13 Chris Barker - NOAA Federal chris.bar...@noaa.gov On Thu, Dec 13, 2012 at 3:01 PM, Bradley M. Froehle brad.froe...@gmail.com wrote: Yes, but the point was that since you can live with an older version on Python you can probably live with an older version of NumPy. exactly --

Re: [Numpy-discussion] Do we want scalar casting to behave as it does at the moment?

2013-01-03 Thread Olivier Delalleau
2013/1/3 Andrew Collette andrew.colle...@gmail.com: Hi Dag, If neither is objectively better, I think that is a very good reason to kick it down to the user. Explicit is better than implicit. I agree with you, up to a point. However, we are talking about an extremely common operation that

Re: [Numpy-discussion] Do we want scalar casting to behave as it does at the moment?

2013-01-04 Thread Olivier Delalleau
2013/1/3 Andrew Collette andrew.colle...@gmail.com: Another solution is to forget about trying to be smart and always upcast the operation. That would be my 2nd preferred solution, but it would make it very annoying to deal with Python scalars (typically int64 / float64) that would be

Re: [Numpy-discussion] Scalar casting rules use-case reprise

2013-01-04 Thread Olivier Delalleau
2013/1/4 Nathaniel Smith n...@pobox.com: On Fri, Jan 4, 2013 at 11:09 AM, Matthew Brett matthew.br...@gmail.com wrote: Hi, Reading the discussion on the scalar casting rule change I realized I was hazy on the use-cases that led to the rule that scalars cast differently from arrays. My

Re: [Numpy-discussion] Do we want scalar casting to behave as it does at the moment?

2013-01-04 Thread Olivier Delalleau
(sorry, no time for full reply, so for now just answering what I believe is the main point) 2013/1/4 Andrew Collette andrew.colle...@gmail.com: The ValueError is here to warn you that the operation may not be doing what you want. The rollover for smaller values would be the documented (and

Re: [Numpy-discussion] Do we want scalar casting to behave as it does at the moment?

2013-01-06 Thread Olivier Delalleau
2013/1/5 Nathaniel Smith n...@pobox.com: On Fri, Jan 4, 2013 at 5:25 PM, Andrew Collette andrew.colle...@gmail.com wrote: I agree the current behavior is confusing. Regardless of the details of what to do, I suppose my main objection is that, to me, it's really unexpected that adding a

Re: [Numpy-discussion] Do we want scalar casting to behave as it does at the moment?

2013-01-06 Thread Olivier Delalleau
2013/1/6 Nathaniel Smith n...@pobox.com: On Mon, Jan 7, 2013 at 1:43 AM, Olivier Delalleau sh...@keba.be wrote: 2013/1/5 Nathaniel Smith n...@pobox.com: On Fri, Jan 4, 2013 at 5:25 PM, Andrew Collette andrew.colle...@gmail.com wrote: I agree the current behavior is confusing. Regardless

Re: [Numpy-discussion] Do we want scalar casting to behave as it does at the moment?

2013-01-08 Thread Olivier Delalleau
2013/1/8 Andrew Collette andrew.colle...@gmail.com: Hi, I think you are voting strongly for the current casting rules, because they make it less obvious to the user that scalars are different from arrays. Maybe this is the source of my confusion... why should scalars be different from

Re: [Numpy-discussion] Do we want scalar casting to behave as it does at the moment?

2013-01-08 Thread Olivier Delalleau
2013/1/8 Sebastian Berg sebast...@sipsolutions.net: On Tue, 2013-01-08 at 19:59 +, Nathaniel Smith wrote: On 8 Jan 2013 17:24, Andrew Collette andrew.colle...@gmail.com wrote: Hi, I think you are voting strongly for the current casting rules, because they make it less obvious to

Re: [Numpy-discussion] Do we want scalar casting to behave as it does at the moment?

2013-01-08 Thread Olivier Delalleau
2013/1/8 Chris Barker - NOAA Federal chris.bar...@noaa.gov: On Tue, Jan 8, 2013 at 12:43 PM, Alan G Isaac alan.is...@gmail.com wrote: New users don't use narrow-width dtypes... it's important to remember 1. I think the first statement is wrong. Control over dtypes is a good reason for a new

Re: [Numpy-discussion] Do we want scalar casting to behave as it does at the moment?

2013-01-08 Thread Olivier Delalleau
Le mardi 8 janvier 2013, Andrew Collette a écrit : Hi Dag, So you are saying that, for an array x, you want x + random.randint(10) to produce an array with a random dtype? Under the proposed behavior, depending on the dtype of x and the value from random, this would sometimes

  1   2   >