Re: [Numpy-discussion] Setting contents of buffer for array object

2008-02-10 Thread Anne Archibald
On 10/02/2008, Matthew Brett <[EMAIL PROTECTED]> wrote: > > Ah, I see. You definitely do not want to reassign the .data buffer in > > this case. An out= parameter does not reassign the memory location > > that the array object points to. It should use the allocated memory > > that was already there

Re: [Numpy-discussion] Setting contents of buffer for array object

2008-02-11 Thread Anne Archibald
On 11/02/2008, Matthew Brett <[EMAIL PROTECTED]> wrote: > > I can also see that this could possibly be improved by using a for > > loop to iterate over the output elements, so that there was no need to > > duplicate the large input array, or perhaps a "blocked" iteration that > > duplicated arrays

Re: [Numpy-discussion] Median advice

2008-02-12 Thread Anne Archibald
On 12/02/2008, Matthew Brett <[EMAIL PROTECTED]> wrote: > Suggestion 1: > def median(a, axis=0, out=None) [...] > Suggestion 2: > def median(a, axis=0, scratch_input=False) No reason not to combine the two. It's a pretty straightforward modification to do the sorting in place, and it could make a

Re: [Numpy-discussion] sort method raises unexpected error with axis=None

2008-02-12 Thread Anne Archibald
On 12/02/2008, Matthew Brett <[EMAIL PROTECTED]> wrote: > Is it possible, in fact, to do an inplace sort on an array with > axis=None (ie flat sort)? It is, sometimes; just make an array object to point to the flattened version and sort that: In [16]: b = a[:] In [17]: b.shape = (16,) In [18]:

Re: [Numpy-discussion] sort method raises unexpected error with axis=None

2008-02-12 Thread Anne Archibald
On 12/02/2008, Anne Archibald <[EMAIL PROTECTED]> wrote: > An efficient way to handle in-place (or out-of-place, come to think of > it) median along multiple axes is actually to take medians along all > axes in succession. That saves you some sorting effort, and some > progr

Re: [Numpy-discussion] Proxy array class and units

2008-02-13 Thread Anne Archibald
On 13/02/2008, Dan Goodman <[EMAIL PROTECTED]> wrote: > Background: I'm writing a package to run simulations which make extensive use > of > linear algebra, for which I'm using numpy. However - it is important to my > package that quantities can have dimesions, so I've written a class Quantity >

Re: [Numpy-discussion] Matching 0-d arrays and NumPy scalars

2008-02-21 Thread Anne Archibald
On 21/02/2008, Stefan van der Walt <[EMAIL PROTECTED]> wrote: > Could I ask that we also consider implementing len() for 0-d arrays? > numpy.asarray returns those as-is, and I would like to be able to > handle them just as I do any other 1-dimensional array. I don't know > if a length of 1 wo

Re: [Numpy-discussion] numpy 1:1.0.4: numpy.average() returns the wrong result with weights

2008-02-22 Thread Anne Archibald
On 22/02/2008, Travis E. Oliphant <[EMAIL PROTECTED]> wrote: > Is there a ticket on the NumPy trac for this? We won't see it if there > isn't. Thanks for pointing us to the bug. It appears to be fixed in SVN (that was quick!). But the Debian bug report also points out a peculiar unnecessary us

Re: [Numpy-discussion] Optimize speed of for loop using numpy

2008-02-26 Thread Anne Archibald
On 25/02/2008, Trond Kristiansen <[EMAIL PROTECTED]> wrote: > I have attached the function that the FOR loop is part of as a python file. > What I am trying to do is to create a set of functions that will read the > output files (NetCDF) from running the ROMS model (ocean model). The output >

Re: [Numpy-discussion] contiguous true

2008-02-29 Thread Anne Archibald
On 01/03/2008, Charles R Harris <[EMAIL PROTECTED]> wrote: > > On Fri, Feb 29, 2008 at 10:53 AM, John Hunter <[EMAIL PROTECTED]> wrote: > > > I have a boolean array and would like to find the lowest index "ind" > > > where N contiguous elements are all True. Eg, if x is [...] > Oops, ind = aran

Re: [Numpy-discussion] numpy.correlate with phase offset 1D data series

2008-03-03 Thread Anne Archibald
On 03/03/2008, Ray Schumacher <[EMAIL PROTECTED]> wrote: > > I'm trying to figure out what numpy.correlate does, and, what are people > using to calculate the phase shift of 1D signals? I use a hand-rolled Fourier-domain cross-correlation, but then, I'm using a Fourier-domain representation of my

Re: [Numpy-discussion] numpy.correlate with phase offset 1D data series

2008-03-03 Thread Anne Archibald
On 03/03/2008, Ray Schumacher <[EMAIL PROTECTED]> wrote: > Xie's 2D algorithm reduced to 1D works nicely for computing the > relative phase, but is it the fastest way? It might be, since some > correlation algorithms use FFTs as well. What does _correlateND use, in > scipy? Which way will be

Re: [Numpy-discussion] Pickling and initializing

2008-03-03 Thread Anne Archibald
On 03/03/2008, Dinesh B Vadhia <[EMAIL PROTECTED]> wrote: > When you pickle a numpy/scipy matrix does it have to be initialized by > another program? For example: Most python objects do not need to be initialized. You just call a function that makes the one you want: >>> l = range(10) This mak

Re: [Numpy-discussion] argmin & min on ndarrays

2008-03-04 Thread Anne Archibald
On 04/03/2008, Pierre GM <[EMAIL PROTECTED]> wrote: > All, > Let a & b be two ndarrays of the same shape. I'm trying to find the elements > of b that correspond to the minima of a along an arbitrary axis. > The problem is trivial when axis=None or when a.ndim=2, but I'm getting > confused with

Re: [Numpy-discussion] argmin & min on ndarrays

2008-03-04 Thread Anne Archibald
On 04/03/2008, Pierre GM <[EMAIL PROTECTED]> wrote: > Anne, > > Thanks a lot for your suggestion. Something like > > >>>if axis is None: > >>>return b.flat[a.argmin()] > >>>else: > >>> return numpy.choose(a.argmin(axis),numpy.rollaxis(b,axis,0)) > > seems to do the trick fairly nicely i

Re: [Numpy-discussion] Slice and assign into new NDarray...

2008-03-08 Thread Anne Archibald
On 08/03/2008, Vince Fulco <[EMAIL PROTECTED]> wrote: > I have an ND array with shape (10,15) and want to slice or subset(?) the data > into a new 2D array with the following criteria: > > 1) Separate each 5 observations along axis=0 (row) and transpose them to > the new array with shape (50,3

Re: [Numpy-discussion] Array assignment problem

2008-03-11 Thread Anne Archibald
On 11/03/2008, Dinesh B Vadhia <[EMAIL PROTECTED]> wrote: > Hello! I'm reading a text file with two numbers in str format on each line. > The numbers are converted into integers. Each integer is then assigned to > a 2-dimensional array ij (see code below). The problem is that neither of > the

Re: [Numpy-discussion] dimensions too large error

2008-03-14 Thread Anne Archibald
On 14/03/2008, Dinesh B Vadhia <[EMAIL PROTECTED]> wrote: > For the following code: > > I = 18000 > J = 33000 > filename = 'ij.txt' > A = scipy.asmatrix(numpy.empty((I,J), dtype=numpy.int)) > for line in open(filename, 'r'): > etc. > > The following message appears: > > Traceback (most

Re: [Numpy-discussion] Numpy and OpenMP

2008-03-15 Thread Anne Archibald
On 15/03/2008, Damian Eads <[EMAIL PROTECTED]> wrote: > Robert Kern wrote: > > Eric Jones tried to use multithreading to split the computation of > > ufuncs across CPUs. Ultimately, the overhead of locking and unlocking > > made it prohibitive for medium-sized arrays and only somewhat > > disap

Re: [Numpy-discussion] how to build a series of arrays as I go?

2008-03-17 Thread Anne Archibald
On 17/03/2008, Alan G Isaac <[EMAIL PROTECTED]> wrote: > > Alan suggested: > > >> 1. http://www.scipy.org/Numpy_Example_List_With_Doc > > On Mon, 17 Mar 2008, Chris Withers apparently wrote: > > > Yeah, read that, wood, trees, can't tell the... > > Oh, then you might want > http://www.scipy.org

Re: [Numpy-discussion] Inplace index suprise

2008-03-20 Thread Anne Archibald
On 20/03/2008, Gael Varoquaux <[EMAIL PROTECTED]> wrote: > On Thu, Mar 20, 2008 at 06:17:44PM +, James Philbin wrote: > > Hi, > > > > This cannot work, because the inplace operation does not > > > take place as a for loop. > > Well, this would be fine if I was assigning the values to temp

Re: [Numpy-discussion] Improving Docs on Wiki

2008-03-21 Thread Anne Archibald
On 21/03/2008, Sebastian Haase <[EMAIL PROTECTED]> wrote: > Comment: I have read the module- or directory-name "core" many times > on this list, however: Who really knows where a given functions > belongs ? Isn't that mostly only the numpy svn commiters ? > In other words, using only the pyth

Re: [Numpy-discussion] Improving Docs on Wiki

2008-03-21 Thread Anne Archibald
On 21/03/2008, Stéfan van der Walt <[EMAIL PROTECTED]> wrote: > On Fri, Mar 21, 2008 at 2:47 PM, Anne Archibald > <[EMAIL PROTECTED]> wrote: > > Is it perhaps possible to make all numpy functions accessible in > > submodules (in addition to in numpy, fo

Re: [Numpy-discussion] numpy's future (1.1 and beyond): which direction(s) ?

2008-03-21 Thread Anne Archibald
On 21/03/2008, Gnata Xavier <[EMAIL PROTECTED]> wrote: > Something like http://idlastro.gsfc.nasa.gov/idl_html_help/TOTAL.html > (Thread Pool Keywords) would be nice. > A "total like" function could be a great pathfinder a put threads into > numpy keeping the things as simple as they should re

Re: [Numpy-discussion] Openmp support (was numpy's future (1.1 and beyond): which direction(s) ?)

2008-03-22 Thread Anne Archibald
On 22/03/2008, Thomas Grill <[EMAIL PROTECTED]> wrote: > I've experimented with branching the ufuncs into different constant > strides and aligned/unaligned cases to be able to use SSE using > compiler intrinsics. > I expected a considerable gain as i was using float32 with stride 1 > most of

Re: [Numpy-discussion] Openmp support (was numpy's future (1.1 and beyond): which direction(s) ?)

2008-03-22 Thread Anne Archibald
On 22/03/2008, Travis E. Oliphant <[EMAIL PROTECTED]> wrote: > James Philbin wrote: > > Personally, I think that the time would be better spent optimizing > > routines for single-threaded code and relying on BLAS and LAPACK > > libraries to use multiple cores for more complex calculations. In >

Re: [Numpy-discussion] How to set array values based on a condition?

2008-03-22 Thread Anne Archibald
On 23/03/2008, Damian Eads <[EMAIL PROTECTED]> wrote: > Hi, > > I am working on a memory-intensive experiment with very large arrays so > I must be careful when allocating memory. Numpy already supports a > number of in-place operations (+=, *=) making the task much more > manageable. However,

Re: [Numpy-discussion] Openmp support (was numpy's future (1.1 and beyond): which direction(s) ?)

2008-03-23 Thread Anne Archibald
On 23/03/2008, David Cournapeau <[EMAIL PROTECTED]> wrote: > Gnata Xavier wrote: > > > > Hi, > > > > I have a very limited knowledge of openmp but please consider this > > testcase : > > > > > > > Honestly, if it was that simple, it would already have been done for a > long time. The proble

Re: [Numpy-discussion] [SciPy-user] conforming to Python GIL...

2008-04-03 Thread Anne Archibald
On 03/04/2008, Travis E. Oliphant <[EMAIL PROTECTED]> wrote: > fred wrote: > > Hi, > > > > I use a lot of ConVeX OPTimsation and fortran (via f2py) routines in my > > Traits app. > > > > As I want to compute the data and want to display them, I use threads. > > > > The issue I get is that d

Re: [Numpy-discussion] Final push for NumPy 1.0.5 (I need your help!)

2008-04-04 Thread Anne Archibald
On 04/04/2008, Jarrod Millman <[EMAIL PROTECTED]> wrote: > Since I sent my email last night another 5+ tickets have been closed. > If we keep going at this rate, we should be able to release 1.0.5 next > Friday (4/11) with every ticket closed. Specifically, thanks to > Travis Oliphant, David H

Re: [Numpy-discussion] Final push for NumPy 1.0.5 (I need your help!)

2008-04-04 Thread Anne Archibald
On 04/04/2008, Travis E. Oliphant <[EMAIL PROTECTED]> wrote: > Hey Anne, > > Do you currently have SVN access? Would you like it? > > I think the SciPy/NumPy sprint would be a good time to clean-up the > committers list and add new people interested in helping. I don't have SVN access. I'd b

Re: [Numpy-discussion] Simple financial functions for NumPy

2008-04-04 Thread Anne Archibald
On 04/04/2008, Alan G Isaac <[EMAIL PROTECTED]> wrote: > On Fri, 4 Apr 2008, Gael Varoquaux apparently wrote: > > I really thing numpy should be as thin as possible, so > > that you can really say that it is only an array > > manipulation package. This will also make it easier to > > sell as a

Re: [Numpy-discussion] Ticket #605 Incorrect behavior of numpy.histogram

2008-04-05 Thread Anne Archibald
On 05/04/2008, Bruce Southey <[EMAIL PROTECTED]> wrote: > 1) Should the first bin contain all values less than or equal to the > value of the first limit and the last bin contain all values greater > than the value of the last limit? > This produced the counts as: array([3, 3, 9]) (I termed th

Re: [Numpy-discussion] Final push for NumPy 1.0.5 (I need your help!)

2008-04-05 Thread Anne Archibald
On 05/04/2008, James Philbin <[EMAIL PROTECTED]> wrote: > I've posted patches for: > > #630: If float('123.45') works, so should numpy.float32('123.45') > #581: random.set_state does not reset state of random.standard_normal Patches for #601, #622, #692, #696, #717 now in trac; I'd like to do so

Re: [Numpy-discussion] Final push for NumPy 1.0.5 (I need your help!)

2008-04-05 Thread Anne Archibald
On 05/04/2008, Charles R Harris <[EMAIL PROTECTED]> wrote: > On Sat, Apr 5, 2008 at 4:10 PM, Anne Archibald <[EMAIL PROTECTED]> > wrote: > > More generally, my local working copy is now rater divergent from the > > upstream. What's the recommended way to deal

Re: [Numpy-discussion] matrix power (was: matrix multiply)

2008-04-05 Thread Anne Archibald
On 05/04/2008, Stéfan van der Walt <[EMAIL PROTECTED]> wrote: > Some discussion recently took place around raising a square matrices > to integer powers. See ticket #601: > > http://scipy.org/scipy/numpy/ticket/601 > > Anne Archibald wrote a patch which factored

Re: [Numpy-discussion] matrix multiply

2008-04-06 Thread Anne Archibald
On 06/04/2008, Alan G Isaac <[EMAIL PROTECTED]> wrote: > Just checking: > it's important to me that this won't change > the behavior of boolean matrices, but I don't > see a test for this. E.g., :: > > >>> import numpy as N > >>> A = N.mat('1 0;1 1',dtype='bool') > >>> A**2 > m

Re: [Numpy-discussion] matrix multiply

2008-04-06 Thread Anne Archibald
> > and for negative powers some sort of floating-point > > inverse. > > That deserves discussion. > Not all "invertible" boolean matrices have an inverse in the algebra. > Just the orthogonal ones do. > > I guess I would special case inverses for Boolean matrices. > Just test if the matrix B

[Numpy-discussion] ma's stdu and varu

2008-04-06 Thread Anne Archibald
Hi, I was just going through tidying up the documentation for all the many functions in numpy that compute standard deviations or variances (the functions, the methods, the methods on matrices, the methods on maskedarrays, all needed their docstrings updated in approximately the same way). I notic

[Numpy-discussion] boolean indexing of rank-0 arrays and scalars - ticket #721

2008-04-10 Thread Anne Archibald
Hi, Ticket #721 is titled "0-dimensional boolean arrays should work as masks for array scalars". It is not quite clear to me what the right behaviour is. We are generally trying to make zero-dimensional arrays behave the same as array scalars, but I'm not sure how that should work in this case:

Re: [Numpy-discussion] Infinity definitions

2008-04-10 Thread Anne Archibald
On 10/04/2008, Travis E. Oliphant <[EMAIL PROTECTED]> wrote: > Bruce Southey wrote: > > Hi, > > Since we are discussing namespace and standardization, I am curious in > > why there are multiple definitions for defining infinity in numpy when > > perhaps there should be two (one for positive inf

Re: [Numpy-discussion] float32 is not a float ?

2008-04-11 Thread Anne Archibald
On 10/04/2008, Charles R Harris <[EMAIL PROTECTED]> wrote: > I think you want the isreal function, but it will also return true for > complex with 0 imaginary part. Hmm... the various iswhatever functions seem > to be lacking in coverage. Maybe we should fix that. icomplexobj is designed to solve

Re: [Numpy-discussion] Release of NumPy

2008-04-15 Thread Anne Archibald
On 15/04/2008, Jon Wright <[EMAIL PROTECTED]> wrote: > > On 15/04/2008, Alan G Isaac <[EMAIL PROTECTED]> wrote: > > ... > > > The proposal on the table is to remove an unneeded (and > > unwanted) deviation of the matrix API from the ndarray API. > > ... > > How about writing up the changes need

Re: [Numpy-discussion] Release of NumPy

2008-04-16 Thread Anne Archibald
On 16/04/2008, Stéfan van der Walt <[EMAIL PROTECTED]> wrote: > On 16/04/2008, Alan G Isaac <[EMAIL PROTECTED]> wrote: > > > The whole issue occurs because a Matrix is not a proper > > > container. > > > > > > Right. And *that* is the case because of the attempt to > > treat matrices as c

Re: [Numpy-discussion] Matrix vs ndarray

2008-04-17 Thread Anne Archibald
On 17/04/2008, Santanu Chatterjee <[EMAIL PROTECTED]> wrote: > Hi Numpy users, > I used MATLAB to do numerical calculations for a long time. Recently I > am digging into python and numpy. I am wondering about the following > question : > > 1) What is the difference between ndarray and matrix in

Re: [Numpy-discussion] broken numpy.core.tests.test_multiarray.TestScalarIndexing.SetUp

2008-04-17 Thread Anne Archibald
On 17/04/2008, Robert Kern <[EMAIL PROTECTED]> wrote: > On Thu, Apr 17, 2008 at 1:21 PM, Eric Firing <[EMAIL PROTECTED]> wrote: > > Arg! Cancel that! I didn't look carefully enough. How embarrassing! > > Sorry for the noise. > > > Don't apologize. That is very odd code. Stefan, is there a rea

Re: [Numpy-discussion] broken numpy.core.tests.test_multiarray.TestScalarIndexing.SetUp

2008-04-17 Thread Anne Archibald
On 17/04/2008, Stéfan van der Walt <[EMAIL PROTECTED]> wrote: > On 17/04/2008, Robert Kern <[EMAIL PROTECTED]> wrote: > > > On Thu, Apr 17, 2008 at 1:21 PM, Eric Firing <[EMAIL PROTECTED]> wrote: > > > Arg! Cancel that! I didn't look carefully enough. How embarrassing! > > > Sorry for the n

Re: [Numpy-discussion] Truth value of an array

2008-04-18 Thread Anne Archibald
On 18/04/2008, Olivier <[EMAIL PROTECTED]> wrote: > Let's restrict the discussion the case to boolean arrays (dtype bool), > since all the comparisons (A==B, A!=B, A arrays). > > So I have an array filled with booleans. Is there a reason not to map > "bool(A)" to "A.all()" but instead raise an

Re: [Numpy-discussion] Truth value of an array

2008-04-18 Thread Anne Archibald
On 18/04/2008, Robert Kern <[EMAIL PROTECTED]> wrote: > On Fri, Apr 18, 2008 at 3:33 PM, Joe Harrington <[EMAIL PROTECTED]> wrote: > > For that matter, is there a reason logical operations don't work on > > arrays other than booleans? What about: > > The keywords "and", "or", and "not" only wor

Re: [Numpy-discussion] numpy release

2008-04-23 Thread Anne Archibald
On 23/04/2008, Alan Isaac <[EMAIL PROTECTED]> wrote: > On Wed, 23 Apr 2008, Sebastian Haase wrote: > > What used to be referred to a the 1.1 version, that can > > break more stuff, to allow for a cleaner design, will now > > be 1.2 > > So ... fixing x[0][0] for matrices should wait > until 1.2.

Re: [Numpy-discussion] "aligned" matrix / ctypes

2008-04-23 Thread Anne Archibald
On 23/04/2008, Zachary Pincus <[EMAIL PROTECTED]> wrote: > Hi, > > Thanks a ton for the advice, Robert! Taking an array slice (instead of > trying to set up the strides, etc. myself) is a slick way of getting > this result indeed. It's worth mentioning that there was some discussion of adding a

Re: [Numpy-discussion] Using normal()

2008-04-24 Thread Anne Archibald
On 24/04/2008, Keith Goodman <[EMAIL PROTECTED]> wrote: > On Thu, Apr 24, 2008 at 10:01 AM, Rich Shepard <[EMAIL PROTECTED]> wrote: > >In the application's function I now have: > > > >from numpy import * > > > >x = nx.arange(0, 100, 0.1) > >y = nx.normal(center,width) # passe

Re: [Numpy-discussion] "aligned" matrix / ctypes

2008-04-24 Thread Anne Archibald
On 24/04/2008, Zachary Pincus <[EMAIL PROTECTED]> wrote: > In the mean time, is there any way to (from within python) construct > an array from another array by specifying the dtype and strides? That > is, some other way to do the view/slice business directly? There's the ndarray constructor,

Re: [Numpy-discussion] numpy release

2008-04-25 Thread Anne Archibald
On 25/04/2008, Stéfan van der Walt <[EMAIL PROTECTED]> wrote: > 2008/4/25 Alan G Isaac <[EMAIL PROTECTED]>: > > > I must have misunderstood: > > I thought the agreement was to > > provisionally return a 1d array for x[0], > > while we hashed through the other proposals. > > The agreement was

Re: [Numpy-discussion] Generating Bell Curves (was: Using normal() )

2008-04-25 Thread Anne Archibald
On 24/04/2008, Rich Shepard <[EMAIL PROTECTED]> wrote: >Thanks to several of you I produced test code using the normal density > function, and it does not do what we need. Neither does the Gaussian > function using fwhm that I've tried. The latter comes closer, but the ends > do not reach y=

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-25 Thread Anne Archibald
On 25/04/2008, Charles R Harris <[EMAIL PROTECTED]> wrote: > > > On Fri, Apr 25, 2008 at 12:02 PM, Alan G Isaac <[EMAIL PROTECTED]> wrote: > > I think we have discovered that there is a basic conflict > > between two behaviors: > > > >x[0] == x[0,:] > >vs. > > > >x[0][0] ==

[Numpy-discussion] Movement of ma breaks matplotlib

2008-04-25 Thread Anne Archibald
Hi, In the upcoming release of numpy. numpy.core.ma ceases to exist. One must use numpy.ma (for the new interface) or numpy.oldnumeric.ma (for the old interface). This has the unfortunate effect of breaking matplotlib(which does "from numpy.core.ma import *") - I cannot even "import pylab" with a

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Anne Archibald
On 29/04/2008, Travis E. Oliphant <[EMAIL PROTECTED]> wrote: > I'm quite persuaded now that a[i] should return a 1-d object for > arrays.In addition to the places Chuck identified, there are at > least 2 other places where special code was written to work-around the > expectation that ite

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Anne Archibald
On 29/04/2008, Gael Varoquaux <[EMAIL PROTECTED]> wrote: > On Tue, Apr 29, 2008 at 11:03:58PM +0200, Anne Archibald wrote: > > I am puzzled by this. What is the rationale for x[i,:] not being a 1-d > > object? > > It breaks A*B[i, :] where A and B are matrices

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Anne Archibald
On 29/04/2008, Keith Goodman <[EMAIL PROTECTED]> wrote: > On Tue, Apr 29, 2008 at 11:21 AM, Alan G Isaac <[EMAIL PROTECTED]> wrote: > > On Tue, 29 Apr 2008, Keith Goodman apparently wrote: > > > I often use x[i,:] and x[:,i] where x is a matrix and i is > > > a scalar. I hope this continues to

Re: [Numpy-discussion] accuracy issues with numpy arrays?

2008-04-29 Thread Anne Archibald
On 30/04/2008, eli bressert <[EMAIL PROTECTED]> wrote: > I'm writing a quick script to import a fits (astronomy) image that has > very low values for each pixel. Mostly on the order of 10^-9. I have > written a python script that attempts to take low values and put them > in integer format. I b

[Numpy-discussion] dot/tensordot limitations

2008-04-29 Thread Anne Archibald
Timothy Hochberg has proposed a generalization of the matrix mechanism to support manipulating arrays of linear algebra objects. For example, one might have an array of matrices one wants to apply to an array of vectors, to yield an array of vectors: In [88]: A = np.repeat(np.eye(3)[np.newaxis,...

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-29 Thread Anne Archibald
On 30/04/2008, Keith Goodman <[EMAIL PROTECTED]> wrote: > On Tue, Apr 29, 2008 at 2:18 PM, Anne Archibald > <[EMAIL PROTECTED]> wrote: > > It is actually pretty unreasonable to hope that > > > > A[0] > > > > and > > > > A[[1

Re: [Numpy-discussion] should outer take an output argument?

2008-04-30 Thread Anne Archibald
2008/4/29 Alan G Isaac <[EMAIL PROTECTED]>: > As I was looking at Bill's conjugate gradient posting, > I found myself wondering if there would be a payoff > to an output argument for ``numpy.outer``. (It is fairly > natural to repeatedly recreate the outer product of > the adjusted residuals,

Re: [Numpy-discussion] very simple iteration question.

2008-04-30 Thread Anne Archibald
2008/4/30 a g <[EMAIL PROTECTED]>: > Hi. This is a very basic question, sorry if it's irritating. If i > didn't find the answer written already somewhere on the site, please > point me to it. That'd be great. > > OK: how do i iterate over an axis other than 0? > > I have a 3D array of data[y

Re: [Numpy-discussion] very simple iteration question.

2008-04-30 Thread Anne Archibald
2008/4/30 Christopher Barker <[EMAIL PROTECTED]>: > a g wrote: > > OK: how do i iterate over an axis other than 0? > > This ties in nicely with some of the discussion about interating over > matrices. It ahs been suggested that it would be nice to have iterators > for matrices, so you could do:

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-30 Thread Anne Archibald
2008/4/30 Charles R Harris <[EMAIL PROTECTED]>: > Some operations on stacks of small matrices are easy to get, for instance, > +,-,*,/, and matrix multiply. The last is the interesting one. If A and B > are stacks of matrices with the same number of dimensions with the matrices > stored in the las

Re: [Numpy-discussion] recarray fun

2008-04-30 Thread Anne Archibald
2008/5/1 Travis E. Oliphant <[EMAIL PROTECTED]>: > Stéfan van der Walt wrote: > > 2008/4/30 Christopher Barker <[EMAIL PROTECTED]>: > > > >> Stéfan van der Walt wrote: > >> > That's the way, or just rgba_image.view(numpy.int32). > >> > >> ah -- interestingly, I tried: > >> > >> rgba_imag

Re: [Numpy-discussion] Broadcasting question

2008-05-01 Thread Anne Archibald
2008/5/2 Chris.Barker <[EMAIL PROTECTED]>: > Hi all, > > I have a n X m X 3 array, and I a n X M array. I want to assign the > values in the n X m to all three of the slices in the bigger array: > > A1 = np.zeros((5,4,3)) > A2 = np.ones((5,4)) > A1[:,:,0] = A2 > A1[:,:,1] = A2 > A1[:,:,2] =

Re: [Numpy-discussion] Combining Sigmoid Curves

2008-05-02 Thread Anne Archibald
2008/5/2 Rich Shepard <[EMAIL PROTECTED]>: >What will work (I call it a pi curve) is a matched pair of sigmoid curves, > the ascending curve on the left and the descending curve on the right. Using > the Boltzmann function for these I can calculate and plot each individually, > but I'm havi

Re: [Numpy-discussion] Combining Sigmoid Curves

2008-05-02 Thread Anne Archibald
2008/5/2 Rich Shepard <[EMAIL PROTECTED]>: > On Fri, 2 May 2008, Anne Archibald wrote: > > > It's better not to work point-by-point, appending things, when working > > with numpy. Ideally you could find a formula which just produced the right > > curve, a

Re: [Numpy-discussion] Deprecating PyDataMem_RENEW ?

2008-05-05 Thread Anne Archibald
2008/5/5 Robert Kern <[EMAIL PROTECTED]>: > On Mon, May 5, 2008 at 7:44 AM, David Cournapeau > <[EMAIL PROTECTED]> wrote: > > > In numpy, we can always replace realloc by malloc/free, because we know > > the size of the old block: would deprecating PyMemData_RENEW and > > replacing them by Py

Re: [Numpy-discussion] Deprecating PyDataMem_RENEW ?

2008-05-06 Thread Anne Archibald
2008/5/5 David Cournapeau <[EMAIL PROTECTED]>: > Basically, what I have in mind is, in a first step (for numpy 1.2): > - define functions to allocate on a given alignement > - make PyMemData_NEW 16 byte aligned by default (to be compatible > with SSE and co). > > The problem was, and st

Re: [Numpy-discussion] Tests for empty arrays

2008-05-06 Thread Anne Archibald
2008/5/6 Andy Cheesman <[EMAIL PROTECTED]>: > I was wondering if anyone could shed some light on how to distinguish an > empty array of a given shape and an zeros array of the same dimensions. An "empty" array, that is, an array returned by the function empty(), just means an uninitialized arra

Re: [Numpy-discussion] Status Report for NumPy 1.1.0

2008-05-06 Thread Anne Archibald
2008/5/6 Charles R Harris <[EMAIL PROTECTED]>: > > On Tue, May 6, 2008 at 6:40 AM, Alan G Isaac <[EMAIL PROTECTED]> wrote: > > > > On Tue, 6 May 2008, Jarrod Millman apparently wrote: > > > open tickets that I would like everyone to take a brief > > > look at: > > > http://projects.scipy.org/scipy/

Re: [Numpy-discussion] lexsort

2008-05-06 Thread Anne Archibald
2008/5/6 Eleanor <[EMAIL PROTECTED]>: > >>> a = numpy.array([[1,2,6], [2,2,8], [2,1,7],[1,1,5]]) > >>> a > array([[1, 2, 6], >[2, 2, 8], >[2, 1, 7], >[1, 1, 5]]) > >>> indices = numpy.lexsort(a.T) > >>> a.T.take(indices,axis=-1).T > array([[1, 1, 5], >[1, 2, 6],

Re: [Numpy-discussion] Status Report for NumPy 1.1.0

2008-05-07 Thread Anne Archibald
2008/5/7 Jarrod Millman <[EMAIL PROTECTED]>: > I have just created the 1.1.x branch: > http://projects.scipy.org/scipy/numpy/changeset/5134 > In about 24 hours I will tag the 1.1.0 release from the branch. At > this point only critical bug fixes should be applied to the branch. > The trunk is

Re: [Numpy-discussion] bug in oldnumeric.ma

2008-05-07 Thread Anne Archibald
2008/5/7 Eric Firing <[EMAIL PROTECTED]>: > Charles Doutriaux wrote: > > The following code works with numpy.ma but not numpy.oldnumeric.ma, > > No, this is a bug in numpy.ma also; power is broken: While it's tempting to just call power() and mask out any NaNs that result, that's going to be a p

Re: [Numpy-discussion] bug in oldnumeric.ma

2008-05-07 Thread Anne Archibald
2008/5/7 Pierre GM <[EMAIL PROTECTED]>: > All, > Yes, there is a problem with ma.power: masking negative data should be > restricted to the case of an exponent between -1. and 1. only, don't you > think ? No, there's a problem with any fractional exponent (with even denominator): x**(3/2) == (x

Re: [Numpy-discussion] bug in oldnumeric.ma

2008-05-07 Thread Anne Archibald
2008/5/7 Jonathan Wright <[EMAIL PROTECTED]>: > Is there a rule against squaring away the negatives? > > def not_your_normal_pow( x, y ): return exp( log( power( x, 2) ) * y / 2 ) > > Which still needs some work for x==0. Well, it means (-1.)**(3.) becomes 1., which is probably not what the us

Re: [Numpy-discussion] bug in oldnumeric.ma

2008-05-07 Thread Anne Archibald
2008/5/7 Pierre GM <[EMAIL PROTECTED]>: > On Wednesday 07 May 2008 20:38:22 Anne Archibald wrote: > > 2008/5/7 Pierre GM <[EMAIL PROTECTED]>: > > > All, > > > Yes, there is a problem with ma.power: masking negative data should be > > > restric

Re: [Numpy-discussion] Status Report for NumPy 1.1.0

2008-05-07 Thread Anne Archibald
2008/5/7 Charles R Harris <[EMAIL PROTECTED]>: > On Wed, May 7, 2008 at 11:44 AM, Anne Archibald <[EMAIL PROTECTED]> > wrote: > > 2008/5/7 Jarrod Millman <[EMAIL PROTECTED]>: > > > > > I have just created the 1.1.x branch: > > > http://p

Re: [Numpy-discussion] Status Report for NumPy 1.1.0

2008-05-07 Thread Anne Archibald
2008/5/7 Anne Archibald <[EMAIL PROTECTED]>: > 2008/5/7 Charles R Harris <[EMAIL PROTECTED]>: > > > On Wed, May 7, 2008 at 11:44 AM, Anne Archibald <[EMAIL PROTECTED]> > > wrote: > > > 2008/5/7 Jarrod Millman <[EMAIL PROTECTED]>: &

Re: [Numpy-discussion] Status Report for NumPy 1.1.0

2008-05-07 Thread Anne Archibald
2008/5/7 Charles R Harris <[EMAIL PROTECTED]>: > > On Wed, May 7, 2008 at 5:31 PM, Anne Archibald <[EMAIL PROTECTED]> > wrote: > > Ah. Good point. I did find a bug - x[:,0] doesn't do what you'd > > expect. Best not release without either backing out my

Re: [Numpy-discussion] Status Report for NumPy 1.1.0

2008-05-07 Thread Anne Archibald
2008/5/7 Charles R Harris <[EMAIL PROTECTED]>: > > Heh, I just added some tests to 1.2 before closing ticket #707. They should > probably be merged with yours. Seems a shame: Ran 1000 tests in 5.329s Such a nice round number! Anne ___ Numpy-discussion

Re: [Numpy-discussion] Log Arrays

2008-05-08 Thread Anne Archibald
2008/5/8 David Cournapeau <[EMAIL PROTECTED]>: > On Thu, May 8, 2008 at 10:20 PM, Charles R Harris > <[EMAIL PROTECTED]> wrote: > > > > > > Floating point numbers are essentially logs to base 2, i.e., integer > > exponent and mantissa between 1 and 2. What does using the log buy you? > > Prec

Re: [Numpy-discussion] Log Arrays

2008-05-08 Thread Anne Archibald
2008/5/8 Charles R Harris <[EMAIL PROTECTED]>: > > What realistic probability is in the range exp(-1000) ? Well, I ran into it while doing a maximum-likelihood fit - my early guesses had exceedingly low probabilities, but I needed to know which way the probabilities were increasing. Anne

Re: [Numpy-discussion] Log Arrays

2008-05-08 Thread Anne Archibald
2008/5/8 Charles R Harris <[EMAIL PROTECTED]>: > > On Thu, May 8, 2008 at 10:56 AM, Robert Kern <[EMAIL PROTECTED]> wrote: > > > > When you're running an optimizer over a PDF, you will be stuck in the > > region of exp(-1000) for a substantial amount of time before you get > > to the peak. If you d

Re: [Numpy-discussion] Log Arrays

2008-05-08 Thread Anne Archibald
2008/5/8 Charles R Harris <[EMAIL PROTECTED]>: > > David, what you are using is a log(log(x)) representation internally. IEEE > is *not* linear, it is logarithmic. As Robert Kern says, yes, this is exactly what the OP and all the rest of us want. But it's a strange thing to say that IEEE is logar

Re: [Numpy-discussion] Log Arrays

2008-05-08 Thread Anne Archibald
2008/5/8 T J <[EMAIL PROTECTED]>: > On 5/8/08, Anne Archibald <[EMAIL PROTECTED]> wrote: > > Is "logarray" really the way to handle it, though? it seems like you > > could probably get away with providing a logsum ufunc that did the > > right thing.

[Numpy-discussion] Why are ufunc docstrings useless?

2008-05-08 Thread Anne Archibald
Hi, I frequently use functions like np.add.reduce and np.add.outer, but their docstrings are totally uninformative. Would it be possible to provide proper docstrings for these ufunc methods? They need not be specific to np.add; just an explanation of what arguments to give (for example) reduce() (

Re: [Numpy-discussion] Why are ufunc docstrings useless?

2008-05-08 Thread Anne Archibald
2008/5/8 Robert Kern <[EMAIL PROTECTED]>: > On Thu, May 8, 2008 at 5:28 PM, Anne Archibald > <[EMAIL PROTECTED]> wrote: >> Hi, >> >> I frequently use functions like np.add.reduce and np.add.outer, but >> their docstrings are totally uninformative.

Re: [Numpy-discussion] Why are ufunc docstrings useless?

2008-05-08 Thread Anne Archibald
2008/5/8 Robert Kern <[EMAIL PROTECTED]>: > On Thu, May 8, 2008 at 9:52 PM, Anne Archibald > <[EMAIL PROTECTED]> wrote: > >> Thanks! Done add, reduce, outer, and reduceat. What about __call__? > > If anyone knows enough to explicitly request a docstring from >

Re: [Numpy-discussion] Why are ufunc docstrings useless?

2008-05-08 Thread Anne Archibald
2008/5/8 Robert Kern <[EMAIL PROTECTED]>: > On Thu, May 8, 2008 at 10:39 PM, Anne Archibald > <[EMAIL PROTECTED]> wrote: >> 2008/5/8 Robert Kern <[EMAIL PROTECTED]>: >>> >>> If anyone knows enough to explicitly request a docstring from >>

Re: [Numpy-discussion] Uncomfortable with matrix change

2008-05-09 Thread Anne Archibald
2008/5/9 Travis Oliphant <[EMAIL PROTECTED]>: > After Nathan Bell's recent complaints, I'm a bit more uncomfortable with > the matrix change to scalar indexing. It does and will break code in > possibly hard-to-track down ways. Also, Nathan has been a *huge* > contributor to the Sparse matrix

Re: [Numpy-discussion] bug in oldnumeric.ma

2008-05-09 Thread Anne Archibald
2008/5/9 Eric Firing <[EMAIL PROTECTED]>: > Stefan, (and Jarrod and Pierre) > > (Context for anyone new to the thread: the subject is slightly > misleading, because the bug is/was present in both oldnumeric.ma and > numpy.ma; the discussion of fix pertains to the latter only.) > > Regarding you

Re: [Numpy-discussion] Power domain (was Re: bug in oldnumeric.ma)

2008-05-09 Thread Anne Archibald
2008/5/9 Eric Firing <[EMAIL PROTECTED]>: > It seems like some strategic re-thinking may be needed in the long run, > if not immediately. There is a wide range of combinations of arguments > that will trigger invalid results, whether Inf or NaN. The only way to > trap and mask all of these is to

Re: [Numpy-discussion] Uncomfortable with matrix change

2008-05-10 Thread Anne Archibald
2008/5/10 Jarrod Millman <[EMAIL PROTECTED]>: > On Sat, May 10, 2008 at 8:14 AM, Keith Goodman <[EMAIL PROTECTED]> wrote: >>> If these are backed out, will some kind of deprecation >>> warning be added for scalar indexing, as Travis suggested? >>> Robert's request seems in accord with this. >> >> S

Re: [Numpy-discussion] Uncomfortable with matrix change

2008-05-10 Thread Anne Archibald
2008/5/10 Nathan Bell <[EMAIL PROTECTED]>: > On Sat, May 10, 2008 at 3:05 PM, Anne Archibald > <[EMAIL PROTECTED]> wrote: >> >> I don't expect my opinion to prevail, but the point is that we do not >> even have enough consensus to agree on a recommendation

Re: [Numpy-discussion] Uncomfortable with matrix change

2008-05-10 Thread Anne Archibald
2008/5/10 Timothy Hochberg <[EMAIL PROTECTED]>: > On Sat, May 10, 2008 at 1:37 PM, Anne Archibald <[EMAIL PROTECTED]> > wrote: >> >> 2008/5/10 Nathan Bell <[EMAIL PROTECTED]>: >> > On Sat, May 10, 2008 at 3:05 PM, Anne Archibald >> > <[EMAIL

<    1   2   3   4   5   >