Re: [Numpy-discussion] numpy 1.9b1 bug in pad function?

2014-06-14 Thread Stefan van der Walt
On 2014-06-14 14:40:29, Nadav Horesh nad...@visionsense.com wrote: This is most likely a documentation error since: In [7]: np.pad(a) --- TypeError Traceback (most recent call last)

Re: [Numpy-discussion] numpy 1.9b1 bug in pad function?

2014-06-14 Thread Stefan van der Walt
On 2014-06-14 14:40:29, Nadav Horesh nad...@visionsense.com wrote: TypeError: pad() missing 1 required positional argument: 'pad_width' I've added a PR here for further discussion: https://github.com/numpy/numpy/pull/4808 Stéfan ___ NumPy-Discussion

Re: [Numpy-discussion] slow numpy.clip ?

2006-12-18 Thread Stefan van der Walt
Hi David The benchmark below isn't quite correct. In clip2_bench the data is effectively only clipped once. I attach a slightly modified version, for which the benchmark results look like this: 4 function calls in 4.631 CPU seconds Ordered by: cumulative time ncalls tottime

Re: [Numpy-discussion] slow numpy.clip ?

2006-12-18 Thread Stefan van der Walt
On Mon, Dec 18, 2006 at 05:45:09PM +0900, David Cournapeau wrote: Yes, I of course mistyped the and the copy. But the function is still moderately faster on my workstation: ncalls tottime percall cumtime percall filename:lineno(function) 10.0030.0033.9443.944

Re: [Numpy-discussion] Unexpected output using numpy.ndarray and __radd__

2006-12-18 Thread Stefan van der Walt
Hi Mark On Mon, Dec 18, 2006 at 08:30:20AM +0100, Mark Hoffmann wrote: The following issue has puzzled me for a while. I want to add a numpy.ndarray and an instance of my own class. I define this operation by implementing the methods __add__ and __radd__. My programme (including output) looks

Re: [Numpy-discussion] subclassing float64 (and friends)

2007-01-03 Thread Stefan van der Walt
On Wed, Jan 03, 2007 at 04:29:10AM -0600, eric jones wrote: I am playing around with sub-classing the new-fangled float64 objects and friends. I really like the new ndarray subclassing features (__array_finalize__, etc.), and was exploring whether or not the scalars worked the same way.

Re: [Numpy-discussion] discussion about array.resize() -- compare to numarray

2007-01-08 Thread Stefan van der Walt
On Fri, Jan 05, 2007 at 01:57:50PM -0800, Russell E Owen wrote: I also checked the numpy 1.0.1 help and I confess I don't understand at all what it claims to do if the new size is larger. It first says it repeats a and then it says it zero-fills the output. help(numpy.resize) Help on

Re: [Numpy-discussion] segfault in numpy.float64(z) for complex z

2007-01-08 Thread Stefan van der Walt
On Mon, Jan 08, 2007 at 08:11:03AM -0700, Travis Oliphant wrote: Tim Leslie wrote: Hi All, While debugging a scipy crash I came across the problem outlined in http://projects.scipy.org/scipy/numpy/ticket/412 Could someone shed some light on why this is happening, I got a bit lost in

Re: [Numpy-discussion] discussion about array.resize() -- compare to numarray

2007-01-08 Thread Stefan van der Walt
On Mon, Jan 08, 2007 at 12:24:01PM -0800, Sebastian Haase wrote: On 1/8/07, Robert Kern [EMAIL PROTECTED] wrote: Sebastian Haase wrote: I would suggest treating this as a real bug! Then it could be fixed immediately. Deliberate design decisions don't turn into bugs just because you

Re: [Numpy-discussion] segfault in numpy.float64(z) for complex z

2007-01-08 Thread Stefan van der Walt
On Tue, Jan 09, 2007 at 10:38:06AM +1100, Tim Leslie wrote: On 1/9/07, Stefan van der Walt [EMAIL PROTECTED] wrote: On Mon, Jan 08, 2007 at 08:11:03AM -0700, Travis Oliphant wrote: Tim Leslie wrote: Hi All, While debugging a scipy crash I came across the problem outlined

[Numpy-discussion] defmatrix.sum

2007-01-08 Thread Stefan van der Walt
Hi all, I noticed that Tim Leslie picked up on the out=None in defmatrix.sum: def sum(self, axis=None, dtype=None, out=None): Sum the matrix over the given axis. If the axis is None, sum over all dimensions. This preserves the orientation of the result as a row or

Re: [Numpy-discussion] No test file found

2007-01-11 Thread Stefan van der Walt
On Thu, Jan 11, 2007 at 03:18:19PM -0800, Keith Goodman wrote: I see a lot of 'No test file found' warnings when running numpy.test(). What does that mean? It means your verbosity is set too high. You'll find that N.test(0,0) complains much less (although, realistically, you'd probably want to

Re: [Numpy-discussion] random permutation

2007-01-13 Thread Stefan van der Walt
On Sat, Jan 13, 2007 at 10:01:59AM -0800, Keith Goodman wrote: On 1/11/07, Robert Kern [EMAIL PROTECTED] wrote: Keith Goodman wrote: Why is the first element of the permutation always the same? Am I using random.permutation in the right way? M.__version__ '1.0rc1' This has

Re: [Numpy-discussion] ANN: MaskedArray as a subclass of ndarray -?followup

2007-01-19 Thread Stefan van der Walt
On Thu, Jan 18, 2007 at 06:18:22PM +, Matt Knox wrote: For 1.1 I would really like to move most of the often-used sub-classes of the ndarray to the C-level and merge in functionality from CVXOPT. Moving the implementation to the C-level would be awesome. In particular, __getitem__ and

Re: [Numpy-discussion] ANN: MaskedArray as a subclass of ndarray - followup

2007-01-19 Thread Stefan van der Walt
On Fri, Jan 19, 2007 at 10:56:16AM +0100, Sven Schreiber wrote: Matt Knox schrieb: I am definitely in favor of the new maskedarray implementation. I've been working with Pierre on a time series module which is a subclass of the new masked array implementation, and having it as a

[Numpy-discussion] inconsistent behaviour of mean, average and median

2007-01-25 Thread Stefan van der Walt
Hi, I noticed the following behaviour for empty lists: In [4]: N.median([]) --- exceptions.IndexErrorTraceback (most recent call last) /home/stefan/ipython console

Re: [Numpy-discussion] average() or mean() errors

2007-01-26 Thread Stefan van der Walt
On Tue, Jan 23, 2007 at 08:29:47PM -0500, Daniel Smith wrote: When calling the average() or mean() functions on a small array (3 numbers), I am seeing significant numerical errors (on the order of 1% with data to 8 significant digits). The code I am using is essentially: A = zeros(3) A[i]

Re: [Numpy-discussion] Arrays of poly1d objects, is this a bug?

2007-01-26 Thread Stefan van der Walt
On Fri, Jan 26, 2007 at 12:25:27PM -0700, Fernando Perez wrote: Hi all, I'm puzzled by this behavior a colleague ran into: In [38]: p1=N.poly1d([1.]) In [39]: a=N.array([p1],dtype='O') In [40]: a Out[40]: array([], shape=(1, 0), dtype=object) In [42]: print a [] In [43]:

Re: [Numpy-discussion] python's random.random() faster than numpy.random.rand() ???

2007-01-27 Thread Stefan van der Walt
Hi Mark On Fri, Jan 26, 2007 at 10:17:58AM -0700, Mark P. Miller wrote: I've recently been working with numpy's random number generators and noticed that python's core random number generator is faster than numpy's for the uniform distribution. In other words, for a in range(100):

Re: [Numpy-discussion] Different results from repeated calculation

2007-01-27 Thread Stefan van der Walt
On Sat, Jan 27, 2007 at 03:11:58PM -0700, Charles R Harris wrote: Does anyone else see this happening? Yes, test1: 0 differences test2: 51 differences test3: 0 differences Oddly, the relative error is always the same: 98 z different 2.0494565872e-16 99 z different

Re: [Numpy-discussion] Different results from repeated calculation

2007-01-27 Thread Stefan van der Walt
On Sat, Jan 27, 2007 at 04:00:33PM -0700, Charles R Harris wrote: Hmmm, and your problem machine is running smp linux. As is mine; fedora uses smp even on single processor machines these days. I think we could use more data here comparing It runs fine on this Ubuntu/Edgy machine, though:

Re: [Numpy-discussion] Different results from repeated calculation

2007-01-27 Thread Stefan van der Walt
On Sat, Jan 27, 2007 at 03:11:58PM -0700, Charles R Harris wrote: So this looks like an error in the LSB of the floating number. Could be rounding, could be something not reset quite right. I'm thinking possibly hardware at this time, maybe compiler. Linux fedora 2.6.19-1.2895.fc6 #1 SMP Wed

[Numpy-discussion] pyrex c_numpy.pyx problem

2007-01-31 Thread Stefan van der Walt
Hi, Pyrex 0.9.5.1 doesn't like the following snippet out of c_numpyx.pyx: ctypedef extern class numpy.broadcast [object PyArrayMultiIterObject]: cdef int numiter cdef npy_intp size, index cdef int nd cdef npy_intp dimensions[NPY_MAXDIMS] cdef flatiter

Re: [Numpy-discussion] classmethods for ndarray

2007-02-02 Thread Stefan van der Walt
On Thu, Feb 01, 2007 at 05:51:22PM -0700, Travis Oliphant wrote: Christopher Barker wrote: Travis Oliphant wrote: I'm thinking that we should have several. For example all the fromXXX functions should probably be classmethods ndarray.frombuffer ndarray.fromfile would

Re: [Numpy-discussion] Please help with subclassing numpy.ndarray

2007-02-06 Thread Stefan van der Walt
On Tue, Feb 06, 2007 at 01:06:37PM +0100, Sturla Molden wrote: def __new__(cls,...) ... (H, edges) = numpy.histogramdd(..) cls.__defaultedges = edges def __array_finalize__(self, obj): if not hasattr(self, 'edges'): self.edges = self.__defaultedges

Re: [Numpy-discussion] force column vector

2007-02-07 Thread Stefan van der Walt
On Wed, Feb 07, 2007 at 10:35:14AM +, Christian wrote: Hi, when creating an ndarray from a list, how can I force the result to be 2d *and* a column vector? So in case I pass a nested list, there will be no modification of the shape and when I pass a simple list, it will be converted to

Re: [Numpy-discussion] getting indices for array positions

2007-02-07 Thread Stefan van der Walt
On Wed, Feb 07, 2007 at 02:00:52PM +0100, Christian Meesters wrote: This questions might seem stupid, but I didn't get a clever solution myself, or found one in the archives, the cookbook, etc. . If I overlooked something, please give a pointer. Well, if I have an 1D array like [ 0. ,

Re: [Numpy-discussion] fromstring, tostring slow?

2007-02-13 Thread Stefan van der Walt
On Tue, Feb 13, 2007 at 11:42:35AM -0800, Mark Janikas wrote: I am finding that directly packing numpy arrays into binary using the tostring and fromstring methods do not provide a speed improvement over writing the same arrays to ascii files. Obviously, the size of the resulting files is

Re: [Numpy-discussion] Docstring formatting

2007-02-13 Thread Stefan van der Walt
Hi Pierre On Tue, Feb 13, 2007 at 04:10:09PM -0500, Pierre GM wrote: Dear All, Did we come to some kind of agreement about the formatting of docstring ? In any case, where could I find the 'official' format that Travis recommended ? Travis checked numpy/doc/HOWTO_DOCUMENT.txt a couple of

Re: [Numpy-discussion] fromstring, tostring slow?

2007-02-13 Thread Stefan van der Walt
On Tue, Feb 13, 2007 at 03:44:37PM -0800, Mark Janikas wrote: I don't think I can do that because I have heterogeneous rows of data I.e. the columns in each row are different in length. Furthermore, when reading it back in, I want to read only bytes of the info at a time so I can save

Re: [Numpy-discussion] fromstring, tostring slow?

2007-02-13 Thread Stefan van der Walt
On Tue, Feb 13, 2007 at 04:02:10PM -0800, Mark Janikas wrote: Yes, but does the code have the same license as NumPy? As I work for a software company, where I help with the scripting interface, I must make sure everything I use is cited and has the appropriate license. Yes, Scipy and Numpy

Re: [Numpy-discussion] Greek Letters

2007-02-20 Thread Stefan van der Walt
On Tue, Feb 20, 2007 at 05:29:25PM -0800, Mark Janikas wrote: Oh. I am using CygWin, and the website I just went to: http://www.cygwin.com/faq/faq_3.html stated that: The short answer is that Cygwin is not Unicode-aware Not sure if this is going to apply to python in general, but I

Re: [Numpy-discussion] dumb question about creating a complex array

2007-02-22 Thread Stefan van der Walt
Hi Matthew On Thu, Feb 22, 2007 at 02:50:16PM -0800, Mathew Yeates wrote: given an array of floats, 2N columns and M rows, where the elements A[r,2*j] and A[r,2*j+1] form the real and imaginary parts of a complex number ... What is the simplest way to create a complex array? It's a

Re: [Numpy-discussion] dumb question about creating a complex array

2007-02-22 Thread Stefan van der Walt
On Thu, Feb 22, 2007 at 02:50:16PM -0800, Mathew Yeates wrote: given an array of floats, 2N columns and M rows, where the elements A[r,2*j] and A[r,2*j+1] form the real and imaginary parts of a complex number ... What is the simplest way to create a complex array? It's a fairly large

Re: [Numpy-discussion] nd_image.affine_transform edge effects

2007-03-14 Thread Stefan van der Walt
Hi James On Fri, Mar 09, 2007 at 08:44:34PM -0300, James Turner wrote: Last year I wrote a program that uses the affine_transform() function in numarray to resample and co-add datacubes with WCS offsets in 3D. This function makes it relatively easy to handle N-D offsets and rotations with a

Re: [Numpy-discussion] nd_image.affine_transform edge effects

2007-03-15 Thread Stefan van der Walt
Hi James On Thu, Mar 15, 2007 at 06:01:55PM -0400, James Turner wrote: Code snippets to illustrate the problem would be welcome. OK. I have had a go at producing a code snippet. I apologize that this is based on numarray rather than numpy, since I'm using STScI Python, but I think it should

Re: [Numpy-discussion] zoom FFT with numpy?

2007-03-16 Thread Stefan van der Walt
Here is another implementation of the Chirp-Z transform in Python, that handles complex numbers. Regards Stéfan On Thu, Mar 15, 2007 at 11:53:49AM +0200, Nadav Horesh wrote: A long time ago I translated a free code of chirp z transform (zoom fft) into python. Attached here the source and two

Re: [Numpy-discussion] Little module to get numpy examples

2007-03-21 Thread Stefan van der Walt
On Wed, Mar 21, 2007 at 02:59:06PM -0500, eric jones wrote: Just looked at this... Now that is just cool. I'd say it should be part of Numpy. Very useful! A file cache would be handy, and can be implemented using the checksum of the page from

Re: [Numpy-discussion] nd_image.affine_transform edge effects

2007-03-22 Thread Stefan van der Walt
On Thu, Mar 22, 2007 at 02:41:52PM -0400, Anne Archibald wrote: On 22/03/07, James Turner [EMAIL PROTECTED] wrote: So, its not really a bug, its a undesired feature... It is curable, though painful - you can pad the image out, given an estimate of the size of the window. Yes, this sucks.

Re: [Numpy-discussion] concatenating 1-D arrays to 2D

2007-03-22 Thread Stefan van der Walt
On Thu, Mar 22, 2007 at 08:13:22PM -0400, Brian Blais wrote: Hello, I'd like to concatenate a couple of 1D arrays to make it a 2D array, with two columns (one for each of the original 1D arrays). I thought this would work: In [47]:a=arange(0,10,1) In [48]:a Out[48]:array([0, 1, 2,

Re: [Numpy-discussion] nd_image.affine_transform edge effects

2007-03-22 Thread Stefan van der Walt
On Thu, Mar 22, 2007 at 04:33:53PM -0700, Travis Oliphant wrote: I would rather opt for changing the spline fitting algorithm than for padding with zeros. From what I understand, the splines used in ndimage have the implicit mirror-symmetric boundary condition which also allows them to

Re: [Numpy-discussion] concatenating 1-D arrays to 2D

2007-03-23 Thread Stefan van der Walt
On Fri, Mar 23, 2007 at 11:09:03AM -0400, Robert Pyle wrote: In [65]:concatenate((a.reshape(10,1),b.reshape(10,1)),axis=1) Out[65]: array([[ 0, -10], [ 1, -9], [ 2, -8], [ 3, -7], [ 4, -6], [ 5, -5], [ 6, -4],

Re: [Numpy-discussion] nd_image.affine_transform edge effects

2007-03-24 Thread Stefan van der Walt
On Sat, Mar 24, 2007 at 01:41:21AM -0400, James Turner wrote: That's hard to say. Just because it's mainly a continuous-tone image doesn't necessarily mean it is well sampled everywhere. This depends both on the subject and the camera optics. Unlike the data I usually work with, I think

Re: [Numpy-discussion] nd_image.affine_transform edge effects

2007-03-24 Thread Stefan van der Walt
On Sat, Mar 24, 2007 at 03:25:38PM -0700, Zachary Pincus wrote: If Lena is converted to floating-point before the rotation is applied, and then the intensity range is clipped to [0,255] and converted back to uint8 before saving, everything looks fine. Thanks, Zachary! I can confirm that.

Re: [Numpy-discussion] dtype confusion

2007-03-25 Thread Stefan van der Walt
On Sun, Mar 25, 2007 at 04:09:11AM -0700, Jan Strube wrote: There seems to be a fundamental lack of understanding on my behalf when it comes to dtypes and record arrays. Please consider the following snippet: import numpy as N newtype = N.dtype([('x', N.float64 ), ('y', N.float64), ('z',

Re: [Numpy-discussion] Fixed scalar coercion model in NumPy

2007-03-26 Thread Stefan van der Walt
On Mon, Mar 26, 2007 at 01:52:28PM -0700, Travis Oliphant wrote: I really do want to get 1.0.2 out the door soon. What still needs to be fixed before then? The code in ticket 469 still causes a memory error, so that might be worth fixing. Cheers Stéfan

[Numpy-discussion] two previously unresolved issues

2007-03-26 Thread Stefan van der Walt
: On 11/11/06, Stefan van der Walt [EMAIL PROTECTED] wrote: NaN (or inf) is a floating point number, so seeing a zero in integer representation seems correct: In [2]: int(N.nan) Out[2]: 0L Just to learn myself: Why int(N.nan) should be 0? Is it C behavior? In [1]: int32(0)/int32(0) Warning

Re: [Numpy-discussion] nd_image.affine_transform edge effects

2007-03-28 Thread Stefan van der Walt
Hi, I notice now that we've been having this discussion on the wrong list -- oops! We're nearly done, though. On Mon, Mar 26, 2007 at 04:16:51AM -0400, James Turner wrote: For what it's worth, I'd agree with both of you that the numeric overflow should be documented if not fixed. It sounds

Re: [Numpy-discussion] nd_image.affine_transform edge effects

2007-03-28 Thread Stefan van der Walt
On Wed, Mar 28, 2007 at 05:14:59PM +0200, Stefan van der Walt wrote: As for the values at the edges, I'm still working on it. OK, that was a one-line patch. Please test to see if there are any subtle conditions on the border that I may have missed. I know of one already, but I'd be glad if you

Re: [Numpy-discussion] matrix indexing question (final post)

2007-03-28 Thread Stefan van der Walt
On Wed, Mar 28, 2007 at 05:25:57PM -0500, Alan Isaac wrote: given the surprising passion of the attacks at the suggestion that perhaps iteration over a matrix might more consistently yield arrays, I presumed there must be *many* instances in which it was obviously desirable that such

Re: [Numpy-discussion] matrix indexing question (final post)

2007-03-28 Thread Stefan van der Walt
On Wed, Mar 28, 2007 at 07:05:00PM -0500, Alan Isaac wrote: On Wed, 28 Mar 2007, Stefan van der Walt wrote: Matrices strike me as a bit of an anomaly. I would expect an N-dimensional container to contain (N-1)-dimensional objects. Yes indeed. Doesn't seem to be the way the matrix

Re: [Numpy-discussion] 2D Arrays column operations

2007-03-29 Thread Stefan van der Walt
On Thu, Mar 29, 2007 at 07:43:03PM -, Simon Berube wrote: Hi, I am relatively new to Python/NumPy switching over from Matlab and while porting some of my matlab code for practice I ran into the following problem. Assume we have a 2D Matrix such that a = array([[1, 2, 3],

Re: [Numpy-discussion] test_multiarray.test_clip fails on Solaris 8 system

2007-04-01 Thread Stefan van der Walt
Hi Chris Would you please run the following commands and show their output? import sys print sys.byteorder import numpy as N print N.array([1,2,3],N.dtype(N.int16).newbyteorder('')).dtype.byteorder print N.array([1,2,3],N.dtype(N.int16).newbyteorder('')).dtype.byteorder print

Re: [Numpy-discussion] nd_image.affine_transform edge effects

2007-04-05 Thread Stefan van der Walt
Hi James On Wed, Apr 04, 2007 at 08:29:50PM -0400, James Turner wrote: It looks like the last output value is produced by reflecting the input and then interpolating, but presumably then the first value should be 3.9, for consistency, not 3.1? Does that make sense? Aargh. I think I

Re: [Numpy-discussion] newbie question - large dataset

2007-04-07 Thread Stefan van der Walt
On Sat, Apr 07, 2007 at 02:48:47PM -0400, Anne Archibald wrote: If none of those algorithmic improvements are possible, you can look at other possibilities for speeding things up (though the speedups will be modest). Parallelism is an obvious one - if you've got a multicore machine you may be

Re: [Numpy-discussion] detecting shared data

2007-04-11 Thread Stefan van der Walt
On Wed, Apr 11, 2007 at 06:12:16PM -0400, Matthew Koichi Grimes wrote: Is there any way to detect whether one array is a view into another array? I'd like something like: arr = N.arange(5) subarr = arr[1:3] sharesdata(arr, subarr) True Your best bet is probably

Re: [Numpy-discussion] detecting shared data

2007-04-12 Thread Stefan van der Walt
On Wed, Apr 11, 2007 at 11:06:13PM -0400, Anne Archibald wrote: On 11/04/07, Bill Baxter [EMAIL PROTECTED] wrote: Must be pretty recent. I'm using 1.0.2.dev3520 (enthought egg) and the function's not there. It is. I've never been quite happy with it, though; I realize it's not very

Re: [Numpy-discussion] detecting shared data

2007-04-12 Thread Stefan van der Walt
On Thu, Apr 12, 2007 at 11:29:31AM -0400, Anne Archibald wrote: Failures may be expressed using NumpyTestCase.failIf(self, expr, msg=None) That's not quite what I mean. There are situations, with the current code, that it gets the answer wrong (i.e., claims arrays may share memory when

Re: [Numpy-discussion] pickable ndarray subclass

2007-04-15 Thread Stefan van der Walt
Hi Christiaan On Sun, Apr 15, 2007 at 02:03:49PM +0900, Christian K wrote: could someone please provide example code for how to make a subclassed ndarray pickable? I don't quite understand the docs of ndarray.__reduce__. My subclassed ndarray has just one additional attribute. __reduce__ is

Re: [Numpy-discussion] ScipyTest Warning?

2007-04-24 Thread Stefan van der Walt
Hi Mark On Tue, Apr 24, 2007 at 07:28:35AM -, mark wrote: I have a piece of code that works fine for me, but a friend tries to run it and gets this warning. He claims to have updated his Python (2.4), Scipy and numpy. A Does anybody know what import triggers this Warning? I didn't think I

Re: [Numpy-discussion] numpy endian question

2007-04-27 Thread Stefan van der Walt
On Thu, Apr 26, 2007 at 05:22:42PM -0400, Christopher Hanley wrote: This should work as a consistent test for bigendian: - isBigEndian = (obj.dtype.str[0] == '') Is this test always safe, even on big endian machines? Couldn't the dtype.str[0] sometimes be '='? Regards Stéfan

Re: [Numpy-discussion] simpliest way to check: array x is float, not integer

2007-05-01 Thread Stefan van der Walt
On Tue, May 01, 2007 at 12:05:20PM -, Simon Berube wrote: Alternatively, as a hackjob type check you could also do an isinstance check on the first element of the array since, unlike lists, arrays have uniform elements all the way through. Or use N.issubdtype(x.dtype,int) and

Re: [Numpy-discussion] ctypes TypeError. What I am doing wrong?

2007-05-01 Thread Stefan van der Walt
On Wed, May 02, 2007 at 12:38:12AM +0200, Guillem Borrell i Nogueras wrote: lapack.argtypes=[c_int,c_int, ndpointer(dtype=float64, ndim=2, flags='FORTRAN'), c_int,c_int,

Re: [Numpy-discussion] Difference in the number of elements in a fromfile() between Windows and Linux

2007-05-04 Thread Stefan van der Walt
Hi Matthieu On Fri, May 04, 2007 at 09:16:34AM +0200, Matthieu Brucher wrote: I'm trying to test my code on several platforms, Windows and Linux, and I'm using some data files that where saved with a tofile(sep=' ') under Linux. Those files can be loaded without a problem under Linux, but

Re: [Numpy-discussion] Difference in the number of elements in a fromfile() between Windows and Linux

2007-05-04 Thread Stefan van der Walt
On Fri, May 04, 2007 at 09:44:02AM -0700, Christopher Barker wrote: Matthieu Brucher wrote: Example of the first line of my data file : 0.0 inf 13.9040914426 14.7406669444 inf 4.41783247603 inf inf 6.05071515635 inf inf inf 15.6925185021 inf inf inf inf inf inf inf I'm pretty sure

Re: [Numpy-discussion] howto make from flat array (1-dim) 2-dimensional?

2007-05-13 Thread Stefan van der Walt
On Sun, May 13, 2007 at 07:46:47AM -0400, Darren Dale wrote: On Sunday 13 May 2007 7:36:39 am dmitrey wrote: i.e. for example from flat array [1, 2, 3] obtain array([[ 1.], [ 2.], [ 3.]]) a=array([1,2,3]) a.shape=(len(a),1) Or just a.shape = (-1,1) Cheers Stéfan

Re: [Numpy-discussion] NumPy 1.0.3 release next week

2007-05-13 Thread Stefan van der Walt
On Sun, May 13, 2007 at 06:19:30PM +0300, dmitrey wrote: Is it possible somehow to speedup numpy 1.0.3 appearing in Linux update channels? (as for me I'm interested in Ubuntu/Kubuntu, currently there is v 1.0.1) I tried to compile numpy 1.0.2, but, as well as in Octave compiling, it

[Numpy-discussion] dtype hashes are not equal

2007-05-13 Thread Stefan van der Walt
Hi all, In the numpy.sctypes dictionary, there are two entries for uint32: In [2]: N.sctypes['uint'] Out[2]: [type 'numpy.uint8', type 'numpy.uint16', type 'numpy.uint32', type 'numpy.uint32', type 'numpy.uint64'] Comparing the dtypes of the two types gives the correct answer: In [3]: sc

Re: [Numpy-discussion] NumPy 1.0.3 release next week

2007-05-13 Thread Stefan van der Walt
Hi Dmitrey On Sun, May 13, 2007 at 08:21:15PM +0300, dmitrey wrote: Many people here are compiling numpy fine under Ubuntu. Do you have write permissions to the output directory? What is the compiler error given? Sorry, I meant compiling Python2.5 and Octave, not numpy Octave

Re: [Numpy-discussion] numpy array sharing between processes? (and ctypes)

2007-05-14 Thread Stefan van der Walt
On Mon, May 14, 2007 at 11:44:11AM -0700, Ray S wrote: While investigating ctypes and numpy for sharing, I saw that the example on http://www.scipy.org/Cookbook/Ctypes#head-7def99d882618b52956c6334e08e085e297cb0c6 does not quite work. However, with numpy.version.version=='1.0b1',

Re: [Numpy-discussion] Question about flags of fancy indexed array

2007-05-23 Thread Stefan van der Walt
On Wed, May 23, 2007 at 09:49:08AM -0400, Anne Archibald wrote: On 23/05/07, Albert Strasheim [EMAIL PROTECTED] wrote: Is it correct that the F_CONTIGUOUS flag is set in the case of the fancy indexed x? I'm running NumPy 1.0.3.dev3792 here. Numpy arrays are always stored in contiguous

Re: [Numpy-discussion] shelve and object arrays

2007-05-26 Thread Stefan van der Walt
Hi Mark On Fri, May 25, 2007 at 04:53:12PM -0600, Mark.Miller wrote: I recently experimented with changing from use of string arrays in some of my code to object arrays. This change speeds up my simulations and produces identical numerical results relative to use of string arrays.

Re: [Numpy-discussion] corrcoef of masked array

2007-05-26 Thread Stefan van der Walt
Hi Jesper On Fri, May 25, 2007 at 10:37:44AM +0200, Jesper Larsen wrote: I have a masked array of dimension (nvariables, nobservations) that contain missing values at arbitrary points. Is it safe to rely on numpy.corrcoeff to calculate the correlation coefficients of a masked array (it seems

Re: [Numpy-discussion] fortran representation

2007-05-31 Thread Stefan van der Walt
On Thu, May 31, 2007 at 12:07:09PM +0200, lorenzo bolla wrote: If I have an array1D (obtained reading a stream of numbers with numpy.fromfile) like that: In [150]: data Out[150]: array([ 2., 3., 4., 3., 4., 5., 4., 5., 6., 5., 6., 7.], dtype=float32) I want it to be

[Numpy-discussion] Buildbot for numpy

2007-06-16 Thread Stefan van der Walt
Hi all, Short version = We now have a numpy buildbot running at http://buildbot.scipy.org Long version Albert Strasheim and I set up a buildbot for numpy this week. For those of you unfamiliar with The Buildbot, it is ...a system to automate the compile/test cycle

Re: [Numpy-discussion] question about numpy

2007-06-17 Thread Stefan van der Walt
On Fri, Jun 15, 2007 at 03:44:37PM -0400, David M. Cooke wrote: I meet a problem when I installed numpy. I installed numpy by the command python setup.py install. Then I tested it by python -c 'import numpy; numpy.test()'. But it doesn't work. There is an error message: Running from numpy

Re: [Numpy-discussion] question about numpy

2007-06-19 Thread Stefan van der Walt
On Tue, Jun 19, 2007 at 05:06:42PM +0900, David Cournapeau wrote: Robert Kern wrote: Stefan van der Walt wrote: On Fri, Jun 15, 2007 at 03:44:37PM -0400, David M. Cooke wrote: I meet a problem when I installed numpy. I installed numpy by the command python setup.py install. Then I tested

Re: [Numpy-discussion] Is this an indexing bug?

2007-06-19 Thread Stefan van der Walt
On Tue, Jun 19, 2007 at 12:35:05PM +0200, Sturla Molden wrote: On 6/19/2007 12:14 PM, Sturla Molden wrote: h[0,:,numpy.arange(14)] is a case of sdvanced indexing. You can also see that h[0,:,[0,1,2,3,4,5,6,7,8,9,10,11,12,13]].shape (14, 4) Another way to explain this is that

Re: [Numpy-discussion] Help installing numpy 1.0.2 on LINUX

2007-06-24 Thread Stefan van der Walt
On Sun, Jun 24, 2007 at 05:58:33PM +0100, John Pruce wrote: When I try to run numpy.test(level=1) I get: import numpy numpy.test(level=1) Traceback (most recent call last) File stdln. line 1, in module AttributeError: 'module' has no attribute 'test' Thank you for your help or

Re: [Numpy-discussion] Should bool_ subclass int?

2007-07-14 Thread Stefan van der Walt
On Mon, Jul 09, 2007 at 12:32:02PM -0700, Timothy Hochberg wrote: I gave this a try. Since so much code is auto-generated, it can be difficult to figure out what's going on in the core matrix stuff. Still, it seems like the solution is almost absurdly easy, consisting of changing only three

[Numpy-discussion] Finalising documentation guidelines for NumPy

2007-07-17 Thread Stefan van der Walt
Hi all, In May this year, Charles Harris posted to this mailing list http://thread.gmane.org/gmane.comp.python.numeric.general/15381/focus=15407 discussing some shortcomings of the current NumPy (and hence SciPy) documentation standard

Re: [Numpy-discussion] getting numPy happening for sciPy

2007-07-23 Thread Stefan van der Walt
Hi Tim On Mon, Jul 23, 2007 at 08:20:24PM +0930, Tim Mortimer wrote: I am not an experienced programmer, so the idea of building NumPy from the bleeding edge repository is beyond my capability, as there appears to be no specific instructions for how to do this (that don't assume you have

Re: [Numpy-discussion] Compile extension modules with Visual Studio 2005

2007-07-25 Thread Stefan van der Walt
On Wed, Jul 25, 2007 at 03:41:37PM +0200, Gael Varoquaux wrote: On Wed, Jul 25, 2007 at 06:38:55AM -0700, Ray Schumacher wrote: The codeGenerator is magic, if you ask me: http://starship.python.net/crew/theller/ctypes/old/codegen.html Can it wrap code passing around arrays ? If so it

Re: [Numpy-discussion] build on windows 64-bit platform

2007-07-27 Thread Stefan van der Walt
On Fri, Jul 27, 2007 at 04:54:45PM +0200, Pearu Peterson wrote: Stefan van der Walt wrote: Hi all, The build is still failing on winXP 64-bit, as shown on the buildbot page http://buildbot.scipy.org/Windows%20XP%20x86_64%20MSVC/builds/25/step-shell/0 with the error

[Numpy-discussion] build on windows 64-bit platform

2007-07-27 Thread Stefan van der Walt
Hi all, The build is still failing on winXP 64-bit, as shown on the buildbot page http://buildbot.scipy.org/Windows%20XP%20x86_64%20MSVC/builds/25/step-shell/0 with the error AttributeError: MSVCCompiler instance has no attribute '_MSVCCompiler__root' Could someone familiar with the MSVC

Re: [Numpy-discussion] build on windows 64-bit platform

2007-07-27 Thread Stefan van der Walt
On Sat, Jul 28, 2007 at 12:54:52AM +0200, Pearu Peterson wrote: Ok, I have now enabled DISTUTILS_USE_SDK for AMD64 Windows platform and it seems working.. Fantastic, thanks! However, the build still fails but now the reason seems to be related to numpy ticket 164:

Re: [Numpy-discussion] reading 10 bit raw data into an array

2007-07-30 Thread Stefan van der Walt
On Mon, Jul 30, 2007 at 04:01:46PM +0200, Danny Chan wrote: I'm trying to read a data file that contains a raw image file. Every pixel is assigned a value from 0 to 1023, and all pixels are stored from top left to bottom right pixel in binary format in this file. I know the width and the

Re: [Numpy-discussion] numpy arrays, data allocation and SIMD alignement

2007-08-08 Thread Stefan van der Walt
On Tue, Aug 07, 2007 at 01:33:24AM -0400, Anne Archibald wrote: Well, it can be done in Python: just allocate a too-big ndarray and take a slice that's the right shape and has the right alignment. But this sucks. Could you explain to me why is this such a bad idea? Stéfan

Re: [Numpy-discussion] vectorized function inside a class

2007-08-08 Thread Stefan van der Walt
Hi Mark On Wed, Aug 08, 2007 at 03:37:09PM -, mark wrote: I am trying to figure out a way to define a vectorized function inside a class. This is what I tried: class test: def __init__(self): self.x = 3.0 def func(self,y): rv = self.x

Re: [Numpy-discussion] vectorized function inside a class

2007-08-08 Thread Stefan van der Walt
On Wed, Aug 08, 2007 at 08:54:18AM -0700, Timothy Hochberg wrote: Don't use vectorize? Something like: def f(self,y): return np.where(y self.x, y, self.x) A one-liner, cool. Benchmarks on some other methods: Method 1: N.where 100 loops, best of 3: 9.32 ms per loop Method 2: N.clip

Re: [Numpy-discussion] numpy arrays, data allocation and SIMD alignement

2007-08-09 Thread Stefan van der Walt
On Thu, Aug 09, 2007 at 04:52:38PM +0900, David Cournapeau wrote: Charles R Harris wrote: Well, what you want might be very easy to do in python, we just need to check the default alignments for doubles and floats for some of the other compilers, architectures, and OS's out there. On

Re: [Numpy-discussion] Finding a row match within a numpy array

2007-08-18 Thread Stefan van der Walt
On Tue, Aug 14, 2007 at 11:53:03AM +0100, Andy Cheesman wrote: Dear nice people I'm trying to match a row (b) within a large numpy array (a). My most successful attempt is below hit = equal(b, a) total_hits = add.reduce(hit, 1) max_hit = argmax(total_hits, 0) answer = a[max_hit]

Re: [Numpy-discussion] Finding a row match within a numpy array

2007-08-18 Thread Stefan van der Walt
On Tue, Aug 14, 2007 at 11:53:03AM +0100, Andy Cheesman wrote: Dear nice people I'm trying to match a row (b) within a large numpy array (a). My most successful attempt is below hit = equal(b, a) total_hits = add.reduce(hit, 1) max_hit = argmax(total_hits, 0) answer = a[max_hit]

Re: [Numpy-discussion] Setting numpy record array elements

2007-08-20 Thread Stefan van der Walt
On Mon, Aug 20, 2007 at 08:34:53AM -0500, Sameer DCosta wrote: In the example below I have a record array *a* that has a column *col1. I am trying to set the first element of a.col1 to zero in two different ways. 1. a[0].col1 = 0 (This fails silently) 2. a.col1[0] = 0 (This works fine)

Re: [Numpy-discussion] problem on testing numpy

2007-08-26 Thread Stefan van der Walt
On Fri, Aug 24, 2007 at 05:46:55PM +0200, Vivian Tini wrote: Dear All, I have just installed NumPy and I am excited to test it. Since I have no access as root then I installed Numpy in my home directory. The following messages appears as I tried some commands: import numpy Running

Re: [Numpy-discussion] possibly ctypes related segfault

2007-08-27 Thread Stefan van der Walt
On Mon, Aug 27, 2007 at 08:21:43PM +0200, Lino Mastrodomenico wrote: Hi Martin, 2007/8/27, Martin Wiechert [EMAIL PROTECTED]: I could not reproduce the bug in a debug build of python (--without-pymalloc) or on another machine. The crashing machine is an eight-way opteron. Not sure if

Re: [Numpy-discussion] numpy.random.multinomial() cannot handle zero's

2007-08-27 Thread Stefan van der Walt
Hi Chris On Mon, Aug 27, 2007 at 11:07:00AM -0700, Christopher Barker wrote: Is the kahan_sum closer? -- it should be, though compensated summation is really for adding LOTS of numbers, for 4, it's pointless at best. Anyway, binary floating point has its errors, and compensated summation

Re: [Numpy-discussion] numpy.random.multinomial() cannot handle zero's

2007-08-28 Thread Stefan van der Walt
On Mon, Aug 27, 2007 at 04:54:21PM -0700, Christopher Barker wrote: Stefan van der Walt wrote: but using the Pyrex module, it yields true. You can find the code at http://mentat.za.net/html/refer/somesumbug.tar.bz2 That link appears to be broken. Sorry, http://mentat.za.net/refer

Re: [Numpy-discussion] possibly ctypes related segfault

2007-08-28 Thread Stefan van der Walt
Hi Martin On Mon, Aug 27, 2007 at 02:57:28PM +0200, Martin Wiechert wrote: I'm suffering from a strange segfault and would appreciate your help. I'm calling a small C function using ctypes / numpy.ctypeslib. The function works in the sense that it returns correct results. After calling the

Re: [Numpy-discussion] possibly ctypes related segfault

2007-08-28 Thread Stefan van der Walt
On Tue, Aug 28, 2007 at 02:03:52PM +0200, Martin Wiechert wrote: Here's the test script. I'm using it via execfile from an interactive session, so I can inspect (and crash with readline) afterwards. Here's how I compiled: gcc solver.c -fPIC -ggdb -shared -llapack -lf77blas -lcblas

  1   2   3   >