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

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

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 fla

Re: [Numpy-discussion] Array vectorization in numpy

2011-07-20 Thread Vincent Schut
> with "gcc -O3 -ffast-math -march=native -mfpmath=sse" optimizations > for the C code (involving SSE2 vectorization and whatnot, looking at > the assembler output). Numpy is already going essentially at the maximum > speed. As a related side question that I've been wondering myself for some time

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, WeinmannF

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 the

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 stabl

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 > mailto:warren.weckes...@enthought.com>> > wrote: > > > > On Wed, Nov 3, 2010 at 3:54 AM, Vincent Schut <mailto:sc...@sarvision.nl>> wrote: &

[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 is

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

2010-07-22 Thread Vincent Schut
nd sums/means. Other stats might be hard, though. 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

[Numpy-discussion] inverse of compress

2010-07-21 Thread Vincent Schut
elements that are True with values from b, b being a flat array the length of sum(mask). Currently I of course just first create a, then do a[mask] = b. Which works, but is ugly :-) So if anyone has a oneliner which I missed, please step forward... regards, Vincent Schut

Re: [Numpy-discussion] Crosstabulation

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

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 Schut wrote: >> >> >> On 07/19/2010 02:56 PM, Richard D. Moores wrote: >>> On Mon, Jul 19, 2010 at 05:28, Vincent Schutwrote: >>>> >>>> Well,

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

2010-07-19 Thread Vincent Schut
On 07/19/2010 02:56 PM, Richard D. Moores wrote: > On Mon, Jul 19, 2010 at 05:28, Vincent Schut wrote: >> >> Well, you might want to read up on some beginners guide for python? It's >> up to you, of course, but usually before starting with numpy (which >> extend

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

2010-07-19 Thread Vincent Schut
ot work because 'python.exe' is in a different folder (c:\Python31). You could go into that folder, but then you would not be able to find numpy's setup.py script. Best way to solve that: make sure you're in the numpy folder, and type something like: '

Re: [Numpy-discussion] Crosstabulation

2010-07-19 Thread Vincent Schut
and use array is x, your slope gradient array = y, then you define the bins as your class numbers (for x) and your slope gradient ranges (for y), and you will get a pixel count for each bin combination. see: http://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram2d.html Regard

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 Pincus > 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" with no >

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 >> On 04/05/2010 06:06 PM, Keith Goodman wrote: >> >>> On Mon, Apr 5, 2010 at 8:44 AM, Ken Basye wrote: >>> snip >>>>> b[a.argmax(axis=0), range(3)] >>>>> >>&g

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 Basye 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 highest val

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] 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... ht

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 >

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
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 reade

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

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 : >> 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

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

2009-08-21 Thread Vincent Schut
e folks with more/better programming skills than me might like 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 > > __

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 > Harris wrote: >> >> On Thu, Aug 6, 2009 at 9:55 AM, 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 >>> arbitrary dimension and axis?

[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 its

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 o

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 >> 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 fun, but thi

[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 view

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 frag

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 a

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 instead

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

2008-09-25 Thread Vincent Schut
remote possibility of a mask of 'True' would be a.mask = a.mask, but that does not work. Hey, sorry about starting a discussion about this, while I meant to ask just a simple question (and really assumed I had overlooked something, it seemed so simple...). Again, no offence meant, and

[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 po

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] > > wrote: > > 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 >

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: > > > 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 = n

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

2008-05-22 Thread Vincent Schut
Emanuele Olivetti wrote: > > 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 > previo

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

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, i

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

Re: [Numpy-discussion] first recarray steps

2008-05-20 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 >> re

[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 recarr

[Numpy-discussion] Warning: converting a masked element to nan

2008-04-23 Thread Vincent Schut
Hi, Using maskedarrays (from svn numpy trunk), I sometimes get this warning: "Warning: converting a masked element to nan". It is not entirely clear to me what it means, and why it happens. Does it mean that numpy.ma is converting an element of the data part of the MA to NaN, on it's own? If s

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 tha

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

2007-11-20 Thread Vincent Schut
le pieces and throw them as a pp job to the cluster :-) 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
m indexing using 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://p

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

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

2007-10-31 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 unicode

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

2007-10-31 Thread Vincent Schut
Btw forgot some info: gentoo linux, amd64 numpy 1.0.3.1 gdal from svn, updated today python 2.5.1 Cheers, Vincent. ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion