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

2012-01-06 Thread Vincent Schut
On Wed, 04 Jan 2012 12:29:36 +0100, Derek Homeier wrote: On 04.01.2012, at 5:10AM, questions anon wrote: Thanks for your responses but I am still having difficuties with this problem. Using argmax gives me one very large value and I am not sure what it is. it is the index in the flattened

Re: [Numpy-discussion] python geospatial package?

2012-02-23 Thread Vincent Schut
On 02/22/2012 10:45 PM, Chao YUE wrote: Hi all, Is anyone using some python geospatial package that can do jobs like intersection, etc. the job is like you automatically extract a region on a global map etc. thanks and cheers, Chao Chao, shapely would do this, though I found it had a

Re: [Numpy-discussion] Numpy interpolate: cut through 2D matrix

2012-03-01 Thread Vincent Schut
On 03/01/2012 12:35 PM, Pierre Barthelemy wrote: Hello, for a data analysis tool i am programming, i need to plot a cut through a 2D graph. I then have a 2D array, and the indices start=(start_x,start_y) and stop=(stop_x,stop_y) that are the position of the starting point and stop point of

[Numpy-discussion] large float32 array issue

2010-11-03 Thread Vincent Schut
Hi, I'm running in this strange issue when using some pretty large float32 arrays. In the following code I create a large array filled with ones, and calculate mean and sum, first with a float64 version, then with a float32 version. Note the difference between the two. NB the float64 version

Re: [Numpy-discussion] large float32 array issue

2010-11-03 Thread Vincent Schut
On 11/03/2010 12:31 PM, Warren Weckesser wrote: On Wed, Nov 3, 2010 at 5:59 AM, Warren Weckesser warren.weckes...@enthought.com mailto:warren.weckes...@enthought.com wrote: On Wed, Nov 3, 2010 at 3:54 AM, Vincent Schut sc...@sarvision.nl mailto:sc...@sarvision.nl wrote

Re: [Numpy-discussion] large float32 array issue

2010-11-04 Thread Vincent Schut
On 11/03/2010 03:04 PM, Bruce Southey wrote: On 11/03/2010 06:52 AM, Pauli Virtanen wrote: Wed, 03 Nov 2010 12:39:08 +0100, Vincent Schut wrote: [clip] Btw, should I file a bug on this? One can argue that mean() and sum() should use a numerically stabler algorithm, so yes, a bug can be filed

Re: [Numpy-discussion] need a better way to fill a grid

2011-01-24 Thread Vincent Schut
On 01/24/2011 02:53 PM, John wrote: Hello, I'm trying to cycle over some vectors (lat,lon,emissions) of irregularly spaced lat/lon spots, and values. I need to sum the values each contributing to grid on a regular lat lon grid. This is what I have presently, but it is too slow. Is there a

Re: [Numpy-discussion] local variable referenced before assignment

2011-05-31 Thread Vincent Schut
On 05/31/2011 11:04 AM, Edoardo Pasca wrote: Dear all, sometimes I encounter the problem that calling many times a function it happens that some local variables are not defined and the procedure crashes. For example I have a function defined as def procedure(tt, Ctissue, WeinmannFit,

[Numpy-discussion] strange problem compiling against ndarrayobject.h

2007-11-01 Thread Vincent Schut
Hmm, it seems my original message did not come through? Not in gmane, at least... Well, here's again: Hi numpy and/or gdal guru's, I'm suddenly getting into trouble compiling gdal's python extension, when it includes ndarrayobject.h from numpy. First it complains about my python not being

Re: [Numpy-discussion] strange problem compiling against ndarrayobject.h

2007-11-01 Thread Vincent Schut
Hi all, It appeared to be a gdal issue after all: the arrayobject header file was being included before the python headers... Glad it wasn't something like me having borked my numpy build :) Cheers, Vincent. Vincent Schut wrote: Hmm, it seems my original message did not come through

Re: [Numpy-discussion] numpy : your experiences?

2007-11-20 Thread Vincent Schut
:-) It's really that simple nowadays. And most of our processing is very parallel in nature. Cheers, Vincent Schut. ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

[Numpy-discussion] ndim argsort question

2007-11-20 Thread Vincent Schut
the argsort result to work. Any hints? Hard to explain. I hope someone understands it, otherwise please let me know and I'll try to refrase :) Cheers, Vincent Schut. ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman

Re: [Numpy-discussion] moving window in numpy

2007-11-26 Thread Vincent Schut
Matthew Perry wrote: Hi all, I'm not sure if my terminology is familiar but I'm trying to do a moving window analysis (ie a spatial filter or kernel) on a 2-D array representing elevation. For example, a 3x3 window centered on each cell is used to calculate the derivate slope of that cell.

Re: [Numpy-discussion] Help making better use of numpy array functions

2009-11-26 Thread Vincent Schut
Hi mdekauwe, as long as your data size is small enough to fit a 8x array in memory and use it, why not just skip the running total and average 8 data arrays each 8day period? And skip the x and y loops; these are real performance killers. As a bonus, your code gets a lot smaller and more

Re: [Numpy-discussion] Help making better use of numpy array functions

2009-11-26 Thread Vincent Schut
mdekauwe wrote: Thanks...I have adopted that and as you said it is a lot neater! Though I need to keep the pixel count for a weighting in another piece of code so have amended your logic slightly. Alternatively, you could simply take the sum over axis=0 of the weight array to get the pixel

Re: [Numpy-discussion] Help making better use of numpy array functions

2009-11-26 Thread Vincent Schut
mdekauwe wrote: Vincent Schut-2 wrote: Oh, and minor issue: creating a array of zeros and then multiplying with -999 still makes an array of zeros... I'd incorporated an array of *ones* multiplied with -999, because for the last chunk of days you could end up with a 8day array only

Re: [Numpy-discussion] Producing a Histogram When Bins Are Known

2009-11-27 Thread Vincent Schut
Wayne Watson wrote: I have a list that already has the frequencies from 0 to 255. However, I'd like to make a histogram that has say 32 bins whose ranges are 0-7, 8-15, ... 248-255. Is it possible? Wayne, you might find the 'numpy example list with doc' webpage quite informative...

Re: [Numpy-discussion] Is this a bug in numpy.ma.reduce?

2010-03-05 Thread Vincent Schut
On 03/05/2010 11:51 AM, Pierre GM wrote: On Mar 5, 2010, at 4:38 AM, David Goldsmith wrote: Hi! Sorry for the cross-post, but my own investigation has led me to suspect that mine is actually a numpy problem, not a matplotlib problem. I'm getting the following traceback from a call to

Re: [Numpy-discussion] Extracting values from one array corresponding to argmax elements in another array

2010-04-06 Thread Vincent Schut
On 04/05/2010 06:06 PM, Keith Goodman wrote: On Mon, Apr 5, 2010 at 8:44 AM, Ken Basyekbas...@jhu.edu wrote: Hi Folks, I have two arrays, A and B, with the same shape. I want to find the highest values in A along some axis, then extract the corresponding values from B. I can get the

Re: [Numpy-discussion] Extracting values from one array corresponding to argmax elements in another array

2010-04-07 Thread Vincent Schut
On 04/06/2010 03:22 PM, Ken Basye wrote: From: Vincent Schut sc...@sarvision.nl On 04/05/2010 06:06 PM, Keith Goodman wrote: On Mon, Apr 5, 2010 at 8:44 AM, Ken Basyekbas...@jhu.edu wrote: snip b[a.argmax(axis=0), range(3)] array([0, 4, 5]) Which does not work anymore when your

Re: [Numpy-discussion] 2D binning

2010-06-02 Thread Vincent Schut
On 06/02/2010 04:52 AM, josef.p...@gmail.com wrote: On Tue, Jun 1, 2010 at 9:57 PM, Zachary Pincuszachary.pin...@yale.edu wrote: I guess it's as fast as I'm going to get. I don't really see any other way. BTW, the lat/lons are integers) You could (in c or cython) try a brain-dead hashtable

Re: [Numpy-discussion] Crosstabulation

2010-07-19 Thread Vincent Schut
will get a pixel count for each bin combination. see: http://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram2d.html Regards, Vincent Schut. *From:* Friedrich Romstedt friedrichromst...@gmail.com

Re: [Numpy-discussion] numpy for Python 3?

2010-07-19 Thread Vincent Schut
is long, try to find the relevant lines indicating where and what goes wrong) Good luck anyway! Vincent Schut. Thanks, Vincent. And I am more comfortable with pre-built packages. Most of us are ;-) But sometimes you just need to bite the bullet... Dick

Re: [Numpy-discussion] numpy for Python 3?

2010-07-19 Thread Vincent Schut
On 07/19/2010 03:34 PM, Richard D. Moores wrote: On Mon, Jul 19, 2010 at 06:15, Vincent Schutsc...@sarvision.nl wrote: On 07/19/2010 02:56 PM, Richard D. Moores wrote: On Mon, Jul 19, 2010 at 05:28, Vincent Schutsc...@sarvision.nlwrote: Well, you might want to read up on some

Re: [Numpy-discussion] Crosstabulation

2010-07-20 Thread Vincent Schut
On 07/19/2010 10:14 PM, Friedrich Romstedt wrote: 2010/7/19 sandric ionutsandricio...@yahoo.com: For land-use a class would be for example forest, other would be orchard etc. For Slope gradient I would have values which3 and between 3 and 7 etc. So, I will have 2 raster data with, let's say,

Re: [Numpy-discussion] summarizing blocks of an array using a moving window

2010-07-22 Thread Vincent Schut
. Good luck! Vincent Schut. The long version: I am trying to resample an image loaded with GDAL into an NxN array. Note that this is for statistical purposes, so image quality doesn't matter. For the curious, the image is derived from satellite imagery and displays a map of hotspots of tropical

[Numpy-discussion] first recarray steps

2008-05-20 Thread Vincent Schut
Hi, I'm trying to get into recarrays. Unfortunately documentation is a bit on the short side... Lets say I have a rgb image of arbitrary size, as a normal ndarray (that's what my image reading lib gives me). Thus shape is (3,ysize,xsize), dtype = int8. How would I convert/view this as a

Re: [Numpy-discussion] first recarray steps

2008-05-21 Thread Vincent Schut
Christopher Barker wrote: Vincent Schut wrote: Lets say I have a rgb image of arbitrary size, as a normal ndarray (that's what my image reading lib gives me). Thus shape is (3,ysize,xsize), dtype = int8. How would I convert/view this as a recarray of shape (ysize, xsize) with the first

Re: [Numpy-discussion] first recarray steps

2008-05-21 Thread Vincent Schut
Robert Kern wrote: On Wed, May 21, 2008 at 1:48 AM, Vincent Schut [EMAIL PROTECTED] wrote: Christopher Barker wrote: Also, if you image data is rgb, usually, that's a (width, height, 3) array: rgbrgbrgbrgb... in memory. If you have a (3, width, height) array, then that's rrr

Re: [Numpy-discussion] first recarray steps

2008-05-21 Thread Vincent Schut
Robert Kern wrote: On Wed, May 21, 2008 at 2:03 AM, Vincent Schut [EMAIL PROTECTED] wrote: Robert Kern wrote: On Wed, May 21, 2008 at 1:48 AM, Vincent Schut [EMAIL PROTECTED] wrote: Christopher Barker wrote: Also, if you image data is rgb, usually, that's a (width, height, 3) array

Re: [Numpy-discussion] first recarray steps

2008-05-22 Thread Vincent Schut
Anne Archibald wrote: 2008/5/21 Vincent Schut [EMAIL PROTECTED]: Christopher Barker wrote: Also, if you image data is rgb, usually, that's a (width, height, 3) array: rgbrgbrgbrgb... in memory. If you have a (3, width, height) array, then that's rrr... Some image

Re: [Numpy-discussion] distance_matrix: how to speed up?

2008-05-22 Thread Vincent Schut
Emanuele Olivetti wrote: snip This solution is super-fast, stable and use little memory. It is based on the fact that: (x-y)^2*w = x*x*w - 2*x*y*w + y*y*w For size1=size2=dimensions=1000 requires ~0.6sec. to compute on my dual core duo. It is 2 order of magnitude faster than my previous

Re: [Numpy-discussion] distance_matrix: how to speed up?

2008-05-22 Thread Vincent Schut
Rob Hetland wrote: On May 22, 2008, at 9:45 AM, Vincent Schut wrote: snip Really, though, the rbf toolbox will not be limited by the memory of the distance matrix. Later on, you need to do a large linear algebra 'solve', like this: r = norm(x, x) # The distances between all

Re: [Numpy-discussion] 1.2 tasks

2008-08-05 Thread Vincent Schut
David Huard wrote: On Mon, Aug 4, 2008 at 1:45 PM, Jarrod Millman [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: snip Question: Should histogram raise a warning by default (new=True) to warn users that the behaviour has changed ? Or warn only if new=False to remind that the old

[Numpy-discussion] maskedarray: how to force mask to expand

2008-09-24 Thread Vincent Schut
Probably I'm just overlooking something obvious, but I'm having problems with maskedarrays (numpy.ma from svn: '1.3.0.dev5861'), the mask by default being a single bool value ('False') instead of a properly sized bool array. If I then try to mask one value by assigning values to certain mask

Re: [Numpy-discussion] maskedarray: how to force mask to expand

2008-09-25 Thread Vincent Schut
, it seemed so simple...). Again, no offence meant, and your work on ma is really appreciated. I hope this discussion will result in more intuitiveness in a future (C?) implementation of ma. Regards, Vincent. On Wednesday 24 September 2008 06:25:57 Vincent Schut wrote: Probably I'm just

Re: [Numpy-discussion] maskedarray: how to force mask to expand

2008-09-26 Thread Vincent Schut
Pierre, Thanks for your explanations. It still seems a little (too) complicated, but from a backwards-compatibility pov combined with your 'nomask is not False' implementation detail, I can understand mostly :-) I think the idea that when a.mask returns False, that actually means nomask

Re: [Numpy-discussion] xml-rpc with numpy arrays

2008-10-01 Thread Vincent Schut
Lisandro Dalcin wrote: I believe xmlrpclib is currently the simpler approach. Some day I'll have the time to implement something similar using MPI communication with mpi4py. However, I believe it can be done even better: local, client-side proxies should automatically provide access to all

Re: [Numpy-discussion] memory usage

2008-10-15 Thread Vincent Schut
Huang-Wen Chen wrote: Robert Kern wrote: from numpy import * for i in range(1000): a = random.randn(512**2) b = a.argsort(kind='quick') Can you try upgrading to numpy 1.2.0? On my machine with numpy 1.2.0 on OS X, the memory usage is stable. I tried the code fragment on two

[Numpy-discussion] fancy view question

2009-02-17 Thread Vincent Schut
Hi list, would it be possible to create a view on an array, such that this view is twice as large (in some dimensions) and in fact does a nearest neighbour 'zoom' on the original array? E.g. using some fancy slicing/striding tricks? an example: a = [[1, 2], [3, 4]] then I'd like a

Re: [Numpy-discussion] fancy view question

2009-02-18 Thread Vincent Schut
Gael Varoquaux wrote: On Tue, Feb 17, 2009 at 10:18:11AM -0600, Robert Kern wrote: On Tue, Feb 17, 2009 at 10:16, Gael Varoquaux gael.varoqu...@normalesup.org wrote: On Tue, Feb 17, 2009 at 09:09:38AM -0600, Robert Kern wrote: np.repeat(np.repeat(x, 2, axis=0), 2, axis=1) stride_tricks are

Re: [Numpy-discussion] is it a bug?

2009-03-13 Thread Vincent Schut
Travis E. Oliphant wrote: shuwj5...@163.com wrote: snipsnip Travis, thanks for the excellent explanation! It clears something which I think is related to this, I've been wanting to ask on the ml for some time already. Now here's the case. I often have 4d arrays that are actually related sets

[Numpy-discussion] bitwise view on numpy array

2009-05-06 Thread Vincent Schut
Hi, I'm gonna have large (e.g. 2400x2400) arrays of 16 and 32 bit bitfields. I've been searching in vain for an efficient and convenient way to represent these array's individual bit's (or, even better, configureable bitfields of 1-4 bits each). Of course I know I can 'split' the array in

Re: [Numpy-discussion] add axis to results of reduction (mean, min, ...)

2009-08-18 Thread Vincent Schut
Keith Goodman wrote: On Thu, Aug 6, 2009 at 9:58 AM, Charles R Harrischarlesr.har...@gmail.com wrote: On Thu, Aug 6, 2009 at 9:55 AM, josef.p...@gmail.com wrote: What's the best way of getting back the correct shape to be able to broadcast, mean, min,.. to the original array, that works for

Re: [Numpy-discussion] Removing scipy.stsci was [Re: [SciPy-dev] Deprecate chararray [was Plea for help]]

2009-08-21 Thread Vincent Schut
the idea... Oh and I know of course ndimage is scipy, and this list is numpy. But as the image processing subject emerged here, well... Cheers, Vincent Schut. Sorry, Chris ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http

Re: [Numpy-discussion] Removing scipy.stsci was [Re: [SciPy-dev] Deprecate chararray [was Plea for help]]

2009-08-24 Thread Vincent Schut
Stéfan van der Walt wrote: Hi Vincent 2009/8/21 Vincent Schut sc...@sarvision.nl: I know it probably will be a pretty involved task, as ndimage comes from numarray and seems to be largely implemented in C. But I really wanted to raise the issue now the image processing subject turns up once

Re: [Numpy-discussion] histogram: sum up values in each bin

2009-08-27 Thread Vincent Schut
Tim Michelsen wrote: Hello, I need some advice on histograms. If I interpret the documentation [1, 2] for numpy.histogram correctly, the result of the function is a count of the occurences sorted into each bin. (n, bins) = numpy.histogram(v, bins=50, normed=1) But how can I apply another