[Numpy-discussion] Fill a particular value in the place of number satisfying certain condition by another number in an array.

2011-08-01 Thread dileep kunjaai
Dear sir, How can we fill a particular value in the place of number satisfying certain condition by another number in an array. Example: A=[[[ 9.42233087e-42 - 4.71116544e-42 0.e+00 ..., 1.48303127e+01 1.31524124e+01 1.14745111e+01] [ 3.91788793e+00 1.95894396e+00

[Numpy-discussion] C api doc shortcomings

2011-08-01 Thread Robert Elsner
Hey Everybody, I noticed that the c-api docs (2.0.dev-72ab385) lack a clear statement what the preferred entry point into the c-api is (from a users point of view). Normally I would expect a sentence or two stating that the api entry point is arrayobject.h (or whatever). Instead the docs ponder

Re: [Numpy-discussion] Fill a particular value in the place of number satisfying certain condition by another number in an array.

2011-08-01 Thread Miguel de Val-Borro
Dear Dileep, the numpy.where function returns the elements from A or 0 depending if the condition in the first argument is satisfied: B = np.where(A = 0, A, 0) Miguel On Mon, Aug 01, 2011 at 03:01:13PM +0530, dileep kunjaai wrote: Dear sir, How can we fill a particular value in the place

Re: [Numpy-discussion] Fill a particular value in the place of number satisfying certain condition by another number in an array.

2011-08-01 Thread Fabrice Silva
Le lundi 01 août 2011 à 15:01 +0530, dileep kunjaai a écrit : Dear sir, How can we fill a particular value in the place of number satisfying certain condition by another number in an array. A contain some negative value i want to change the negative numbers to '0'. I used 'masked_where',

Re: [Numpy-discussion] Fill a particular value in the place of number satisfying certain condition by another number in an array.

2011-08-01 Thread Jeffrey Spencer
Depends where it is contained but another option is and I find it to typically be faster: B = zeros(A.shape) maximum(A,B,A) On 08/01/2011 07:31 PM, dileep kunjaai wrote: Dear sir, How can we fill a particular value in the place of number satisfying certain condition by another number in

Re: [Numpy-discussion] Fill a particular value in the place of number satisfying certain condition by another number in an array.

2011-08-01 Thread Brett Olsen
This method is probably simpler: In [1]: import numpy as N In [2]: A = N.random.random_integers(-10, 10, 25).reshape((5, 5)) In [3]: A Out[3]: array([[ -5, 9, 1, 9, -2], [ -8, 0, 9, 7, -10], [ 2, -3, -1, 5, -7], [ 0, -2, -2, 9, 1], [ -7,

Re: [Numpy-discussion] Fill a particular value in the place of number satisfying certain condition by another number in an array.

2011-08-01 Thread eat
Hi On Mon, Aug 1, 2011 at 3:14 PM, Jeffrey Spencer jeffspenc...@gmail.comwrote: Depends where it is contained but another option is and I find it to typically be faster: B = zeros(A.shape) maximum(A,B,A) Since maximum(.) can handle broadcasting maximum(A, 0, A) will be even faster. -eat

Re: [Numpy-discussion] recommendation for saving data

2011-08-01 Thread Olivier Delalleau
I personally use pickle, which does exactly what you are asking for (and can be customized with __getstate__ and __setstate__ if needed). What are your issues with pickle? -=- Olivier 2011/7/31 Brian Blais bbl...@bryant.edu Hello, I was wondering if there are any recommendations for formats

Re: [Numpy-discussion] recommendation for saving data

2011-08-01 Thread Christopher Barker
On 7/31/11 5:48 AM, Brian Blais wrote: I was wondering if there are any recommendations for formats for saving scientific data. every field has it's own standards -- I'd try to find one that is likely to be used by folks that may care about your results. For Oceanographic and Atmospheric

Re: [Numpy-discussion] [SciPy-User] recommendation for saving data

2011-08-01 Thread Anne Archibald
In astronomy we tend to use FITS, which is well-supported by pyfits, but a little limited. Some new instruments are beginning to use HDF5. All these generic formats allow very general data storage, so you will need to come up with a standrdized way to represent your own data. Used well, these

Re: [Numpy-discussion] numpy.interp running time

2011-08-01 Thread Timo Kluck
2011/8/1 Timo Kluck tkl...@infty.nl 2011/7/30 Eric Firing efir...@hawaii.edu Maybe the thing to do is to pre-calculate if len(xp) = len(x), or some such guess as to which method would be more efficient. What you're suggesting is reasonable. The cutoff at len(xp) = len(x) can distinguish

[Numpy-discussion] limit to number of fields in recarray

2011-08-01 Thread Craig Yoshioka
Is there a limit to the number of fields a numpy recarray can have? I was getting a strange error about a duplicate column name, but it wasn't a duplicate. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

[Numpy-discussion] hold parameters

2011-08-01 Thread Bevan Jenkins
Hello, I have a function that I fitting to a curve via scipy.optimize.leastsq. The function has 4 parameters and this is all working fine. For a site, I have a number of curves (n=10 in the example below). I would like to some of the parameters to be the best fit across all curves (best fit