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: Charles R H. <cha...@gm...> - 2006-10-18 02:28:39
|
On 10/17/06, Travis Oliphant <oli...@ie...> wrote: > > Charles R Harris wrote: > > > > > > On 10/17/06, *Lisandro Dalcin* <da...@gm... > > <mailto:da...@gm...>> wrote: > > > > I was surprised by this > > > > In [14]: array([[1,2,3],[4,5,6]]).reshape((3,2),order='F') > > Out[14]: > > array([[1, 5], > > [4, 3], > > [2, 6]]) > > > > > > This one still looks wrong. > > Why does this look wrong. What do you want it to be? Perhaps you are > thinking about the input array as C-order and the output array as > Fortran order. That's not what reshape does. The order argument > specifies how you think about both the input and output. > > Thus, reshape does the equivalent of a Fortran ravel to [1,4,2,5,3,6] > and then a Fortran-order based fill of an empty (3,2) array: giving you > the result. Why a Fortran ravel? I am thinking of it as preserving the memory layout, just messing with how it is addressed. Chuck |
From: Stefan v. d. W. <st...@su...> - 2006-10-18 02:22:47
|
On Tue, Oct 17, 2006 at 07:53:11PM -0600, Travis Oliphant wrote: > Stefan van der Walt wrote: > > Hi all, > > > > Some of you may have seen the interesting thread on Fortran-ordering > > earlier. I thought it might be fun to set up a short quiz which test= s > > your knowledge on the topic. > > > > If you're up for the challenge, take a look at > > > > http://mentat.za.net/numpy/quiz > > > > I won't be held liable for any emotional trauma caused, self-inflicte= d > > wounds or brain-core meltdowns. > > =20 >=20 > Cute (especially the comment if you get them all right). I'm not sure= =20 > if this quiz is a veiled complaint about the rules for Fortran ordering= =20 > or not ;-) If it is, it is very tactfully disguised ;) Actually, I was just trying to figure out how Fortran ordering works and thought others might be interested. I reckoned you would be the only one to get 100%, although now you've explained the rules so clearly a couple of other might grasp for the holy grail too. > In my mind the Fortran ordering rules are consistent (if not completely= =20 > bug-free). You just have to get the right idea of what is meant by th= e=20 > order argument when you use it. If you think you are having trouble=20 > figuring out the rules, think of the trouble it was to figure out what=20 > they should be and then to code them up. My sympathies (no, really). > 2) On reshaping, the order argument specifies how you think the array i= s=20 > organized. Whenever you make a significant reshape you are telling the= =20 > computer to re-interpret the chunk of data in a different way, it makes= =20 > a big difference as to how you think about that chunk of data. Do you=20 > think of it as organized rows-first (C-order) or columns-first=20 > (Fortran-order). The order argument allows you to specify how you=20 > think about it and indicates the 1-d indexing order of the array. It=20 > also fills in the newly-shaped array in exactly that same order. =20 > Semantically, one could technically separate those two concepts and hav= e=20 > one order argument that specifies how you think about the input and=20 > another that specifies how you think about the output. But, I really=20 > didn't want to go there and couldn't see a real advantage to that. So,= =20 > the single order argument specifies how you think about both. Thanks for the detailed overview (we should put it on the wiki). Another thing I'm wondering about: when exactly does reshape need to make copies? One last case, which confuses me still (probably because it is 04:16am): In [41]: x =3D N.array([[0,1,2],[3,4,5]],order=3D'F') In [42]: x Out[42]:=20 array([[0, 1, 2], [3, 4, 5]]) I assume the data is now stored in memory as [0 3 1 4 2 5] (column-wise) If I now do x.reshape((3,2),order=3D'C') i.e. take that block of memory, assume it is in 'C' order, and make its shape (3,2), I expect [[0 3] [1 4] [2 5]] but get [[1 2] [3 4] [5 6]] I'm obviously missing something trivial -- I'll try again tomorrow. Cheers St=E9fan |
From: Charles R H. <cha...@gm...> - 2006-10-18 02:21:06
|
On 10/17/06, Travis Oliphant <oli...@ie...> wrote: > > Charles R Harris wrote: > > > > > > On 10/17/06, *Lisandro Dalcin* <da...@gm... > > <mailto:da...@gm...>> wrote: > > > > I was surprised by this > > > > In [14]: array([[1,2,3],[4,5,6]]).reshape((3,2),order='F') > > Out[14]: > > array([[1, 5], > > [4, 3], > > [2, 6]]) > > > > > > This one still looks wrong. > > > > In [15]: array([1,2,3,4,5,6]).reshape((3,2),order='F') > > Out[15]: > > array([[1, 2], > > [3, 4], > > [5, 6]]) > > > > > > > > This one is fixed, > > > > In [3]: array([[1,2,3,4,5,6]]).reshape((3,2),order='F') > > Out[3]: > > array([[1, 4], > > [2, 5], > > [3, 6]]) > > > > I also don't understand why a copy is returned if 'F' just fiddles > > with the indices and strides; the underlying data should be the same, > > just the view changes. FWIW, I think both examples should be returning > > views. > > You are right, it doesn't need to. My check is not general enough. > > It can be challenging to come up with a general way to differentiate the > view-vs-copy situation and I struggled with it. In this case, it's the > fact that while self->nd > 1, the other dimensions are only of shape 1 > and so don't really matter. If you could come up with some kind of > striding check that would distinguish the two cases, I would appreciate > it. I suppose the problem is mostly in discontiguous arrays. Hmmm..., this isn't too different that reshaping the transpose. a.reshape((m,n),order='F' ~ a.reshape((n,m)).T.reshape(m,n) for instance: In [26]: a Out[26]: array([[1, 2, 3], [4, 5, 6]]) In [27]: a.reshape((3,2)).T.reshape((2,3)) Out[27]: array([[1, 3, 5], [2, 4, 6]]) In [28]: a.reshape((2,3), order='F') Out[28]: array([[1, 2, 3], [4, 5, 6]]) Where I actually think the second reshape is correct and the third incorrect. This has the advantage that *all* the steps return views. Chuck |
From: Travis O. <oli...@ie...> - 2006-10-18 02:14:15
|
Charles R Harris wrote: > > > On 10/17/06, *Lisandro Dalcin* <da...@gm... > <mailto:da...@gm...>> wrote: > > I was surprised by this > > In [14]: array([[1,2,3],[4,5,6]]).reshape((3,2),order='F') > Out[14]: > array([[1, 5], > [4, 3], > [2, 6]]) > > > This one still looks wrong. Why does this look wrong. What do you want it to be? Perhaps you are thinking about the input array as C-order and the output array as Fortran order. That's not what reshape does. The order argument specifies how you think about both the input and output. Thus, reshape does the equivalent of a Fortran ravel to [1,4,2,5,3,6] and then a Fortran-order based fill of an empty (3,2) array: giving you the result. -Travis |
From: Travis O. <oli...@ie...> - 2006-10-18 01:58:42
|
Charles R Harris wrote: > > > On 10/17/06, *Lisandro Dalcin* <da...@gm... > <mailto:da...@gm...>> wrote: > > I was surprised by this > > In [14]: array([[1,2,3],[4,5,6]]).reshape((3,2),order='F') > Out[14]: > array([[1, 5], > [4, 3], > [2, 6]]) > > > This one still looks wrong. > > In [15]: array([1,2,3,4,5,6]).reshape((3,2),order='F') > Out[15]: > array([[1, 2], > [3, 4], > [5, 6]]) > > > > This one is fixed, > > In [3]: array([[1,2,3,4,5,6]]).reshape((3,2),order='F') > Out[3]: > array([[1, 4], > [2, 5], > [3, 6]]) > > I also don't understand why a copy is returned if 'F' just fiddles > with the indices and strides; the underlying data should be the same, > just the view changes. FWIW, I think both examples should be returning > views. You are right, it doesn't need to. My check is not general enough. It can be challenging to come up with a general way to differentiate the view-vs-copy situation and I struggled with it. In this case, it's the fact that while self->nd > 1, the other dimensions are only of shape 1 and so don't really matter. If you could come up with some kind of striding check that would distinguish the two cases, I would appreciate it. -Travis |
From: Travis O. <oli...@ie...> - 2006-10-18 01:52:11
|
Stefan van der Walt wrote: > Hi all, > > Some of you may have seen the interesting thread on Fortran-ordering > earlier. I thought it might be fun to set up a short quiz which tests > your knowledge on the topic. > > If you're up for the challenge, take a look at > > http://mentat.za.net/numpy/quiz > > I won't be held liable for any emotional trauma caused, self-inflicted > wounds or brain-core meltdowns. > Cute (especially the comment if you get them all right). I'm not sure if this quiz is a veiled complaint about the rules for Fortran ordering or not ;-) In my mind the Fortran ordering rules are consistent (if not completely bug-free). You just have to get the right idea of what is meant by the order argument when you use it. If you think you are having trouble figuring out the rules, think of the trouble it was to figure out what they should be and then to code them up. Two rules help you pass the quiz with a perfect score: 1) On array construction, the order argument allows you to specify how the array will be organized in memory. This has no effect on what is printed as the user doesn't usually care how the array is stored in memory. So, you can ignore all order= expressions in the array construct for the quiz 2) On reshaping, the order argument specifies how you think the array is organized. Whenever you make a significant reshape you are telling the computer to re-interpret the chunk of data in a different way, it makes a big difference as to how you think about that chunk of data. Do you think of it as organized rows-first (C-order) or columns-first (Fortran-order). The order argument allows you to specify how you think about it and indicates the 1-d indexing order of the array. It also fills in the newly-shaped array in exactly that same order. Semantically, one could technically separate those two concepts and have one order argument that specifies how you think about the input and another that specifies how you think about the output. But, I really didn't want to go there and couldn't see a real advantage to that. So, the single order argument specifies how you think about both. -Travis |
From: Charles R H. <cha...@gm...> - 2006-10-18 01:47:23
|
On 10/17/06, Lisandro Dalcin <da...@gm...> wrote: > > I was surprised by this > > In [14]: array([[1,2,3],[4,5,6]]).reshape((3,2),order='F') > Out[14]: > array([[1, 5], > [4, 3], > [2, 6]]) This one still looks wrong. In [15]: array([1,2,3,4,5,6]).reshape((3,2),order='F') > Out[15]: > array([[1, 2], > [3, 4], > [5, 6]]) This one is fixed, In [3]: array([[1,2,3,4,5,6]]).reshape((3,2),order='F') Out[3]: array([[1, 4], [2, 5], [3, 6]]) I also don't understand why a copy is returned if 'F' just fiddles with the indices and strides; the underlying data should be the same, just the view changes. FWIW, I think both examples should be returning views. Chuck |
From: Stefan v. d. W. <st...@su...> - 2006-10-18 01:43:01
|
On Wed, Oct 18, 2006 at 10:30:26AM +0900, Bill Baxter wrote: > I think the answer to #3 is wrong. >=20 > >From 1.0rc2 I get: > >>> array([1,2,3,4,5,6],order=3D'C').reshape((2,3),order=3D'F') > array([[1, 2, 3], > [4, 5, 6]]) >=20 > But the quiz wants me to answer something different. This recently changed. The quiz is correct for r3348. Cheers St=E9fan |
From: Travis O. <oli...@ie...> - 2006-10-18 01:37:15
|
Lisandro Dalcin wrote: > I was surprised by this > > In [14]: array([[1,2,3],[4,5,6]]).reshape((3,2),order='F') > Out[14]: > array([[1, 5], > [4, 3], > [2, 6]]) > > In [15]: array([1,2,3,4,5,6]).reshape((3,2),order='F') > Out[15]: > array([[1, 2], > [3, 4], > [5, 6]]) > This is a bug that was recently fixed in SVN. -Travis |
From: Bill B. <wb...@gm...> - 2006-10-18 01:30:27
|
I think the answer to #3 is wrong. >From 1.0rc2 I get: >>> array([1,2,3,4,5,6],order='C').reshape((2,3),order='F') array([[1, 2, 3], [4, 5, 6]]) But the quiz wants me to answer something different. --bb |
From: Lisandro D. <da...@gm...> - 2006-10-18 01:13:15
|
I was surprised by this In [14]: array([[1,2,3],[4,5,6]]).reshape((3,2),order=3D'F') Out[14]: array([[1, 5], [4, 3], [2, 6]]) In [15]: array([1,2,3,4,5,6]).reshape((3,2),order=3D'F') Out[15]: array([[1, 2], [3, 4], [5, 6]]) On 10/17/06, Stefan van der Walt <st...@su...> wrote: > Hi all, > > Some of you may have seen the interesting thread on Fortran-ordering > earlier. I thought it might be fun to set up a short quiz which tests > your knowledge on the topic. > > If you're up for the challenge, take a look at > > http://mentat.za.net/numpy/quiz > > I won't be held liable for any emotional trauma caused, self-inflicted > wounds or brain-core meltdowns. > > Cheers > St=E9fan > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job ea= sier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronim= o > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat= =3D121642 > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > https://lists.sourceforge.net/lists/listinfo/numpy-discussion > --=20 Lisandro Dalc=EDn --------------- Centro Internacional de M=E9todos Computacionales en Ingenier=EDa (CIMEC) Instituto de Desarrollo Tecnol=F3gico para la Industria Qu=EDmica (INTEC) Consejo Nacional de Investigaciones Cient=EDficas y T=E9cnicas (CONICET) PTLC - G=FCemes 3450, (3000) Santa Fe, Argentina Tel/Fax: +54-(0)342-451.1594 |
From: Andrew.MacKeith <And...@AB...> - 2006-10-18 01:05:36
|
Charles R Harris wrote: > > > On 10/17/06, Andrew MacKeith <And...@ab... > <mailto:And...@ab...>> wrote: > > Travis Oliphant wrote: > > >Ah!, I get it. You want to be able to reset to the C-defined > >array_repr function. The one that gets over-written on > import. That > >makes sense. And is definitely do-able. > > > >Please file a ticket. > > > > > Can you point me to how to file a ticket. > Thanks > > > Go to http://projects.scipy.org/scipy/numpy/report > <http://projects.scipy.org/scipy/numpy/report>, login or register > (required), then choose new ticket from the menu at the top. > > BTW, I wish all this was more transparent to the casual visitor to the > scipy site. There should be a link on the front page (numpy bugs or > something) and a short explanation about needing to register to file a > new ticket. Maybe something in the Cookbook would help. > > Chuck Thanks for the info. I filed a ticket. Andrew > > >------------------------------------------------------------------------ > >------------------------------------------------------------------------- >Using Tomcat but need to do more? Need to support web services, security? >Get stuff done quickly with pre-integrated technology to make your job easier >Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > >------------------------------------------------------------------------ > >_______________________________________________ >Numpy-discussion mailing list >Num...@li... >https://lists.sourceforge.net/lists/listinfo/numpy-discussion > > |
From: Neal B. <ndb...@gm...> - 2006-10-18 00:51:21
|
David Huard wrote: > Hi all, > > I'd like to poll the list to see what people want from numpy.histogram(), > since I'm currently writing a contender. > > My main complaints with the current version are: > 1. upper outliers are stored in the last bin, while lower outliers are not > counted at all, > 2. cannot use weights. > > The new histogram function is well under way (it address these issues and > adds an axis keyword), > but I want to know what is the preferred behavior regarding the function > output, and your > willingness to introduce a new behavior that will break some code. > > Given a number of bins N and range (min, max), histogram constructs > linearly spaced bin edges > b0 (out-of-range) | b1 | b2 | b3 | .... | bN | bN+1 out-of-range > and may return: > > A. H = array([N_b0, N_b1, ..., N_bN, N_bN+1]) > The out-of-range values are the first and last values of the array. The > returned array is hence N+2 > > B. H = array([N_b0 + N_b1, N_b2, ..., N_bN + N_bN+1]) > The lower and upper out-of-range values are added to the first and last > bin respectively. > > C. H = array([N_b1, ..., N_bN + N_bN+1]) > Current behavior: the upper out-of-range values are added to the last bin. > > D. H = array([N_b1, N_b2, ..., N_bN]), > Lower and upper out-of-range values are given after the histogram array. > > Ideally, the new function would not break the common usage: H = > histogram(x)[0], so this exclude A. B and C are not acceptable in my > opinion, so only D remains, with the downsize that the outliers are not > returned. A solution might be to add a keyword full_output=False, which > when set to True, returns the out-of-range values in a dictionnary. > > Also, the current function returns -> H, ledges > where ledges is the array of left bin edges (N). > I propose returning the complete array of edges (N+1), including the > rightmost edge. This is a little bit impractical for plotting, as the > edges array does not have the same length as the histogram array, but > allows the use of user-defined non-uniform bins. > > Opinions, suggestions ? > > David I have my own histogram that might interest you. The core is modern c++, with boost::python wrapper. Out-of-bounds behavior is programmable. I'll send it to you if you are interested. |
From: Mike R. <mr...@ca...> - 2006-10-18 00:33:24
|
Hi, I got strange discrepance between 2.4+0.9.8 and 2.5+1.0rc2: model_lib_pool %0 !5019$ python2.5 Python 2.5 (r25:51908, Oct 17 2006, 16:16:21) [GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-14)] on linux2 Type "help", "copyright", "credits" or "license" for more information. f>>> from numpy import * >>> a=arange(12).reshape(4,3) >>> a array([[ 0, 1, 2], [ 3, 4, 5], [ 6, 7, 8], [ 9, 10, 11]]) >>> a[:,2] array([ 2, 5, 8, 11]) >>> a[:,2].repeat(3) array([2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5]) >>> import numpy >>> numpy.__version__ '1.0rc2' >>> Old version looks right: Python 2.4.2 (#5, Jun 2 2006, 18:33:20) [GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-20)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from numpy import * >>> a=arange(12).reshape(4,3) >>> a array([[ 0, 1, 2], [ 3, 4, 5], [ 6, 7, 8], [ 9, 10, 11]]) >>> a[:,2] array([ 2, 5, 8, 11]) >>> a[:,2].repeat(3) array([ 2, 2, 2, 5, 5, 5, 8, 8, 8, 11, 11, 11]) >>> import numpy >>> numpy.__version__ '0.9.8' >>> Thanks, Mike |
From: Stefan v. d. W. <st...@su...> - 2006-10-18 00:25:09
|
Hi all, Some of you may have seen the interesting thread on Fortran-ordering earlier. I thought it might be fun to set up a short quiz which tests your knowledge on the topic. If you're up for the challenge, take a look at http://mentat.za.net/numpy/quiz I won't be held liable for any emotional trauma caused, self-inflicted wounds or brain-core meltdowns. Cheers St=E9fan |
From: Michael S. <mic...@gm...> - 2006-10-18 00:19:31
|
On 10/17/06, Pierre GM <pgm...@ma...> wrote: > On Monday 16 October 2006 22:08, Michael Sorich wrote: > > Does this new MA class allow masking of rearray like arrays? > > Excellent question! Which is to say, I have no idea... I don't use > recordarray, so I didn't think about testing them. > > So, a first test indicates that it doesn't work either. The mask for a3 is > understood as having a size 6, when the data is seen as size 2 only (exactly > the same problem as the original ma module). > I gonna poke around and check whether I can come with a workaround. Just to > make it clear: you want to be able to mask some fields in some records, > right ? Not mask all the fields of a record ? Yes, that is correct. It would be preferable to have more control over masking than simply masking an entire record. I view the heterogenouse arrays as 2D arrays in which it should be possible to mask individual values. |
From: Daniel A. <dj...@hi...> - 2006-10-17 23:35:21
|
Why does a[b1, b2] not mean the same thing as a[b1][:, b2], when "a" is an array and "b1" and "b2" are appropriately sized arrays of booleans? Thanks |
From: Travis O. <oli...@ee...> - 2006-10-17 21:55:58
|
Kenny Ortmann wrote: >just looking for some help, most of the time you guys are good with matlab >code, i am trying to use the filter function under this setting > >y = filter(b,a,X) filters the data in vector X with the filter described by >numerator coefficient vector b and denominator coefficient vector a. If a(1) >is not equal to 1, filter normalizes the filter coefficients by a(1). If >a(1) equals 0, filter returns an error. > > There is scipy.signal.lfilter which implements this algorithm. It's doc string is lfilter(b, a, x, axis=-1, zi=None) Filter data along one-dimension with an IIR or FIR filter. Description Filter a data sequence, x, using a digital filter. This works for many fundamental data types (including Object type). The filter is a direct form II transposed implementation of the standard difference equation (see "Algorithm"). Inputs: b -- The numerator coefficient vector in a 1-D sequence. a -- The denominator coefficient vector in a 1-D sequence. If a[0] is not 1, then both a and b are normalized by a[0]. x -- An N-dimensional input array. axis -- The axis of the input data array along which to apply the linear filter. The filter is applied to each subarray along this axis (*Default* = -1) zi -- Initial conditions for the filter delays. It is a vector (or array of vectors for an N-dimensional input) of length max(len(a),len(b)). If zi=None or is not given then initial rest is assumed. SEE signal.lfiltic for more information. Outputs: (y, {zf}) y -- The output of the digital filter. zf -- If zi is None, this is not returned, otherwise, zf holds the final filter delay values. Algorithm: The filter function is implemented as a direct II transposed structure. This means that the filter implements y[n] = b[0]*x[n] + b[1]*x[n-1] + ... + b[nb]*x[n-nb] - a[1]*y[n-1] + ... + a[na]*y[n-na] using the following difference equations: y[m] = b[0]*x[m] + z[0,m-1] z[0,m] = b[1]*x[m] + z[1,m-1] - a[1]*y[m] ... z[n-3,m] = b[n-2]*x[m] + z[n-2,m-1] - a[n-2]*y[m] z[n-2,m] = b[n-1]*x[m] - a[n-1]*y[m] where m is the output sample number and n=max(len(a),len(b)) is the model order. The rational transfer function describing this filter in the z-transform domain is -1 -nb b[0] + b[1]z + ... + b[nb] z Y(z) = ---------------------------------- X(z) -1 -na a[0] + a[1]z + ... + a[na] z |
From: David H. <dav...@gm...> - 2006-10-17 21:20:09
|
Hi all, I'd like to poll the list to see what people want from numpy.histogram(), since I'm currently writing a contender. My main complaints with the current version are: 1. upper outliers are stored in the last bin, while lower outliers are not counted at all, 2. cannot use weights. The new histogram function is well under way (it address these issues and adds an axis keyword), but I want to know what is the preferred behavior regarding the function output, and your willingness to introduce a new behavior that will break some code. Given a number of bins N and range (min, max), histogram constructs linearly spaced bin edges b0 (out-of-range) | b1 | b2 | b3 | .... | bN | bN+1 out-of-range and may return: A. H = array([N_b0, N_b1, ..., N_bN, N_bN+1]) The out-of-range values are the first and last values of the array. The returned array is hence N+2 B. H = array([N_b0 + N_b1, N_b2, ..., N_bN + N_bN+1]) The lower and upper out-of-range values are added to the first and last bin respectively. C. H = array([N_b1, ..., N_bN + N_bN+1]) Current behavior: the upper out-of-range values are added to the last bin. D. H = array([N_b1, N_b2, ..., N_bN]), Lower and upper out-of-range values are given after the histogram array. Ideally, the new function would not break the common usage: H = histogram(x)[0], so this exclude A. B and C are not acceptable in my opinion, so only D remains, with the downsize that the outliers are not returned. A solution might be to add a keyword full_output=False, which when set to True, returns the out-of-range values in a dictionnary. Also, the current function returns -> H, ledges where ledges is the array of left bin edges (N). I propose returning the complete array of edges (N+1), including the rightmost edge. This is a little bit impractical for plotting, as the edges array does not have the same length as the histogram array, but allows the use of user-defined non-uniform bins. Opinions, suggestions ? David |
From: Charles R H. <cha...@gm...> - 2006-10-17 19:51:09
|
On 10/17/06, Andrew MacKeith <And...@ab...> wrote: > > Travis Oliphant wrote: > > >Ah!, I get it. You want to be able to reset to the C-defined > >array_repr function. The one that gets over-written on import. That > >makes sense. And is definitely do-able. > > > >Please file a ticket. > > > >** > Can you point me to how to file a ticket. > Thanks Go to http://projects.scipy.org/scipy/numpy/report, login or register (required), then choose new ticket from the menu at the top. BTW, I wish all this was more transparent to the casual visitor to the scipy site. There should be a link on the front page (numpy bugs or something) and a short explanation about needing to register to file a new ticket. Maybe something in the Cookbook would help. Chuck |
From: Sven S. <sve...@gm...> - 2006-10-17 19:49:01
|
Hi, as suggested on the website I use the kindly provided pre-built (unofficial) ubuntu debs. Recently there is a new one available with version numbe 1.0+~dev3336-0ads1. Apart from the slightly strange +~ thing in there, it very much seems to be based on trac changeset 3336, which is somewhere between rc2 and now, right? And just checking, what are the matplotlib packages that are compatible? The most recent from the same package source seems to be 0.87.5-r2781-0ads2, is that ok with the above numpy? Will the mpl ubuntu package before that break with the latest numpy ubuntu package? Thanks for your help, and for the build effort, Sven |
From: Andrew M. <And...@AB...> - 2006-10-17 19:33:51
|
Travis Oliphant wrote: >Ah!, I get it. You want to be able to reset to the C-defined >array_repr function. The one that gets over-written on import. That >makes sense. And is definitely do-able. > >Please file a ticket. > > Can you point me to how to file a ticket. Thanks Andrew > > >-Travis > > >------------------------------------------------------------------------- >Using Tomcat but need to do more? Need to support web services, security? >Get stuff done quickly with pre-integrated technology to make your job easier >Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >_______________________________________________ >Numpy-discussion mailing list >Num...@li... >https://lists.sourceforge.net/lists/listinfo/numpy-discussion > > > |
From: Travis O. <oli...@ee...> - 2006-10-17 19:21:39
|
Ah!, I get it. You want to be able to reset to the C-defined array_repr function. The one that gets over-written on import. That makes sense. And is definitely do-able. Please file a ticket. -Travis |
From: Travis O. <oli...@ee...> - 2006-10-17 19:19:46
|
Lisandro Dalcin wrote: >On 10/17/06, Travis Oliphant <oli...@ee...> wrote: > > >>Or you can use the Python C-API >> >>const char *buffer; >>Py_ssize_t buflen; >> >>PyObject_AsReadBuffer(scalar, (const void **)&buffer, &buflen) >> >>to retrieve a pointer to the data in buffer and the size of the data in >>buflen. >> >> >> > >Travis. Have numpy something similar to a mutable scalar, or the only >way is using an array whit only one element? > > 0-dim arrays are still mutable scalars. -Travis |
From: Charles R H. <cha...@gm...> - 2006-10-17 19:10:56
|
On 10/13/06, Stefan van der Walt <st...@su...> wrote: > > Hi all, > > I've noticed that 'astype' always forces a copy. Is this > behaviour intended? It seems to conflict with 'asarray', that > tries to avoid a copy. > > For example, when wrapping code in ctypes, the following snippet > would have been useful: > > def foo(x): > # ensure x is an array of the right type > x = N.ascontiguousarray(x).astype(N.intc) > > but that will cause a copy, so you'll have to do > > def foo(x): > try: > x = N.ascontiguousarray(x,N.intc) > except: > x = N.ascontiguousarray(x).astype(N.intc) This seems to work now: In [21]: a Out[21]: array([[ 1., 2.], [ 3., 4.]]) In [22]: ascontiguousarray(a, dtype=int) Out[22]: array([[1, 2], [3, 4]]) Chuck |