Re: [Numpy-discussion] Trick for fast

2012-02-03 Thread josef . pktd
On Fri, Feb 3, 2012 at 1:58 PM, santhu kumar mesan...@gmail.com wrote: Hi Josef, I am unclear on what you want to say, but all I am doing in the code is getting inertia tensor for a bunch of particle masses. (http://en.wikipedia.org/wiki/Moment_of_inertia#Moment_of_inertia_tensor) So the

Re: [Numpy-discussion] Trick for fast

2012-02-03 Thread josef . pktd
On Fri, Feb 3, 2012 at 2:33 PM, josef.p...@gmail.com wrote: On Fri, Feb 3, 2012 at 1:58 PM, santhu kumar mesan...@gmail.com wrote: Hi Josef, I am unclear on what you want to say, but all I am doing in the code is getting inertia tensor for a bunch of particle masses.

Re: [Numpy-discussion] Trick for fast

2012-02-03 Thread josef . pktd
On Fri, Feb 3, 2012 at 4:49 PM, Alan G Isaac alan.is...@gmail.com wrote: On 2/3/2012 3:37 PM, josef.p...@gmail.com wrote: res = - np.dot(x.T, mass*x) res[np.arange(3), np.arange(3)] -= np.trace(res) Nice! Get some speed gain with slicing: res = - np.dot(x.T, mass*x)

Re: [Numpy-discussion] autocorrelation computation performance : use of np.correlate

2012-02-01 Thread josef . pktd
On Wed, Feb 1, 2012 at 6:48 PM, Benjamin Root ben.r...@ou.edu wrote: On Wednesday, February 1, 2012, Pierre Haessig pierre.haes...@crans.org wrote: Hi, [I'm not sure whether this discussion belongs to numpy-discussion or scipy-dev] In day to day time series analysis I regularly need to

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

2012-01-31 Thread josef . pktd
On Tue, Jan 31, 2012 at 5:35 PM, Travis Oliphant tra...@continuum.io wrote: Actually i believe the NumPy 'any' and 'all' names pre-date the Python usage which first appeared in Python 2.5 I agree with Chris that namespaces are a great idea.  I don't agree with deprecating 'any' and 'all' I

Re: [Numpy-discussion] Cross-covariance function

2012-01-26 Thread josef . pktd
On Thu, Jan 26, 2012 at 12:26 PM, Sturla Molden stu...@molden.no wrote: Den 26.01.2012 17:25, skrev Pierre Haessig: However, in the case this change is not possible, I would see this solution : * add and xcov function that does what Elliot and Sturla and I described, because The current

Re: [Numpy-discussion] Cross-covariance function

2012-01-26 Thread josef . pktd
On Thu, Jan 26, 2012 at 3:58 PM, Bruce Southey bsout...@gmail.com wrote: On Thu, Jan 26, 2012 at 12:45 PM,  josef.p...@gmail.com wrote: On Thu, Jan 26, 2012 at 1:25 PM, Bruce Southey bsout...@gmail.com wrote: On Thu, Jan 26, 2012 at 10:07 AM, Pierre Haessig pierre.haes...@crans.org wrote: Le

Re: [Numpy-discussion] view of a structured array?

2012-01-25 Thread josef . pktd
On Wed, Jan 25, 2012 at 2:27 PM, Chris Barker chris.bar...@noaa.gov wrote: HI folks, Is there a way to get a view of a subset of a structured array? I know that an arbitrary subset will not fit into the numpy stridesoffsets model, but some will, and it would be nice to have a view: For

Re: [Numpy-discussion] bug in numpy.mean() ?

2012-01-24 Thread josef . pktd
On Tue, Jan 24, 2012 at 7:21 PM, eat e.antero.ta...@gmail.com wrote: Hi On Wed, Jan 25, 2012 at 1:21 AM, Kathleen M Tacina kathleen.m.tac...@nasa.gov wrote: ** I found something similar, with a very simple example. On 64-bit linux, python 2.7.2, numpy development version: In [22]: a =

Re: [Numpy-discussion] bug in numpy.mean() ?

2012-01-24 Thread josef . pktd
On Wed, Jan 25, 2012 at 12:03 AM, Charles R Harris charlesr.har...@gmail.com wrote: On Tue, Jan 24, 2012 at 4:21 PM, Kathleen M Tacina kathleen.m.tac...@nasa.gov wrote: I found something similar, with a very simple example. On 64-bit linux, python 2.7.2, numpy development version: In

Re: [Numpy-discussion] Cross-covariance function

2012-01-21 Thread josef . pktd
On Sat, Jan 21, 2012 at 6:26 PM, John Salvatier jsalv...@u.washington.edu wrote: I ran into this a while ago and was confused why cov did not behave the way pierre suggested. same here, When I rewrote scipy.stats.spearmanr, I matched the numpy behavior for two arrays, while R only returns the

Re: [Numpy-discussion] np.zeros(2, 'S') returns empty strings.

2012-01-15 Thread josef . pktd
On Sun, Jan 15, 2012 at 3:15 AM, Nathaniel Smith n...@pobox.com wrote: On Sat, Jan 14, 2012 at 2:12 PM, Charles R Harris charlesr.har...@gmail.com wrote: This sort of makes sense, but is it the 'correct' behavior? In [20]: zeros(2, 'S') Out[20]: array(['', ''],   dtype='|S1') I think

Re: [Numpy-discussion] np.zeros(2, 'S') returns empty strings.

2012-01-14 Thread josef . pktd
On Sat, Jan 14, 2012 at 5:25 PM, Benjamin Root ben.r...@ou.edu wrote: On Sat, Jan 14, 2012 at 4:16 PM, Benjamin Root ben.r...@ou.edu wrote: On Sat, Jan 14, 2012 at 4:12 PM, Charles R Harris charlesr.har...@gmail.com wrote: This sort of makes sense, but is it the 'correct' behavior? In

Re: [Numpy-discussion] polynomial package update

2012-01-02 Thread josef . pktd
On Mon, Jan 2, 2012 at 9:44 PM, Charles R Harris charlesr.har...@gmail.com wrote: Hi All, I've made a pull request for a  rather large update of the polynomial package. The new features are 1) Bug fixes 2) Improved documentation in the numpy reference 3) Preliminary support for

Re: [Numpy-discussion] Indexing empty dimensions with empty arrays

2011-12-26 Thread josef . pktd
On Mon, Dec 26, 2011 at 1:51 PM, Ralf Gommers ralf.gomm...@googlemail.com wrote: 2011/12/25 Jordi Gutiérrez Hermoso jord...@octave.org I have been instructed to bring this issue to the mailing list:   http://projects.scipy.org/numpy/ticket/1994 The issue is this corner case: idx = [] x

Re: [Numpy-discussion] Indexing empty dimensions with empty arrays

2011-12-26 Thread josef . pktd
2011/12/26 Jordi Gutiérrez Hermoso jord...@octave.org: On 26 December 2011 14:56, Ralf Gommers ralf.gomm...@googlemail.com wrote: On Mon, Dec 26, 2011 at 8:50 PM, josef.p...@gmail.com wrote: I have a hard time thinking through empty 2-dim arrays, and don't know what rules should apply.

Re: [Numpy-discussion] Binning

2011-12-22 Thread josef . pktd
On Thu, Dec 22, 2011 at 6:27 AM, Adrien Gaidon adnoth...@gmail.com wrote: Hello Nicola, I am not aware of a magical one function numpy solution (is there one numpy gurus?). I don't know if it's optimal, but here's how I usually do similar things. I wrote a simple function that assigns

Re: [Numpy-discussion] Binning

2011-12-22 Thread josef . pktd
On Thu, Dec 22, 2011 at 11:17 AM, josef.p...@gmail.com wrote: On Thu, Dec 22, 2011 at 6:27 AM, Adrien Gaidon adnoth...@gmail.com wrote: Hello Nicola, I am not aware of a magical one function numpy solution (is there one numpy gurus?). I don't know if it's optimal, but here's how I usually

Re: [Numpy-discussion] Binning

2011-12-22 Thread josef . pktd
On Thu, Dec 22, 2011 at 11:39 AM, Adrien adnoth...@gmail.com wrote: Le 22/12/2011 17:17, josef.p...@gmail.com a écrit : On Thu, Dec 22, 2011 at 6:27 AM, Adrien Gaidonadnoth...@gmail.com  wrote: Hello Nicola, I am not aware of a magical one function numpy solution (is there one numpy gurus?).

Re: [Numpy-discussion] Would it be possible to enhance np.unique(.) with a keyword kind

2011-12-19 Thread josef . pktd
On Mon, Dec 19, 2011 at 6:27 PM, eat e.antero.ta...@gmail.com wrote: Hi, Especially when the keyword return_index of np.unique(.) is specified to be True, would it in general also be reasonable to be able to specify the sorting algorithm of the underlying np.argsort(.)? The rationale is

Re: [Numpy-discussion] Would it be possible to enhance np.unique(.) with a keyword kind

2011-12-19 Thread josef . pktd
On Mon, Dec 19, 2011 at 8:16 PM, eat e.antero.ta...@gmail.com wrote: Hi, On Tue, Dec 20, 2011 at 2:33 AM, josef.p...@gmail.com wrote: On Mon, Dec 19, 2011 at 6:27 PM, eat e.antero.ta...@gmail.com wrote: Hi, Especially when the keyword return_index of np.unique(.) is specified to be

Re: [Numpy-discussion] polynomial with negative exponents

2011-12-12 Thread josef . pktd
On Mon, Dec 12, 2011 at 9:04 AM, LASAGNA DAVIDE davide.lasa...@polito.it wrote: Hi, I have written a class for polynomials with negative exponents like: p(x) = a0 + a1*x**-1 + ... + an*x**-n The code is this one: class NegativeExpPolynomial( object ):      def __init__ ( self, coeffs ):

Re: [Numpy-discussion] polynomial with negative exponents

2011-12-12 Thread josef . pktd
On Mon, Dec 12, 2011 at 9:35 AM, josef.p...@gmail.com wrote: On Mon, Dec 12, 2011 at 9:04 AM, LASAGNA DAVIDE davide.lasa...@polito.it wrote: Hi, I have written a class for polynomials with negative exponents like: p(x) = a0 + a1*x**-1 + ... + an*x**-n The code is this one: class

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

2011-12-07 Thread josef . pktd
If I want to know whether something that might be an array is really a plain ndarray and not a subclass, is using `type` the safest bet? All the other forms don't discriminate against subclasses. type(np.ma.zeros(3)) is np.ndarray False type(np.zeros(3)) is np.ndarray True

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

2011-12-06 Thread josef . pktd
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[mask] -=- Olivier 2011/12/6 questions anon questions.a...@gmail.com I would like to produce an array with the maximum values out

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

2011-12-06 Thread josef . pktd
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 something like: a = my_list_of_arrays[0] for b in my_list_of_arrays[1:]:   numpy.maximum(a, b, out=a) I didn't think of the out

Re: [Numpy-discussion] build numpy matrix out of smaller matrix

2011-12-01 Thread josef . pktd
On Thu, Dec 1, 2011 at 12:26 PM, Benjamin Root ben.r...@ou.edu wrote: On Thu, Dec 1, 2011 at 10:52 AM, jonasr jonas.rueb...@web.de wrote: Hi, is there any possibility to define a numpy matrix, via a smaller given matrix, i.e. in matlab i can do this like a=[1 2 ; 3 4 ] A=[a a ; a a ]

[Numpy-discussion] who owns the data?

2011-11-30 Thread josef . pktd
just a basic question (since I haven't looked at this in some time) I'm creating a structured array in a function. However, I want to return the array with just a simple dtype uni = uni.view(dt).reshape(-1, ncols) return uni the returned uni has owndata=False. Who owns the data, since the

Re: [Numpy-discussion] who owns the data?

2011-11-30 Thread josef . pktd
On Wed, Nov 30, 2011 at 4:00 PM, Robert Kern robert.k...@gmail.com wrote: On Wed, Nov 30, 2011 at 20:30,  josef.p...@gmail.com wrote: just a basic question (since I haven't looked at this in some time) I'm creating a structured array in a function. However, I want to return the array with

Re: [Numpy-discussion] what statistical module to use for python?

2011-11-30 Thread josef . pktd
On Wed, Nov 30, 2011 at 1:16 PM, Chao YUE chaoyue...@gmail.com wrote: Hi all, I just want to broadly ask what statistical package are you guys using? I mean routine statistical function like linear regression, GLM, ANOVA... etc. I know there is SciKits packages like statsmodels, but are

[Numpy-discussion] np.dot and array order

2011-11-30 Thread josef . pktd
np.__version__ '1.5.1' official win32 installer (playing with ipython for once) I thought np.dot is Lapack based and favors fortran order, but if the second array is fortran ordered, then dot takes twice as long. The order of the first array seems irrelevant (or maybe just with my shapes, in

[Numpy-discussion] bug in reshape ?

2011-11-22 Thread josef . pktd
might be an old story np.__version__ - '1.5.1' It thought for once it's easier to use reshape to add a new axis instead of ...,None but my results got weird (normal(0,1) sample of 2.13795875e-314) x = 1 y = np.arange(3) z = np.arange(2)[:,None] np.broadcast(x,y,z) numpy.broadcast object at

Re: [Numpy-discussion] speeding up the following expression

2011-11-12 Thread josef . pktd
On Sat, Nov 12, 2011 at 3:36 AM, Geoffrey Zhu zyzhu2...@gmail.com wrote: Hi, I am playing with multiple ways to speed up the following expression (it is in the inner loop): C[1:(M - 1)]=(a * C[2:] + b * C[1:(M-1)] + c * C[:(M-2)]) where C is an array of about 200-300 elements, M=len(C),

Re: [Numpy-discussion] speeding up the following expression

2011-11-12 Thread josef . pktd
On Sat, Nov 12, 2011 at 10:31 AM, Warren Weckesser warren.weckes...@enthought.com wrote: On Sat, Nov 12, 2011 at 6:43 AM, josef.p...@gmail.com wrote: On Sat, Nov 12, 2011 at 3:36 AM, Geoffrey Zhu zyzhu2...@gmail.com wrote: Hi, I am playing with multiple ways to speed up the following

Re: [Numpy-discussion] speeding up the following expression

2011-11-12 Thread josef . pktd
On Sat, Nov 12, 2011 at 11:32 AM, Warren Weckesser warren.weckes...@enthought.com wrote: On Sat, Nov 12, 2011 at 9:59 AM, josef.p...@gmail.com wrote: On Sat, Nov 12, 2011 at 10:31 AM, Warren Weckesser warren.weckes...@enthought.com wrote: On Sat, Nov 12, 2011 at 6:43 AM,

Re: [Numpy-discussion] Moving to gcc 4.* for win32 installers ?

2011-10-30 Thread josef . pktd
On Sun, Oct 30, 2011 at 7:18 AM, David Cournapeau courn...@gmail.com wrote: On Thu, Oct 27, 2011 at 5:19 PM, Ralf Gommers ralf.gomm...@googlemail.com wrote: Hi David, On Thu, Oct 27, 2011 at 3:02 PM, David Cournapeau courn...@gmail.com wrote: Hi, I was wondering if we could finally move

Re: [Numpy-discussion] Moving to gcc 4.* for win32 installers ?

2011-10-27 Thread josef . pktd
On Thu, Oct 27, 2011 at 9:02 AM, David Cournapeau courn...@gmail.com wrote: Hi, I was wondering if we could finally move to a more recent version of compilers for official win32 installers. This would of course concern the next release cycle, not the ones where beta/rc are already in

Re: [Numpy-discussion] dtyping with .astype()

2011-10-17 Thread josef . pktd
On Mon, Oct 17, 2011 at 6:17 AM, Pauli Virtanen p...@iki.fi wrote: 13.10.2011 12:59, Alex van der Spek kirjoitti: gives me a confusing result. I only asked to name the columns and change their types to half precision floats. Structured arrays shouldn't be thought as an array with named

Re: [Numpy-discussion] dtyping with .astype()

2011-10-17 Thread josef . pktd
On Mon, Oct 17, 2011 at 10:18 AM, Pauli Virtanen p...@iki.fi wrote: 17.10.2011 15:48, josef.p...@gmail.com kirjoitti: On Mon, Oct 17, 2011 at 6:17 AM, Pauli Virtanen p...@iki.fi wrote: [clip] What am I missing? How to do this? np.rec.fromarrays(arr.T, dtype=dt) y.astype(float16).view(dt)

Re: [Numpy-discussion] simulate AR

2011-10-14 Thread josef . pktd
On Fri, Oct 14, 2011 at 10:24 AM, Alan G Isaac alan.is...@gmail.com wrote: As a simple example, if I have y0 and a white noise series e, what is the best way to produces a series y such that y[t] = 0.9*y[t-1] + e[t] for t=1,2,...? 1. How can I best simulate an autoregressive process using

Re: [Numpy-discussion] simulate AR

2011-10-14 Thread josef . pktd
On Fri, Oct 14, 2011 at 11:56 AM, Fabrice Silva si...@lma.cnrs-mrs.fr wrote: Le vendredi 14 octobre 2011 à 10:49 -0400, josef.p...@gmail.com a écrit : On Fri, Oct 14, 2011 at 10:24 AM, Alan G Isaac alan.is...@gmail.com wrote: As a simple example, if I have y0 and a white noise series e,

Re: [Numpy-discussion] simulate AR

2011-10-14 Thread josef . pktd
On Fri, Oct 14, 2011 at 12:49 PM, Alan G Isaac alan.is...@gmail.com wrote: On 10/14/2011 12:21 PM, josef.p...@gmail.com wrote: One other way to simulate the AR is to get the (truncated) MA-representation, and then convolve can be used Assuming stationarity ... maybe ? If it's integrated,

Re: [Numpy-discussion] simulate AR

2011-10-14 Thread josef . pktd
On Fri, Oct 14, 2011 at 1:26 PM, Alan G Isaac alan.is...@gmail.com wrote: Assuming stationarity ... On 10/14/2011 1:22 PM, josef.p...@gmail.com wrote: maybe ? I just meant that the MA approximation is not reliable for a non-stationary AR. E.g., http://www.jstor.org/stable/2348631 section

Re: [Numpy-discussion] simulate AR

2011-10-14 Thread josef . pktd
On Fri, Oct 14, 2011 at 2:18 PM, Alan G Isaac alan.is...@gmail.com wrote: On 10/14/2011 1:42 PM, josef.p...@gmail.com wrote: If I remember correctly, signal.lfilter doesn't require stationarity, but handling of the starting values is a bit difficult. Hmm.  Yes. AR(1) is trivial, but how do

Re: [Numpy-discussion] simulate AR

2011-10-14 Thread josef . pktd
On Fri, Oct 14, 2011 at 2:39 PM, Skipper Seabold jsseab...@gmail.com wrote: On Fri, Oct 14, 2011 at 2:18 PM, Alan G Isaac alan.is...@gmail.com wrote: On 10/14/2011 1:42 PM, josef.p...@gmail.com wrote: If I remember correctly, signal.lfilter doesn't require stationarity, but handling of the

Re: [Numpy-discussion] simulate AR

2011-10-14 Thread josef . pktd
On Fri, Oct 14, 2011 at 2:29 PM, josef.p...@gmail.com wrote: On Fri, Oct 14, 2011 at 2:18 PM, Alan G Isaac alan.is...@gmail.com wrote: On 10/14/2011 1:42 PM, josef.p...@gmail.com wrote: If I remember correctly, signal.lfilter doesn't require stationarity, but handling of the starting values

Re: [Numpy-discussion] simulate AR

2011-10-14 Thread josef . pktd
On Fri, Oct 14, 2011 at 2:59 PM, josef.p...@gmail.com wrote: On Fri, Oct 14, 2011 at 2:29 PM,  josef.p...@gmail.com wrote: On Fri, Oct 14, 2011 at 2:18 PM, Alan G Isaac alan.is...@gmail.com wrote: On 10/14/2011 1:42 PM, josef.p...@gmail.com wrote: If I remember correctly, signal.lfilter

Re: [Numpy-discussion] how to list all the values in a ndarray without repeat (like filter in excel)

2011-10-13 Thread josef . pktd
On Thu, Oct 13, 2011 at 9:14 AM, Chao YUE chaoyue...@gmail.com wrote: Dear all, if I have a ndarray like array([1,2,3,2,3,1,1,1,2,2,,2,2,3]) containing some values that are flag for data quality. how can list all the values in this array, like doing a descriptive statistics. I guess I

Re: [Numpy-discussion] the axis parameter in the np.ma.concatenate is not working?

2011-10-13 Thread josef . pktd
On Thu, Oct 13, 2011 at 1:17 PM, Chao YUE chaoyue...@gmail.com wrote: Dear all, I use numpy version 1.5.1 which is installed by default when I do sudo apt-get install numpy on ubuntu 11.04. but it seems that for np.ma.concatenate(arrays, axis), the axis parameter is not working? In [460]:

Re: [Numpy-discussion] wanted: decent matplotlib alternative

2011-10-13 Thread josef . pktd
On Thu, Oct 13, 2011 at 6:42 PM, John Hunter jdh2...@gmail.com wrote: On Thu, Oct 13, 2011 at 5:36 PM, Eric Firing efir...@hawaii.edu wrote: It would be nice to have a social interface for the mpl gallery like the one similar to the R-gallery

Re: [Numpy-discussion] Nice float - integer conversion?

2011-10-11 Thread josef . pktd
On Tue, Oct 11, 2011 at 3:06 PM, Derek Homeier de...@astro.physik.uni-goettingen.de wrote: On 11 Oct 2011, at 20:06, Matthew Brett wrote: Have I missed a fast way of doing nice float to integer conversion? By nice I mean, rounding to the nearest integer, converting NaN to 0, inf, -inf to the

Re: [Numpy-discussion] abs for max negative integers - desired behavior?

2011-10-11 Thread josef . pktd
On Tue, Oct 11, 2011 at 7:13 PM, Benjamin Root ben.r...@ou.edu wrote: On Tue, Oct 11, 2011 at 2:51 PM, Matthew Brett matthew.br...@gmail.com wrote: Hi On Tue, Oct 11, 2011 at 3:16 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Tue, Oct 11, 2011 at 12:23 PM, Matthew Brett

Re: [Numpy-discussion] A Foundation for the support of NumPy and SciPy

2011-10-04 Thread josef . pktd
On Tue, Oct 4, 2011 at 7:36 PM, Nathaniel Smith n...@pobox.com wrote: [Does the group actually exist yet? Google says: No groups match fastecuhla. Replying here instead...] https://groups.google.com/group/fastecuhla I've been following discussions around non-profit incorporation for FOSS

Re: [Numpy-discussion] Dealing with arrays

2011-09-20 Thread josef . pktd
On Tue, Sep 20, 2011 at 10:06 AM, dipo.elegb...@gmail.com wrote: Hi Chico, my list needs to be converted to a numpy array first before I do the count. Some other calculations rely on the count and its going to be built all on numpy. I have tried the collections.Counter() option but in

Re: [Numpy-discussion] Preventing an ndarray subclass from returning new subclass instances for std(), etc

2011-09-18 Thread josef . pktd
On Sun, Sep 18, 2011 at 12:48 PM, Keith Hughitt keith.hugh...@gmail.com wrote: Interesting. It works as expected when called as a method: In [10]: x = np.ma.array([[1,2,3]]) In [11]: x.std() Out[11]: 0.81649658092772603 That's only the treatment of scalars in std x =

Re: [Numpy-discussion] datetime64 y2k38 bug

2011-09-18 Thread josef . pktd
On Sun, Sep 18, 2011 at 11:13 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Sun, Sep 18, 2011 at 9:08 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Sun, Sep 18, 2011 at 6:32 PM, Benjamin Root ben.r...@ou.edu wrote: I was working on adding some test cases in numpy for

Re: [Numpy-discussion] lstsq: masked arrays, weights, scaling, and covariance

2011-09-17 Thread josef . pktd
On Sat, Sep 17, 2011 at 2:52 PM, Charles R Harris charlesr.har...@gmail.com wrote: Hi All, I'd like to start a discussion about modifications to lstsq to accommodate the new masked arrays and move weights, scaling, and covariance determination down to a lower common level. This is motivated

Re: [Numpy-discussion] Bug in numpy std, etc. with other data structures?

2011-09-17 Thread josef . pktd
On Sat, Sep 17, 2011 at 5:12 PM, Wes McKinney wesmck...@gmail.com wrote: On Sat, Sep 17, 2011 at 4:48 PM, Skipper Seabold jsseab...@gmail.com wrote: Just ran into this. Any objections for having numpy.std and other functions in core/fromnumeric.py call asanyarray before trying to use the

Re: [Numpy-discussion] non-uniform discrete sampling with given probabilities (w/ and w/o replacement)

2011-08-31 Thread josef . pktd
On Wed, Aug 31, 2011 at 3:22 PM, Olivier Delalleau sh...@keba.be wrote: 2011/8/31 Christopher Jordan-Squire cjord...@uw.edu On Wed, Aug 31, 2011 at 2:07 PM, Olivier Delalleau sh...@keba.be wrote: You can use: 1 + numpy.argmax(numpy.random.multinomial(1, [0.1, 0.2, 0.7])) For your real

Re: [Numpy-discussion] converting standard array to record array

2011-08-30 Thread josef . pktd
On Tue, Aug 30, 2011 at 4:34 PM, Bryce Ready bryce.re...@gmail.com wrote: Hello all, So i'm using numpy 1.6.0, and trying to convert a (4,4) numpy array of dtype 'f8' into a record array of this dtype: dt = np.dtype([('mat','(4,4)f8')]) Here is the code snippet: In [21]: a =

Re: [Numpy-discussion] Identifying Colinear Columns of a Matrix

2011-08-26 Thread josef . pktd
On Fri, Aug 26, 2011 at 1:41 PM, Mark Janikas mjani...@esri.com wrote: I wonder if my last statement is essentially the only answer... which I wanted to avoid... Should I just use combinations of the columns and try and construct the corrcoef() (then ID whether NaNs are present), or use the

Re: [Numpy-discussion] Identifying Colinear Columns of a Matrix

2011-08-26 Thread josef . pktd
On Fri, Aug 26, 2011 at 2:57 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Fri, Aug 26, 2011 at 12:38 PM, Mark Janikas mjani...@esri.com wrote: Charles!  That looks like it could be a winner!  It looks like you always choose the last column of the U matrix and ID the columns that

Re: [Numpy-discussion] c-info.ufunc-tutorial.rst

2011-08-24 Thread josef . pktd
On Wed, Aug 24, 2011 at 8:43 PM, Anthony Scopatz scop...@gmail.com wrote: On Wed, Aug 24, 2011 at 7:34 PM, srean srean.l...@gmail.com wrote: Thanks Anthony and Mark, this is good to know. So what would be the advised way of looking at freshly baked documentation ? Just look at the raw

[Numpy-discussion] life expectancy of scipy.stats nan statistics

2011-08-19 Thread josef . pktd
I'm just looking at http://projects.scipy.org/scipy/ticket/1200 I agree with Ralf that the bias keyword should be changed to ddof as in the numpy functions. For functions in scipy.stats, and statistics in general, I prefer the usual axis=0 default. However, I think these functions, like

Re: [Numpy-discussion] [SciPy-User] disabling SVN (was: Trouble installing scipy after upgrading to Mac OS X 10.7 aka Lion)

2011-08-13 Thread josef . pktd
On Sat, Aug 13, 2011 at 3:45 PM, Pauli Virtanen p...@iki.fi wrote: Sat, 13 Aug 2011 18:14:11 +0200, Ralf Gommers wrote: [clip] We should check if there's still any code in SVN branches that is useful. If so the people who are interested in it should move it somewhere else. Anyone? All the

Re: [Numpy-discussion] numpydoc - latex longtables error

2011-08-10 Thread josef . pktd
On Wed, Aug 10, 2011 at 6:17 PM, Matthew Brett matthew.br...@gmail.com wrote: Hi, On Wed, Aug 10, 2011 at 12:38 PM, Skipper Seabold jsseab...@gmail.com wrote: On Wed, Aug 10, 2011 at 3:28 PM, Matthew Brett matthew.br...@gmail.com wrote: Hi, I think this one might be for Pauli. I've run

Re: [Numpy-discussion] hold parameters

2011-08-02 Thread josef . pktd
On Mon, Aug 1, 2011 at 8:43 PM, Bevan Jenkins beva...@gmail.com wrote: 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

Re: [Numpy-discussion] random numbers from arbitrary distribution

2011-07-07 Thread josef . pktd
On Thu, Jul 7, 2011 at 9:26 AM, Wolfgang Kerzendorf wkerzend...@googlemail.com wrote: Hi all, Is there an  way to get random numbers from an arbitrary distribution already built-in to numpy. I am interested to do that for a black body distribution What's a black body distributions? From a

Re: [Numpy-discussion] NA/Missing Data Conference Call Summary

2011-07-06 Thread josef . pktd
On Wed, Jul 6, 2011 at 3:38 PM, Christopher Jordan-Squire cjord...@uw.edu wrote: On Wed, Jul 6, 2011 at 11:38 AM, Christopher Barker chris.bar...@noaa.gov wrote: Christopher Jordan-Squire wrote: If we follow those rules for IGNORE for all computations, we sometimes get some weird output.

Re: [Numpy-discussion] NA/Missing Data Conference Call Summary

2011-07-06 Thread josef . pktd
On Wed, Jul 6, 2011 at 4:22 PM, Christopher Jordan-Squire cjord...@uw.edu wrote: On Wed, Jul 6, 2011 at 1:08 PM, josef.p...@gmail.com wrote: On Wed, Jul 6, 2011 at 3:38 PM, Christopher Jordan-Squire cjord...@uw.edu wrote: On Wed, Jul 6, 2011 at 11:38 AM, Christopher Barker

Re: [Numpy-discussion] NA/Missing Data Conference Call Summary

2011-07-06 Thread josef . pktd
On Wed, Jul 6, 2011 at 4:38 PM, josef.p...@gmail.com wrote: On Wed, Jul 6, 2011 at 4:22 PM, Christopher Jordan-Squire cjord...@uw.edu wrote: On Wed, Jul 6, 2011 at 1:08 PM, josef.p...@gmail.com wrote: On Wed, Jul 6, 2011 at 3:38 PM, Christopher Jordan-Squire cjord...@uw.edu wrote:

Re: [Numpy-discussion] NA/Missing Data Conference Call Summary

2011-07-06 Thread josef . pktd
On Wed, Jul 6, 2011 at 7:14 PM, Christopher Jordan-Squire cjord...@uw.edu wrote: On Wed, Jul 6, 2011 at 3:47 PM, josef.p...@gmail.com wrote: On Wed, Jul 6, 2011 at 4:38 PM,  josef.p...@gmail.com wrote: On Wed, Jul 6, 2011 at 4:22 PM, Christopher Jordan-Squire cjord...@uw.edu wrote:

Re: [Numpy-discussion] Conditional random variables

2011-07-05 Thread josef . pktd
On Tue, Jul 5, 2011 at 10:33 AM, Ted To rainexpec...@theo.to wrote: On 07/05/2011 10:17 AM, josef.p...@gmail.com wrote: On Mon, Jul 4, 2011 at 10:13 PM, Ted To rainexpec...@theo.to wrote: Hi, Is there an easy way to make random draws from a conditional random variable?  E.g., draw a random

Re: [Numpy-discussion] Conditional random variables

2011-07-05 Thread josef . pktd
On Tue, Jul 5, 2011 at 12:26 PM, Ted To rainexpec...@theo.to wrote: On 07/05/2011 11:07 AM, josef.p...@gmail.com wrote: For example sample x=U and then sample y=u-x. That's two univariate normal samples. Ah, that's what I was looking for!  Many thanks! just in case I wasn't clear, if x and y

Re: [Numpy-discussion] alterNEP - was: missing data discussion round 2

2011-07-02 Thread josef . pktd
On Sat, Jul 2, 2011 at 4:10 PM, Benjamin Root ben.r...@ou.edu wrote: On Fri, Jul 1, 2011 at 11:40 PM, Nathaniel Smith n...@pobox.com wrote: I'm not sure what you mean here. If we have masked array support at all (and some people seem to want it), then we have to say more than it's an array

Re: [Numpy-discussion] Moving lib.recfunctions?

2011-07-01 Thread josef . pktd
On Fri, Jul 1, 2011 at 1:59 PM, Skipper Seabold jsseab...@gmail.com wrote: lib.recfunctions has never been fully advertised. The two bugs I just discovered lead me to believe that it's not that well vetted, but it is useful. I can't be the only one using these? What do people think of either

Re: [Numpy-discussion] Fitting Log normal or truncated log normal distibution to three points

2011-06-30 Thread josef . pktd
On Thu, Jun 30, 2011 at 5:25 AM, Christoph Deil deil.christ...@googlemail.com wrote: On Jun 30, 2011, at 10:03 AM, Sachin Kumar Sharma wrote: Hi, I have three points 10800, 81100, 582000. What is the easiest way of fitting a log normal and truncated log normal distribution to these three

Re: [Numpy-discussion] Multiply along axis

2011-06-29 Thread josef . pktd
On Wed, Jun 29, 2011 at 11:05 AM, Robert Elsner ml...@re-factory.de wrote: Yeah great that was spot-on. And I thought I knew most of the slicing tricks. I combined it with a slice object so that idx_obj = [ None for i in xrange(a.ndim) ] or idx_obj = [None] * a.ndim otherwise this is also

Re: [Numpy-discussion] missing data discussion round 2

2011-06-27 Thread josef . pktd
On Mon, Jun 27, 2011 at 2:24 PM, eat e.antero.ta...@gmail.com wrote: On Mon, Jun 27, 2011 at 8:53 PM, Mark Wiebe mwwi...@gmail.com wrote: On Mon, Jun 27, 2011 at 12:44 PM, eat e.antero.ta...@gmail.com wrote: Hi, On Mon, Jun 27, 2011 at 6:55 PM, Mark Wiebe mwwi...@gmail.com wrote: First

Re: [Numpy-discussion] missing data discussion round 2

2011-06-27 Thread josef . pktd
On Mon, Jun 27, 2011 at 5:01 PM, Mark Wiebe mwwi...@gmail.com wrote: On Mon, Jun 27, 2011 at 2:59 PM, josef.p...@gmail.com wrote: On Mon, Jun 27, 2011 at 2:24 PM, eat e.antero.ta...@gmail.com wrote: On Mon, Jun 27, 2011 at 8:53 PM, Mark Wiebe mwwi...@gmail.com wrote: On Mon, Jun 27,

Re: [Numpy-discussion] A bit of advice?

2011-06-23 Thread josef . pktd
On Thu, Jun 23, 2011 at 8:20 AM, Neal Becker ndbeck...@gmail.com wrote: Olivier Delalleau wrote: What about : dict((k, [e for e in arr if (e['x0'], e['x1']) == k]) for k in cases) ? Not bad!  Thanks! BTW, is there an easier way to get the unique keys, then this: cases = tuple (set

Re: [Numpy-discussion] feedback request: proposal to add masks to the core ndarray

2011-06-23 Thread josef . pktd
On Thu, Jun 23, 2011 at 5:37 PM, Mark Wiebe mwwi...@gmail.com wrote: On Thu, Jun 23, 2011 at 4:19 PM, Nathaniel Smith n...@pobox.com wrote: I'd like to see a statement of what the missing data problem is, and how this solves it? Because I don't think this is entirely intuitive, or that

Re: [Numpy-discussion] tighten up ufunc casting rule

2011-06-05 Thread josef . pktd
On Sun, Jun 5, 2011 at 6:51 PM, Gael Varoquaux gael.varoqu...@normalesup.org wrote: On Sun, Jun 05, 2011 at 04:41:26PM -0600, Charles R Harris wrote:      Now, with regards to the actual failures induced by the new      branch, it took me a while to understand why they where happening,      

Re: [Numpy-discussion] New functions.

2011-06-02 Thread josef . pktd
On Wed, Jun 1, 2011 at 9:35 PM, David Cournapeau courn...@gmail.com wrote: On Thu, Jun 2, 2011 at 1:49 AM, Mark Miller markperrymil...@gmail.com wrote: Not quite. Bincount is fine if you have a set of approximately sequential numbers. But if you don't Even worse, it fails miserably if you

Re: [Numpy-discussion] New functions.

2011-06-01 Thread josef . pktd
My favorite missing extension to numpy functions np.bincount with 2 (or more) dimensional weights for fast calculation of group statistics. Josef ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

[Numpy-discussion] random seed replicate 2d randn with 1d loop

2011-05-23 Thread josef . pktd
I have a function in two versions, one vectorized, one with loop the vectorized function gets all randn variables in one big array rvs = distr.rvs(args, **{'size':(nobs, nrep)}) the looping version has: for irep in xrange(nrep): rvs = distr.rvs(args, **{'size':nobs}) the rest

Re: [Numpy-discussion] random seed replicate 2d randn with 1d loop

2011-05-23 Thread josef . pktd
On Mon, May 23, 2011 at 3:02 PM, Robert Kern robert.k...@gmail.com wrote: On Mon, May 23, 2011 at 13:33,  josef.p...@gmail.com wrote: I have a function in two versions, one vectorized, one with loop the vectorized function  gets all randn variables in one big array rvs = distr.rvs(args,

Re: [Numpy-discussion] random seed replicate 2d randn with 1d loop

2011-05-23 Thread josef . pktd
On Mon, May 23, 2011 at 3:27 PM, Bruce Southey bsout...@gmail.com wrote: On 05/23/2011 02:02 PM, Robert Kern wrote: On Mon, May 23, 2011 at 13:33,josef.p...@gmail.com  wrote: I have a function in two versions, one vectorized, one with loop the vectorized function  gets all randn variables in

[Numpy-discussion] more python 3.2 fun

2011-05-19 Thread josef . pktd
(just illustrating some porting fun) I was struggling with another python 3.2 bug in scikits.statsmodels (with grunfeld data) with numpy 1.5.1, I'm reading the data with data = recfromtxt(open(filepath + '/grunfeld.csv', 'rb'), delimiter=,, names=True, dtype=f8,f8,f8,a17,f8)

Re: [Numpy-discussion] Linear assignment problem: Jonker-Volgenant algorithm

2011-05-16 Thread josef . pktd
On Mon, May 16, 2011 at 8:53 AM, Charles R Harris charlesr.har...@gmail.com wrote: On Mon, May 16, 2011 at 1:18 AM, Gael Varoquaux gael.varoqu...@normalesup.org wrote: Following a suggestion by Joseph, I am trying to implement the Jonker-Volgenant algorithm for best linear assignment in

Re: [Numpy-discussion] Creating a 1-d structured array

2011-05-13 Thread josef . pktd
On Fri, May 13, 2011 at 10:58 AM, Bruce Southey bsout...@gmail.com wrote: Hi, How do you create a 'single' structured array using np.array()? Basically I am attempting to do something like this that does not work: a=np.array([1,2, 3,4, 5,6], dtype=np.dtype([('foo', int)])) I realize that

Re: [Numpy-discussion] Creating a 1-d structured array

2011-05-13 Thread josef . pktd
On Fri, May 13, 2011 at 3:11 PM, Derek Homeier de...@astro.physik.uni-goettingen.de wrote: Hi, just a comment since I first thought the solution below might not be what Bruce was looking for, but having realised it's probably what he's been asking for... On 13 May 2011, at 17:20,

Re: [Numpy-discussion] Creating a 1-d structured array

2011-05-13 Thread josef . pktd
On Fri, May 13, 2011 at 5:03 PM, Bruce Southey bsout...@gmail.com wrote: On 05/13/2011 03:04 PM, josef.p...@gmail.com wrote: On Fri, May 13, 2011 at 3:11 PM, Derek Homeier de...@astro.physik.uni-goettingen.de  wrote: Hi, just a comment since I first thought the solution below might not be

Re: [Numpy-discussion] ANN: Numpy 1.6.0 release candidate 2

2011-05-03 Thread josef . pktd
On Tue, May 3, 2011 at 5:06 PM, Ralf Gommers ralf.gomm...@googlemail.com wrote: On Tue, May 3, 2011 at 10:35 PM, Christoph Gohlke cgoh...@uci.edu wrote: On 5/3/2011 11:18 AM, Ralf Gommers wrote: Hi, I am pleased to announce the availability of the second release candidate of NumPy 1.6.0.

Re: [Numpy-discussion] Less dimensions than expected with record array

2011-04-29 Thread josef . pktd
On Fri, Apr 29, 2011 at 10:56 PM, Alan Gibson dyssid...@gmail.com wrote: Hello all, This question may seem elementary (mostly because it is), but I can't find documentation anywhere as to why the following are true: import numpy as np data = [(1,2,3),(4,5,6),(7,8,9)] dt =

Re: [Numpy-discussion] Array as Variable using from cdms2 import MV2 as MV

2011-04-25 Thread josef . pktd
On Mon, Apr 25, 2011 at 2:50 AM, dileep kunjaai dileepkunj...@gmail.com wrote: Dear sir, I am have 2  mxn numpy array say obs fcst. I have to calculate sum of squre of (obs[i, j]-fcst[i, j]) using from cdms2 import MV2 as MV   in CDAT without using for  loop. For example:

Re: [Numpy-discussion] Python crashes while printing a huge numpy array (Windows 1.6b2)

2011-04-23 Thread josef . pktd
On Sat, Apr 23, 2011 at 9:41 AM, David Cournapeau courn...@gmail.com wrote: On Sat, Apr 23, 2011 at 10:33 PM, Till Stensitzki mail.t...@gmx.de wrote: Hello, due a mistake i found the following bug: import numpy as np x=np.zeros((262144, 262144)) print x.shape Hm, this is a bit weird. The

Re: [Numpy-discussion] Python crashes while printing a huge numpy array (Windows 1.6b2)

2011-04-23 Thread josef . pktd
On Sat, Apr 23, 2011 at 10:01 AM, josef.p...@gmail.com wrote: On Sat, Apr 23, 2011 at 9:41 AM, David Cournapeau courn...@gmail.com wrote: On Sat, Apr 23, 2011 at 10:33 PM, Till Stensitzki mail.t...@gmx.de wrote: Hello, due a mistake i found the following bug: import numpy as np

Re: [Numpy-discussion] Suggestion: Add the unsqueeze function to numpy

2011-04-20 Thread josef . pktd
On Wed, Apr 20, 2011 at 6:27 AM, Yannick Copin y.co...@ipnl.in2p3.fr wrote: Hi, I'm a very frequent user of the following unsqueeze function, which I initially copied from scipy/stats/models/robust/scale.py and which seems to be also present in scikits.statsmodels.tools.unsqueeze. Would it be

Re: [Numpy-discussion] Suggestion: Add the unsqueeze function to numpy

2011-04-20 Thread josef . pktd
On Wed, Apr 20, 2011 at 2:19 PM, Daniel Lepage dplep...@gmail.com wrote: You can also insert new axes when you slice an array via np.newaxis, fwiw: import numpy as np x = np.random.random((3,4,5)) y = x.mean(axis=1) y.shape (3, 5) y[:,np.newaxis,:].shape (3, 1, 5) That's convenient if

<    1   2   3   4   5   6   7   8   9   10   >