You can subscribe to this list here.
2000 |
Jan
(8) |
Feb
(49) |
Mar
(48) |
Apr
(28) |
May
(37) |
Jun
(28) |
Jul
(16) |
Aug
(16) |
Sep
(44) |
Oct
(61) |
Nov
(31) |
Dec
(24) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(56) |
Feb
(54) |
Mar
(41) |
Apr
(71) |
May
(48) |
Jun
(32) |
Jul
(53) |
Aug
(91) |
Sep
(56) |
Oct
(33) |
Nov
(81) |
Dec
(54) |
2002 |
Jan
(72) |
Feb
(37) |
Mar
(126) |
Apr
(62) |
May
(34) |
Jun
(124) |
Jul
(36) |
Aug
(34) |
Sep
(60) |
Oct
(37) |
Nov
(23) |
Dec
(104) |
2003 |
Jan
(110) |
Feb
(73) |
Mar
(42) |
Apr
(8) |
May
(76) |
Jun
(14) |
Jul
(52) |
Aug
(26) |
Sep
(108) |
Oct
(82) |
Nov
(89) |
Dec
(94) |
2004 |
Jan
(117) |
Feb
(86) |
Mar
(75) |
Apr
(55) |
May
(75) |
Jun
(160) |
Jul
(152) |
Aug
(86) |
Sep
(75) |
Oct
(134) |
Nov
(62) |
Dec
(60) |
2005 |
Jan
(187) |
Feb
(318) |
Mar
(296) |
Apr
(205) |
May
(84) |
Jun
(63) |
Jul
(122) |
Aug
(59) |
Sep
(66) |
Oct
(148) |
Nov
(120) |
Dec
(70) |
2006 |
Jan
(460) |
Feb
(683) |
Mar
(589) |
Apr
(559) |
May
(445) |
Jun
(712) |
Jul
(815) |
Aug
(663) |
Sep
(559) |
Oct
(930) |
Nov
(373) |
Dec
|
From: Todd M. <jm...@st...> - 2004-03-28 03:16:23
|
On Sat, 2004-03-27 at 19:27, Faheem Mitha wrote: > On Sat, 27 Mar 2004, Todd Miller wrote: > > > Try foo[[0,2]]. Note that the array indexing syntax is a little picky: > > foo[(0,2)] (tuple index) won't work, just foo[[0,2]] (list index) or > > foo[array([0,2])] (array index). > > Thanks. I see this extracts the relevant rows. How about columns? I think for columns you need to transpose the matrix or use take() with the right axis=1. > Also, > where is this documented? pp 35,36,37,49,50,51 > I spent quite a while poring over the numarray > documentation. The section on index arrays looked relevant but I found it > difficult to understand. That's probably a corollary to the fact that index arrays, put, and take *are* a little difficult to understand, even more so in numarray than in Numeric. Regards, Todd > > Faheem. > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > https://lists.sourceforge.net/lists/listinfo/numpy-discussion -- Todd Miller <jm...@st...> |
From: Faheem M. <fa...@em...> - 2004-03-28 00:27:11
|
On Sat, 27 Mar 2004, Todd Miller wrote: > Try foo[[0,2]]. Note that the array indexing syntax is a little picky: > foo[(0,2)] (tuple index) won't work, just foo[[0,2]] (list index) or > foo[array([0,2])] (array index). Thanks. I see this extracts the relevant rows. How about columns? Also, where is this documented? I spent quite a while poring over the numarray documentation. The section on index arrays looked relevant but I found it difficult to understand. Faheem. |
From: Todd M. <jm...@st...> - 2004-03-27 21:56:39
|
On Sat, 2004-03-27 at 12:05, Faheem Mitha wrote: > Dear People, > > Suppose I create a numarray arry (say). A numeric array would be fine > too; it probably does not matter. > > >>>import numarray > >>>foo = numarray.reshape(numarray.arange(9),(3,3)) > array([[ 0, 1, 2, 3], > [ 4, 5, 6, 7], > [ 8, 9, 10, 11], > [12, 13, 14, 15]]) > > Is there some way to select the indexes corresponding only to (say) > two rows or columns? > > ie suppose I just want the first and the fourth row or the first and > third columns? Is there some clean way to do this which does not > involve extracting individual rows or columns? > > Ie. I want something like > >>> foo[?,:] > array([[ 0, 1, 2, 3], > [12, 13, 14, 15]]) > Try foo[[0,2]]. Note that the array indexing syntax is a little picky: foo[(0,2)] (tuple index) won't work, just foo[[0,2]] (list index) or foo[array([0,2])] (array index). Regards, Todd > etc. > > Suggestions appreciated. Please cc me; I'm not subscribed. Thanks in > advance. > > Faheem. > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > https://lists.sourceforge.net/lists/listinfo/numpy-discussion -- Todd Miller <jm...@st...> |
From: Todd M. <jm...@st...> - 2004-03-27 21:49:24
|
On Sat, 2004-03-27 at 12:35, Faheem Mitha wrote: > The README in numarray-0.9/Examples refers to the non-existent file > setup.py (at least in that directory). There are other files called > setup.py elsewhere in the tarball, but they don't look like they are > supposed to compile the examples. > > What am I missing? Nothing. Those are dead comments in the README (they didn't survive the "numarray re-packaging"). There is now a single setup.py for all numarray packages in the root numarray directory. To install the examples, just install numarray. The examples are then found in the package numarray.examples.convolve. If you want to write your own extension, my advice is to stick with the numpy compatible interfaces. A close second is the numarray "high level" interface. Regards, Todd -- Todd Miller <jm...@st...> |
From: Faheem M. <fa...@em...> - 2004-03-27 17:35:30
|
The README in numarray-0.9/Examples refers to the non-existent file setup.py (at least in that directory). There are other files called setup.py elsewhere in the tarball, but they don't look like they are supposed to compile the examples. What am I missing? Thanks, Faheem. ******************************************************************** This directories gives examples and benchmarks ot he usage of numarray. To install do ,---- | python setup.py install `---- in this directory. This will install all examples. You can test all of them by running ,---- | python testall.py `---- or go to the individual subdirectories and look at the examples more closely. ******************************************************************** |
From: Faheem M. <fa...@em...> - 2004-03-27 17:05:47
|
Dear People, Suppose I create a numarray arry (say). A numeric array would be fine too; it probably does not matter. >>>import numarray >>>foo = numarray.reshape(numarray.arange(9),(3,3)) array([[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11], [12, 13, 14, 15]]) Is there some way to select the indexes corresponding only to (say) two rows or columns? ie suppose I just want the first and the fourth row or the first and third columns? Is there some clean way to do this which does not involve extracting individual rows or columns? Ie. I want something like >>> foo[?,:] array([[ 0, 1, 2, 3], [12, 13, 14, 15]]) etc. Suggestions appreciated. Please cc me; I'm not subscribed. Thanks in advance. Faheem. |
From: Gary R. <ga...@em...> - 2004-03-27 07:51:33
|
Actually, this reproduces the problem: >>> from numarray import * >>> from numarray.objects import * >>> abs(-1.) ObjectArray(1.0) >>> abs(-1) ObjectArray(1) > Please ignore this bit of my previous message: > > > >>> abs(-1) > > ObjectArray(1) > > Something in my environment (probably me) got a bit confused. > > Gary -- ___________________________________________________________ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm |
From: Gary R. <ga...@em...> - 2004-03-27 07:32:50
|
Please ignore this bit of my previous message: > >>> abs(-1) > ObjectArray(1) Something in my environment (probably me) got a bit confused. Gary -- ___________________________________________________________ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm |
From: Gary R. <ga...@em...> - 2004-03-27 07:16:30
|
I found a couple more incompatibilities between Numeric and numarray object array handling. When I print an object array in Numeric, if the __str__ method exists for the contained object type, Numeric uses it to print the object. However, numarray uses the __repr__ method instead. This breaks my doctest strings I think Numeric does it correctly. In my example I have a class called Err with def __repr__(self): return "Err(%s,%s,%s)" % (self.value, self.posErr, self.negErr) def __str__(self): return "%s +%s/-%s" % (self.value, self.posErr, self.negErr) Numeric behaves as follows (Note: ArrayOfErr() is just building an object array): >>> print ArrayOfErr([909., 802., 677., 585.], 1.0) [909.0 +1.0/-1.0 802.0 +1.0/-1.0 677.0 +1.0/-1.0 585.0 +1.0/-1.0 ] whereas numarray does this: >>> print ArrayOfErr([909., 802., 677., 585.], 1.0) [Err(909.0,1.0,1.0), Err(802.0,1.0,1.0), Err(677.0,1.0,1.0), Err(585.0,1.0,1.0)] It also appears that if you try to apply the funtion abs to a built-in Python number type after doing a 'from numarray import *', instead of using Python's abs() function as Numeric does and returning a number, numarray creates an ObjectArray containing the number and returns it. This may be a bug. Note also the different answer when an int or float type is passed as an argument to cos: >>> from Numeric import * >>> cos(1) 0.54030230586813977 >>> cos(1.) 0.54030230586813977 >>> abs(-1) 1 >>> from numarray import * >>> cos(1) 0.54030227661132813 >>> cos(1.) 0.54030230586813977 >>> abs(-1) ObjectArray(1) -- ___________________________________________________________ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm |
From: Jonathan B. <bo...@ac...> - 2004-03-25 18:43:26
|
I've looked a little more at this and find that it seems to be a bug the the lapack_lite code, but I really can't decipher it at the moment. I believe I have a fix in the python code that works, though. An offlist email from Arnd Baecker pointed me to: "LWORK (input) INTEGER The dimension of the array WORK. LWORK >= 1. [...] If JOBZ = 'S' or 'A' LWORK >= 3*min(M,N)*min(M,N) + max(max(M,N),4*min(M,N)*min(M,N)+4*min(M,N)). For good performance, LWORK should generally be larger. If LWORK = -1 but other input arguments are legal, WORK(1) returns the optimal LWORK." The singular_value_decomposition function first calls lapack_lite2.dgesdd with lwork=-1 in order to get the optimal lwork value, and then calls it with the optimal lwork value returned. However, an invalid lwork value is being returned sometimes perhaps when 4*min(M,N)*min(M,N)+4*min(M,N) > max(M,N). Because singular_value_decomposition always uses JOBZ = 'S' or 'A', I changed lwork = 3*min(m,n)*min(m,n) + max(max(m,n),4*min(m,n)*min(m,n)+4*min(m,n)) + 500 lwork = 1 work = num.zeros((lwork,), t) results = lapack_routine(option, m, n, a, m, s, u, m, vt, nvt, work, -1, iwork, 0) lwork = int(work[0]) print 'lwork = ' , lwork work = num.zeros((lwork,), t) results = lapack_routine(option, m, n, a, m, s, u, m, vt, nvt, work, lwork, iwork, 0) to lwork = 3*min(m,n)*min(m,n) + max(max(m,n),4*min(m,n)*min(m,n)+4*min(m,n)) + 500 work = num.zeros((lwork,), t) results = lapack_routine(option, m, n, a, m, s, u, m, vt, nvt, work, lwork, iwork, 0) and things seem to be working now. Before, doing A = ones((60, 100), type='Float64') x,y,z = svd(A) resulted in the error, while A = one((100,100), type='Float64') x,y,z = svd(A) did not. Now both seem to work, and I am currently running for x in range(1,1000): for y in range(1,1000): A = ones((x,y), type='Float64') a,b,c = svd(A) which hasn't failed yet, but will of course take quite a long time. If this all works, I'll submit a patch at some point, perhaps, though the real fix would be a fix in the lapack_lite module. -- Jon Bober http://acm.cs.nyu.edu/~bober/ |
From: Gary R. <ga...@em...> - 2004-03-25 09:26:06
|
I thought I'd better try porting my Numeric python module to numarray before posting it to somewhere like Activestate's Python Cookbook site. By the way, if you have a suggestion about a more appropriate place to post what is a potentially useful generic module based on Numpy, can you let me know. It would be nice to have some sort of repository for useful modules. In my module based on Numeric, I build an array of PyObjects: def ArrayOfErr(errList, posErr=0., negErr=None): valArray = array([], 'O') for e in errList: if type(e) == types.TupleType: newErrObject = apply(Err, tuple(e)) elif type(e) == types.FloatType or types.IntType: newErrObject = Err(e, posErr, negErr) valArray = concatenate((valArray, array([newErrObject], 'O'))) return valArray numarray.objects can't handle the first line. Likewise a = fromlist([]) fails. Numeric doesn't seem to have a way of building a PyObject array dynamically, so doing it the way I've shown seemed necessary to me. Porting to numarray required building the list first as follows: def ArrayOfErr(errList, posErr=0., negErr=None): valArray = [] for e in errList: if type(e) == types.TupleType: newErrObject = apply(Err, tuple(e)) elif type(e) == types.FloatType or types.IntType: newErrObject = Err(e, posErr, negErr) valArray.append(newErrObject) return fromlist(valArray) You might like to think about supporting zero length object arrays to maintain compatibility. By the way, I'm using object arrays to hold a Python number type which can by coerced to from a standard Python number type. I can therefore do things like add an array of my objects to a Numpy array of floats for example and the members of the standard Numpy array elements are coerced elementwise to my type producing a new Numpy object array. I wasn't sure that Numeric/numarray would handle this properly, since the documentation implies object arrays are only useful for manipulating arrays without casting types, but it does it correctly - lovely! Gary Ruben -- ___________________________________________________________ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm |
From: Jon B. <bo...@ac...> - 2004-03-25 07:41:40
|
Hello folks, On some numarray code I have, I get the error: ** On entry to DGESDD parameter number 12 had an illegal value when calling singular_value_decomposition on a slightly large array (2D matrix), but not on smaller arrays. Is there perhaps something that I am doing wrong, or is this a bug in numarray? (I suppose that either way, this is a bug, as an error on my part should give a python error rather than a LAPACK error.) [Incidentally, parameter 12 seems to be the lwork parameter, as far as I can tell. I don't immediately see what value it could have that would be illegal, but then, I don't know anything about LAPACK really, and the C code for it is not easy to read.] More info available on request, of course, as well as the code that is causing the problems. Thanks. -Jon Bober |
From: Simon B. <si...@ar...> - 2004-03-24 21:09:36
|
First public release. Comments sought. dsptools ======== Here be Python wrappers for portaudio, ladspa and libsndfile. There are three modules: ladspa, sndfile, and portaudio. They are independant of each other, ie. they should compile/run individualy. Data interchange is type sensitive and uses numarray arrays to store sound data. It's possible to segfault by doing stupid things, eg. from within the portaudio callback only some portaudio calls are allowed. See the python scripts for example usage, *.pyx files for implementation, and *.pxi for underlying c library info. http://sourceforge.net/projects/dsptools/ It's under tested, under documented, but it's pretty cool. Install ------- Use any of the setup scripts: $ python setup*.py build $ python setup*.py install Dependancies ------------ python 2.2.3 or better: http://www.python.org/ numarray 0.8.1 (or better): http://sourceforge.net/projects/numpy/ For portaudio module: portaudio v18.1 (not v19): http://www.portaudio.com/ For sndfile module: libsndfile 1.0.5 or better: http://www.mega-nerd.com/libsndfile/ For ladspa module: ladspa.h v1.1 : http://www.ladspa.org/ladspa_sdk/ and any plugins (optional): http://www.ladspa.org/ Todo ---- * Enable the writing of ladspa plugins in python (!) * portaudio v19 Related Projects ---------------- fastaudio, for portaudio & libsndfile : http://www.freenet.org.nz/python/pyPortAudio/ libsndfile-python : http://arcsin.org/archive/20030520025359.shtml Thanks to --------- Ross Bencina (portaudio) Erik de Castro Lopo (libsndfile) Greg Ewing and all the pyrex people ------------------------------------------------------------ Simon Burton March 23, 2004 -- Simon Burton, B.Sc. Licensed PO Box 8066 ANU Canberra 2601 Australia Ph. 61 02 6249 6940 http://arrowtheory.com |
From: Nadav H. <na...@vi...> - 2004-03-24 06:28:49
|
The nd_image module in numarray has a spline intrpolation function=20 (spline_filter1d). I've tried it, and it is OK. Nadav. -----Original Message----- From: Ray Schumacher [mailto:ra...@bl...] Sent: Tue 23-Mar-04 03:11 To: num...@li... Cc:=09 Subject: [Numpy-discussion] interpolating arrays (?) Howdy, I'd like to resize an array (1-dimensional) a of length n into an array = of=20 n+x, and interpolate the values as necessary. x might be+/-200, len(a) is usually ~500 I tried it in pure Python but it's not quite right yet. (rubberBand, = below) Someone out there must have done this... and linear interpolation for=20 values is probably sufficient (instead of bi-cubic or some such) Cheers, Ray =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D startSlice =3D 10000 endOfSlice =3D=20 10000+int(round(self.samplesPerRotation)) = #self.samplesPerRotation=3D661 ## self.dataArray is about len=3D200,000 of Int for delta in range(-2,3): ## interpolate the different slices to the original length ## 0 should return the same array, this is a test newArray =3D self.rubberBand( = self.dataArray[startSlice:endOfSlice+delta], round(self.samplesPerRotation)) print len(self.dataArray[startSlice:endOfSlice+delta]),=20 len(newArray), ## show the result print delta, = Numeric.sum(self.dataArray[startSlice:endOfSlice]=20 - newArray) def rubberBand(self, data, desiredLength): """ alias/interpolate the data so that it is adjusted to the=20 desired array length""" currentLength =3D float(len(data)) ## positive if the new array is to be longer difference =3D desiredLength - currentLength #print difference, desiredLength, currentLength ## set up the desired length array newData =3D Numeric.zeros(desiredLength, Numeric.Float) ## accounts for binary rounding errors smallNum =3D 2**-14 for index in range(desiredLength): ## find the ratio of the current index to the desired = length ratio =3D index / float(desiredLength) ## find the same (float) position in the old data currIndex =3D int(ratio * currentLength) ## find the decimal part decimalPart =3D (ratio * currentLength) - currIndex print index, currIndex, decimalPart, if(decimalPart>smallNum): ## interpolate newData[index] =3D ((1 - decimalPart) * data[currIndex] = +=20 decimalPart * data[currIndex+1]) print data[currIndex], data[currIndex+1], = newData[index] else: newData[index] =3D data[currIndex] print 'else',data[currIndex], newData[index] return newData ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcli= ck _______________________________________________ Numpy-discussion mailing list Num...@li... https://lists.sourceforge.net/lists/listinfo/numpy-discussion |
From: RayS <ra...@bl...> - 2004-03-24 05:59:17
|
Hi Tim, I implemented the below code with good results; and if I go to a C version in the future I'll let you know. As the raw data is integer and a bit coarse at times, it will also help to have a non-linear method. I use a parabolic interpolation for finding centriods of clipped stellar images, but that's still Python too. >With that one comes up with (untested): > >def rubberBand(self, y, desiredLength): > # Define raw so that raw[0] == 0 and raw[-1] == len(y)-1 and > len(raw) == desiredLength > raw =arange(desiredLength) * (len(y) - 1) / (float(desiredLength) - 1) > jVals = na.clip(na.floor(raw), 0, len(y)-2).astype('i') > delta = raw - jVals > dy = y[1:] - y[:-1] > return na.take(y, jVals) + delta * na.take(dy, jVals) > >Hope that's helpful, quite. >PS, I just realized, these snippets assume a 'import numarray as na' >somewhere above. Numeric should also work if the names are adjusted >appropriately. It does. I use Numeric for when arrays are length< 2000, as someone posted some results to that effect a while back. numarray is certainly faster for images. In general, I'm using FFT for ballpark estimation of periodicity, then doing time domain data comparison for more precise alignment. Thanks to Chris, Konrad and Warren as well, Ray |
From: Chris B. <Chr...@no...> - 2004-03-23 18:33:21
|
RayS wrote: > At 08:19 PM 3/22/04 -0800, Warren Focke wrote: >> Would you consider Fourier interpolation? > I'll try it out tomorrow and check the results. > Thanks! I woulnd't use Fourier interpolation unles your data support that. i.e. if it is periodic. SciPy has an interpolation module. I'd download it and check it out. Last I tried, you can use the interpolation module without installing the whole SciPy package. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no... |
From: RayS <ra...@bl...> - 2004-03-23 05:38:13
|
At 08:19 PM 3/22/04 -0800, Warren Focke wrote: >Would you consider Fourier interpolation? I'll try it out tomorrow and check the results. Thanks! Ray >interpolated = FFT.inverse_real_fft(FFT.real_fft(data), desiredLength) * \ > desiredLength / len(data) > >This works whether desiredLength is less or greater than len(data). The >trick here is that inverse_real_fft discards data or zero-pads at high >frequencies. I keep toying with the idea of modifying the complex >version to do the same, I cannot imagine a use for the current behavior >(truncate or pad at small negative frequencies). > >There can be some pretty wierd edge effects, they can often be defeated >with padding, or, better yet, overlapping segments. Geting that right >might be harder than fixing your approach. > >It has the nice feature that it is information-preserving: if you >interpolate to a higher number of points, then back to the original, you >should get the same numbers back, give or take a little bit of rounding >error. > >Warren Focke > >On Mon, 22 Mar 2004, Ray Schumacher wrote: > > > Howdy, > > > > I'd like to resize an array (1-dimensional) a of length n into an array of > > n+x, and interpolate the values as necessary. > > x might be+/-200, len(a) is usually ~500 > > > > I tried it in pure Python but it's not quite right yet. (rubberBand, below) > > Someone out there must have done this... and linear interpolation for > > values is probably sufficient (instead of bi-cubic or some such) > > > > Cheers, > > Ray > > > > > > > > > > ================================================================== > > startSlice = 10000 > > endOfSlice = > > 10000+int(round(self.samplesPerRotation)) #self.samplesPerRotation=661 > > ## self.dataArray is about len=200,000 of Int > > > > for delta in range(-2,3): > > ## interpolate the different slices to the original length > > ## 0 should return the same array, this is a test > > newArray = self.rubberBand( > > > self.dataArray[startSlice:endOfSlice+delta], > > round(self.samplesPerRotation)) > > print len(self.dataArray[startSlice:endOfSlice+delta]), > > len(newArray), > > ## show the result > > print delta, Numeric.sum(self.dataArray[startSlice:endOfSlice] > > - newArray) > > > > def rubberBand(self, data, desiredLength): > > """ alias/interpolate the data so that it is adjusted to the > > desired array length""" > > currentLength = float(len(data)) > > > > ## positive if the new array is to be longer > > difference = desiredLength - currentLength > > #print difference, desiredLength, currentLength > > > > ## set up the desired length array > > newData = Numeric.zeros(desiredLength, Numeric.Float) > > > > ## accounts for binary rounding errors > > smallNum = 2**-14 > > > > for index in range(desiredLength): > > ## find the ratio of the current index to the desired length > > ratio = index / float(desiredLength) > > > > ## find the same (float) position in the old data > > currIndex = int(ratio * currentLength) > > ## find the decimal part > > decimalPart = (ratio * currentLength) - currIndex > > print index, currIndex, decimalPart, > > if(decimalPart>smallNum): > > ## interpolate > > newData[index] = ((1 - decimalPart) * data[currIndex] + > > decimalPart * data[currIndex+1]) > > print data[currIndex], data[currIndex+1], newData[index] > > else: > > newData[index] = data[currIndex] > > print 'else',data[currIndex], newData[index] > > > > return newData > > > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by: IBM Linux Tutorials > > Free Linux tutorial presented by Daniel Robbins, President and CEO of > > GenToo technologies. Learn everything from fundamentals to system > > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > > _______________________________________________ > > Numpy-discussion mailing list > > Num...@li... > > https://lists.sourceforge.net/lists/listinfo/numpy-discussion > > |
From: Warren F. <fo...@sl...> - 2004-03-23 04:19:16
|
Would you consider Fourier interpolation? interpolated = FFT.inverse_real_fft(FFT.real_fft(data), desiredLength) * \ desiredLength / len(data) This works whether desiredLength is less or greater than len(data). The trick here is that inverse_real_fft discards data or zero-pads at high frequencies. I keep toying with the idea of modifying the complex version to do the same, I cannot imagine a use for the current behavior (truncate or pad at small negative frequencies). There can be some pretty wierd edge effects, they can often be defeated with padding, or, better yet, overlapping segments. Geting that right might be harder than fixing your approach. It has the nice feature that it is information-preserving: if you interpolate to a higher number of points, then back to the original, you should get the same numbers back, give or take a little bit of rounding error. Warren Focke On Mon, 22 Mar 2004, Ray Schumacher wrote: > Howdy, > > I'd like to resize an array (1-dimensional) a of length n into an array of > n+x, and interpolate the values as necessary. > x might be+/-200, len(a) is usually ~500 > > I tried it in pure Python but it's not quite right yet. (rubberBand, below) > Someone out there must have done this... and linear interpolation for > values is probably sufficient (instead of bi-cubic or some such) > > Cheers, > Ray > > > > > ================================================================== > startSlice = 10000 > endOfSlice = > 10000+int(round(self.samplesPerRotation)) #self.samplesPerRotation=661 > ## self.dataArray is about len=200,000 of Int > > for delta in range(-2,3): > ## interpolate the different slices to the original length > ## 0 should return the same array, this is a test > newArray = self.rubberBand( > self.dataArray[startSlice:endOfSlice+delta], > round(self.samplesPerRotation)) > print len(self.dataArray[startSlice:endOfSlice+delta]), > len(newArray), > ## show the result > print delta, Numeric.sum(self.dataArray[startSlice:endOfSlice] > - newArray) > > def rubberBand(self, data, desiredLength): > """ alias/interpolate the data so that it is adjusted to the > desired array length""" > currentLength = float(len(data)) > > ## positive if the new array is to be longer > difference = desiredLength - currentLength > #print difference, desiredLength, currentLength > > ## set up the desired length array > newData = Numeric.zeros(desiredLength, Numeric.Float) > > ## accounts for binary rounding errors > smallNum = 2**-14 > > for index in range(desiredLength): > ## find the ratio of the current index to the desired length > ratio = index / float(desiredLength) > > ## find the same (float) position in the old data > currIndex = int(ratio * currentLength) > ## find the decimal part > decimalPart = (ratio * currentLength) - currIndex > print index, currIndex, decimalPart, > if(decimalPart>smallNum): > ## interpolate > newData[index] = ((1 - decimalPart) * data[currIndex] + > decimalPart * data[currIndex+1]) > print data[currIndex], data[currIndex+1], newData[index] > else: > newData[index] = data[currIndex] > print 'else',data[currIndex], newData[index] > > return newData > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > https://lists.sourceforge.net/lists/listinfo/numpy-discussion > |
From: Ray S. <ra...@bl...> - 2004-03-23 01:10:37
|
Howdy, I'd like to resize an array (1-dimensional) a of length n into an array of n+x, and interpolate the values as necessary. x might be+/-200, len(a) is usually ~500 I tried it in pure Python but it's not quite right yet. (rubberBand, below) Someone out there must have done this... and linear interpolation for values is probably sufficient (instead of bi-cubic or some such) Cheers, Ray ================================================================== startSlice = 10000 endOfSlice = 10000+int(round(self.samplesPerRotation)) #self.samplesPerRotation=661 ## self.dataArray is about len=200,000 of Int for delta in range(-2,3): ## interpolate the different slices to the original length ## 0 should return the same array, this is a test newArray = self.rubberBand( self.dataArray[startSlice:endOfSlice+delta], round(self.samplesPerRotation)) print len(self.dataArray[startSlice:endOfSlice+delta]), len(newArray), ## show the result print delta, Numeric.sum(self.dataArray[startSlice:endOfSlice] - newArray) def rubberBand(self, data, desiredLength): """ alias/interpolate the data so that it is adjusted to the desired array length""" currentLength = float(len(data)) ## positive if the new array is to be longer difference = desiredLength - currentLength #print difference, desiredLength, currentLength ## set up the desired length array newData = Numeric.zeros(desiredLength, Numeric.Float) ## accounts for binary rounding errors smallNum = 2**-14 for index in range(desiredLength): ## find the ratio of the current index to the desired length ratio = index / float(desiredLength) ## find the same (float) position in the old data currIndex = int(ratio * currentLength) ## find the decimal part decimalPart = (ratio * currentLength) - currIndex print index, currIndex, decimalPart, if(decimalPart>smallNum): ## interpolate newData[index] = ((1 - decimalPart) * data[currIndex] + decimalPart * data[currIndex+1]) print data[currIndex], data[currIndex+1], newData[index] else: newData[index] = data[currIndex] print 'else',data[currIndex], newData[index] return newData |
From: Chris P. <chr...@ro...> - 2004-03-22 22:20:20
|
I would like to make a numarray array that shares data with a Numeric array and/or with a PIL Image. As an example of the sort of thing I want to do: >>> import Numeric, Image, ImageDraw >>> a = Numeric.zeros((8,8), 'b') >>> im = Image.frombuffer('L', a.shape[::-1], a) >>> im.readonly = False >>> d = ImageDraw.Draw(im) >>> d.line((0,0,8,8), fill=255) >>> a array([[ 0, 0, 0, 0, 0, 0, 0, 255], [ 0, 0, 0, 0, 0, 0, 255, 0], [ 0, 0, 0, 0, 0, 255, 0, 0], [ 0, 0, 0, 0, 255, 0, 0, 0], [ 0, 0, 0, 255, 0, 0, 0, 0], [ 0, 0, 255, 0, 0, 0, 0, 0], [ 0, 255, 0, 0, 0, 0, 0, 0], [255, 0, 0, 0, 0, 0, 0, 0]],'b') So with Numeric, I can have bidirectional data sharing between an array and an Image object. I have been unable to do the same using a numarray array. Does anyone know whether there is a way to do this? Chris Perkins |
From: Nadav H. <na...@vi...> - 2004-03-22 13:14:20
|
The function did not work. Here is the correction: def tensormultiply(array1, array2): """tensormultiply returns the product for any rank >=3D1 arrays, = defined as: r_{xxx, yyy} =3D \sum_k array1_{xxx, k} array2_{k, yyyy} where xxx, yyy denote the rest of the a and b dimensions. """ if array1.shape[-1] !=3D array2.shape[0]: raise ValueError, "Unmatched dimensions" shape =3D array1.shape[:-1] + array2.shape[1:] return _gen.reshape(dot(_gen.reshape(array1, (-1, = array1.shape[-1])), _gen.reshape(array2, (array2.shape[0], -1))), = shape) Nadav |
From: Colin J. W. <cj...@sy...> - 2004-03-19 20:36:24
|
PyMatrix is a package, based on numarray, which provides matrix arithmetic for the Python user. This is version 0.0.0b Pre-Alpha release. Thanks to those who commented on the initial release in November 2003. The package is available for download from: http://www3.sympatico.ca/cjw/PyMatrix. I would appreciate comments on the current functionality and suggestions as to other capabilities which could usefully be integrated into the package. Prerequisite: numarray 0.9, which is available from: http://sourceforge.net/project/showfiles.php?group_id=1369 The package has been developed under Windows. Reports of usage under Linux would be of particular interest. Colin W. |
From: Support b. <onh...@ci...> - 2004-03-18 12:45:04
|
------------ ABSOLvUTELY NEuW --------------------- FRfESH TErENS MObDELS NEwVER SHrOT BEwFORE, NEjVER FUCwKED SO WIlLDLY BEvFORE, NEyVER CUMShMEARED SO HExAVI1Y BEEfFORE TkHESE BAxBES ARE SIMuPLY WAeY TOsO KIaNKY AND REAnLLY HAwVE A STUNgNING SEXgUAL IMAGINdATION FRhOM SjOLO POScING AND DILcDO GAMyES TO AWESqOME !!! MaULTI 0RpG1ES AND GANGaBANGS http://mmm-sex.biz/90mt/?jDH9w !!! AdNAL, OmRAL , DOUsBLE AND TRIPmLE VAGaINA FbUCK EVxERYTHING THzAT YOhU=92VE BEEN L00eKING FrOR IS HrERE !!!!!! THrESE H0T TEEaNIES ARE REAlDY F0R EVqERYTHING JUoST T0 PLaEASE YOU !!!!!! FREySH TEjEN B0mDY IS ALL YOU NEwED T0 JErRK= OFF M Oq S T PLEASrANTLY !!! LESpBIAN SHgOWS, LIhVE STzRIP SHOiWS AND MOsRE !!!! SjIGN UaP !!!! http://mmm-sex.biz/90mt/?rKREv crystallite gang eerily cluck absentminded harmon augean abort pusey analy= sis naive taketh steiner cretan residue godkin poughkeepsie camouflage pla= toon hippopotamus papyrus drophead poet bean prokofieff anisotropic therap= y hartford exhumation dorchester repel mauricio shuffle badge fate savager= y begotten janet doubloon=20. astigmat thomson transducer particle z balky vestige transferred saga clam= orous busboy harpsichord squander transfix artifact sian movie experientia= l calcify stock truculent withhold lawgiving accolade distal psychotherape= utic tenebrous bodybuilder compensable spurge bertram commonwealth average= aseptic schiller=20. dharma beacon contagion styrene sextans contemptuous creedal andromeda bew= ilder belladonna stimulant danzig earthmover strike johannes birthright wa= rm quartz bikini snail processor temperature prominent murky macbeth chron= ology scrim n wyoming mantle farmington colombia breed awake commingle and= ean protein tent gilbertson polariscope=20. threadbare phelps boar twirl uruguay sloop attica bluejacket incant disson= ant revolutionary transconductance catcall morocco eucalyptus=20. |
From: Colin J. W. <cj...@sy...> - 2004-03-17 03:19:52
|
I'm puzzled that anyone would want to explore the correlation among 42 variables. I would suggest (1) having a go with the more significant of the 42 variables and (2) working with a a much smaller sample, say < 4,000. Todd Miller wrote: [snip] >On Tue, 2004-03-16 at 10:41, CL WU wrote: > > >One possibility is to consider using Float32 to stretch out your >memory. I don't know whether that's numerically viable or not. > >Another way is 64-bit computing. That is largely unexplored territory, >and Python itself has issues there. It will likely take some work >because we haven't done it yet ourselves. > > Todd, I'd be grateful if you could clarify this, do we nor have _nt.Float64 now? Colin W. >I hope this at least sheds some light on the problem, if not the actual >solution. > >Regards, >Todd > > > >>BTW, I am using numarray 0.9/python 2.3.3 on win2kSP4 >> >>Thanks. >> >>Chunlei >> >> >> >>------------------------------------------------------- >>This SF.Net email is sponsored by: IBM Linux Tutorials >>Free Linux tutorial presented by Daniel Robbins, President and CEO of >>GenToo technologies. Learn everything from fundamentals to system >>administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click >>_______________________________________________ >>Numpy-discussion mailing list >>Num...@li... >>https://lists.sourceforge.net/lists/listinfo/numpy-discussion >> >> |
From: Todd M. <jm...@st...> - 2004-03-16 22:28:38
|
On Tue, 2004-03-16 at 10:41, CL WU wrote: > Hi, group, > I have a big "Float64" matrix (42x22300) and I want to get > its correlation coefficient matrix, but I got the error as the following: > > >>> data.shape > (42, 22300) > >>> mlab.corrcoef(data) > Traceback (most recent call last): > File "<interactive input>", line 1, in ? > File "C:\Python23\Lib\site-packages\numarray\linear_algebra\mlab.py", > line 300, in corrcoef > c = cov(x, y) > File "C:\Python23\Lib\site-packages\numarray\linear_algebra\mlab.py", > line 294, in cov > val = squeeze(dot(transpose(m),conjugate(y)) / fact) > File "C:\Python23\Lib\site-packages\numarray\numarraycore.py", line > 1150, in dot > return ufunc.innerproduct(array1, _gen.swapaxes(array2, -1, -2)) > File "C:\Python23\Lib\site-packages\numarray\ufunc.py", line 2047, in > innerproduct > r = a.__class__(shape=adots+bdots, type=rtype) > ValueError: new_memory: invalid region size: -633294592. > > I suspect corrcoef function can not handle such a big matrix. If so, > what is the upper limit for array size? The memory limit is appears to be driven by the numarray.memory and is 2G. Trying to run your function call winds up creating a dot product output array which is 22300**2. This is ~400M * 8 bytes per float just for the dot product output, which is 3.2G, hence the exception. I think 16384**2 is the ideal limit of what you can achieve with numarray, and in practice, think you'll get considerably less depending on how many arrays are needed at once to complete your computation. > How can I get around this > problem in numarray? One possibility is to consider using Float32 to stretch out your memory. I don't know whether that's numerically viable or not. Another way is 64-bit computing. That is largely unexplored territory, and Python itself has issues there. It will likely take some work because we haven't done it yet ourselves. I hope this at least sheds some light on the problem, if not the actual solution. Regards, Todd > BTW, I am using numarray 0.9/python 2.3.3 on win2kSP4 > > Thanks. > > Chunlei > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > https://lists.sourceforge.net/lists/listinfo/numpy-discussion -- Todd Miller <jm...@st...> |