Re: [Numpy-discussion] Numpy 1.3 release date ?
what about fixing http://scipy.org/scipy/scipy/ticket/812 ? this is actually a scipy-numpy compatibility problem, where numpy is wrong IMO. it is a one-line fix, I think. thank you! tiziano ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
[Numpy-discussion] help writing an array subtype
I'm embedded python (and numpy) is a C++ app and I'm trying to access my array data in numpy but I'm not sure where to start. Due to data sizes, I don't have access to the entire array contiguously, my app implements a virtual memory like paging system where variable sized pages of data are brought into memory on demand. Each page has a contiguous block of data containing at least the requested piece of the array (if it's more, it's arranged so the appropriate data can be accessed with strides). I'd like to load pages when they are accessed in an ndarray and when a new view is requested. I was thinking of loading and holding the most recently accessed page of the array on a per view basis. (i.e. if a view is created it can access a different part of the array from the original array) I've ready over the documentation on subclassing ndarray but there's a lot of information there and I'm not quite sure the best place to start. Could someone point me in the right direction or perhaps offer a better solution? ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
[Numpy-discussion] Argsort
Hi, Ok, what am I missing here: x = np.array([[4,2],[5,3]]) x[x.argsort(1)] array([[[5, 3], [4, 2]], [[5, 3], [4, 2]]]) I was expecting: array([[2,4],[3,5]]) Certainly not a 3D array. What am I doing wrong? Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
[Numpy-discussion] PEP: named axis (was: Selection of only a certain number of fields)
On Thu, Feb 05, 2009 at 05:08:49PM -0600, Travis E. Oliphant wrote: I've been fairly quiet on this list for awhile due to work and family schedule, but I think about how things can improve regularly.One feature that's been requested by a few people is the ability to select multiple fields from a structured array. Hey Travis, I have no opinion on the above, as I don't have this use case. However, as you are talking about implementing something, I jump on the occasion to suggest another gadget, slightly related: I would like named axis. Suppose you have a 5D array, I would like to be able to give each axis names, eg (to chose an example you might be familiar with) ('Frontal', 'Lateral', 'Axial', 'Time', 'Subjects'). And if this could be understood be numpy operations (say ufuncs and fancy indexing) so that I could do (a is my 5D array): b = a.mean(axis='Time') b.axis ('Frontal', 'Lateral', 'Axial', 'Subjects') I believe this would make a big difference for people working with n-dimensional arrays, where n is large. I do realize this is probably a lot of work, this is why I had been refraining from mentioning it. I don't feel I can implement this. Cheers, Gaël ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Selection of only a certain number of fields
On Feb 5, 2009, at 6:08 PM, Travis E. Oliphant wrote: Hi all, I've been fairly quiet on this list for awhile due to work and family schedule, but I think about how things can improve regularly.One feature that's been requested by a few people is the ability to select multiple fields from a structured array. [...] +1 for #2. Note that we now have a drop_fields function in np.lib.recfunctions, a reimplementation of the equivalent function in matplotlib. It works along the lines of your proposition #1 (create a new array w/ a new dtype and fill it) ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] numscons/numpy.distutils bug related to MACOSX_DEPLOYMENT_TARGET
Robert, Can you have a look at the following fix and see if it is satisfactory? http://github.com/ellisonbg/numpy/blob/81360e93968968dc9dcbafd7895da7cec5015a3c/numpy/distutils/fcompiler/gnu.py Brian On Tue, Feb 3, 2009 at 9:32 PM, Robert Kern robert.k...@gmail.com wrote: On Tue, Feb 3, 2009 at 23:22, Brian Granger ellisonbg@gmail.com wrote: 1) Trust the environment variable if given and let distutils raise its error message (why not raise it ourselves? distutils' error message and explanation is already out in THE GOOGLE.) 2) Otherwise, use the value in the Makefile if it's there. 3) If it's not even in the Makefile for whatever reason, go with 10.3. Sounds good, do you want to me work up a patch? Yes, please. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Selection of only a certain number of fields
Pierre GM wrote: On Feb 5, 2009, at 6:08 PM, Travis E. Oliphant wrote: Hi all, I've been fairly quiet on this list for awhile due to work and family schedule, but I think about how things can improve regularly.One feature that's been requested by a few people is the ability to select multiple fields from a structured array. [...] +1 for #2. Note that we now have a drop_fields function in np.lib.recfunctions, a reimplementation of the equivalent function in matplotlib. It works along the lines of your proposition #1 (create a new array w/ a new dtype and fill it) After more thought, I think I was too eager in my suggestion of #2. It's actually not really possible to do a view the way I would want it to work. It would be possible to create a data-type with hidden-fields, but a copy would be not get rid of the extra data. Thus newarr = arr[['name', 'age']].copy() would be exactly the same size as arr because elements are copied wholesale and each row is a single element in the NumPy array.Some infrastructure would have to be implemented at a fundamental level to handle partial-element manipulation similar at least in spirit to what is needed to handle bit-level striding on a fundamental level. Also, I don't remember if we resolved how hidden fields would be shown in the array interface. So, I think that we may be stuck with #1 which at least is consistent with the fancy-indexing is a copy pattern (and is just syntatic sugar for capability you've already implemented in recfunctions). -Travis ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] numscons/numpy.distutils bug related to MACOSX_DEPLOYMENT_TARGET
On Thu, Feb 5, 2009 at 22:00, Brian Granger ellisonbg@gmail.com wrote: Robert, Can you have a look at the following fix and see if it is satisfactory? http://github.com/ellisonbg/numpy/blob/81360e93968968dc9dcbafd7895da7cec5015a3c/numpy/distutils/fcompiler/gnu.py Looks good. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] PEP: named axis
Gael Varoquaux wrote: On Thu, Feb 05, 2009 at 05:08:49PM -0600, Travis E. Oliphant wrote: I've been fairly quiet on this list for awhile due to work and family schedule, but I think about how things can improve regularly.One feature that's been requested by a few people is the ability to select multiple fields from a structured array. Hey Travis, I have no opinion on the above, as I don't have this use case. However, as you are talking about implementing something, I jump on the occasion to suggest another gadget, slightly related: I would like named axis. Suppose you have a 5D array, I would like to be able to give each axis names, eg (to chose an example you might be familiar with) ('Frontal', 'Lateral', 'Axial', 'Time', 'Subjects'). And if this could be understood be numpy operations (say ufuncs and fancy indexing) so that I could do (a is my 5D array): This could be implemented but would require adding information to the NumPy array. I've been thinking for a long time that we ought to add a dictionary attribute to the NumPy array (i.e. a new member to the PyArrayObject data-structure). A lot of subclasses of NumPy arrays just add meta-information that could be stored there. Then, it would be a trivial thing to check to see if the dictionary had say an axis_mapping keyword and if so then do the conversions found there. I think this has been brought up before, though. What do people think about adding a default dictionary to every instance of a NumPy array. The question that always arises in this context which I don't have good answers for is what do you do with the dictionary on the output of ufuncs? One approach is to always return NULL for the dictionary and don't try and guess. A slightly different one is to at least handle the case where all inputs have the same dictionary and return a new shallow copy of that. -Travis ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] numscons/numpy.distutils bug related to MACOSX_DEPLOYMENT_TARGET
Great, what is the best way of rolling this into numpy? Brian On Thu, Feb 5, 2009 at 8:13 PM, Robert Kern robert.k...@gmail.com wrote: On Thu, Feb 5, 2009 at 22:00, Brian Granger ellisonbg@gmail.com wrote: Robert, Can you have a look at the following fix and see if it is satisfactory? http://github.com/ellisonbg/numpy/blob/81360e93968968dc9dcbafd7895da7cec5015a3c/numpy/distutils/fcompiler/gnu.py Looks good. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] PEP: named axis
On Thu, Feb 5, 2009 at 22:17, Travis Oliphant oliph...@enthought.com wrote: Gael Varoquaux wrote: On Thu, Feb 05, 2009 at 05:08:49PM -0600, Travis E. Oliphant wrote: I've been fairly quiet on this list for awhile due to work and family schedule, but I think about how things can improve regularly.One feature that's been requested by a few people is the ability to select multiple fields from a structured array. Hey Travis, I have no opinion on the above, as I don't have this use case. However, as you are talking about implementing something, I jump on the occasion to suggest another gadget, slightly related: I would like named axis. Suppose you have a 5D array, I would like to be able to give each axis names, eg (to chose an example you might be familiar with) ('Frontal', 'Lateral', 'Axial', 'Time', 'Subjects'). And if this could be understood be numpy operations (say ufuncs and fancy indexing) so that I could do (a is my 5D array): This could be implemented but would require adding information to the NumPy array. More than that, though. Every function and method that takes an axis or reduces an axis will need to be rewritten. For that reason, I'm -1 on the proposal. I've been thinking for a long time that we ought to add a dictionary attribute to the NumPy array (i.e. a new member to the PyArrayObject data-structure). A lot of subclasses of NumPy arrays just add meta-information that could be stored there. Then, it would be a trivial thing to check to see if the dictionary had say an axis_mapping keyword and if so then do the conversions found there. I think this has been brought up before, though. What do people think about adding a default dictionary to every instance of a NumPy array. The question that always arises in this context which I don't have good answers for is what do you do with the dictionary on the output of ufuncs? One approach is to always return NULL for the dictionary and don't try and guess. A slightly different one is to at least handle the case where all inputs have the same dictionary and return a new shallow copy of that. I'm of the opinion that it should never guess. We have no idea what semantics are being placed on the dict. Even in the case where all of the inputs have the same dict, the operation may easily invalidate the metadata. For example, a reduction on one of these axis-decorated arrays would make the axis labels incorrect. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] PEP: named axis
Travis Oliphant wrote: What do people think about adding a default dictionary to every instance of a NumPy array. It sound kind of heavyweight to me. I tend to use lots of small arrays (to represent an x,y point, for instance). There are enough performance issues with that as it stands. Maybe an empty dict isn't much, but it is extra. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/ORR/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] PEP: named axis (was: Selection of only a certain number of fields)
+1 On Feb 6, 2009 12:16 AM, Gael Varoquaux gael.varoqu...@normalesup.org wrote: On Thu, Feb 05, 2009 at 05:08:49PM -0600, Travis E. Oliphant wrote: I've been fairly quiet on this list for awhile due to work and family schedule, but I think about how things can improve regularly.One feature that's been requested by a few people is the ability to select multiple fields from a structured array. Hey Travis, I have no opinion on the above, as I don't have this use case. However, as you are talking about implementing something, I jump on the occasion to suggest another gadget, slightly related: I would like named axis. Suppose you have a 5D array, I would like to be able to give each axis names, eg (to chose an example you might be familiar with) ('Frontal', 'Lateral', 'Axial', 'Time', 'Subjects'). And if this could be understood be numpy operations (say ufuncs and fancy indexing) so that I could do (a is my 5D array): b = a.mean(axis='Time') b.axis ('Frontal', 'Lateral', 'Axial', 'Subjects') I believe this would make a big difference for people working with n-dimensional arrays, where n is large. I do realize this is probably a lot of work, this is why I had been refraining from mentioning it. I don't feel I can implement this. Cheers, Gaël ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Selection of only a certain number of fields
A Friday 06 February 2009, Travis Oliphant escrigué: Pierre GM wrote: On Feb 5, 2009, at 6:08 PM, Travis E. Oliphant wrote: Hi all, I've been fairly quiet on this list for awhile due to work and family schedule, but I think about how things can improve regularly.One feature that's been requested by a few people is the ability to select multiple fields from a structured array. [...] +1 for #2. Note that we now have a drop_fields function in np.lib.recfunctions, a reimplementation of the equivalent function in matplotlib. It works along the lines of your proposition #1 (create a new array w/ a new dtype and fill it) After more thought, I think I was too eager in my suggestion of #2. It's actually not really possible to do a view the way I would want it to work. It would be possible to create a data-type with hidden-fields, but a copy would be not get rid of the extra data. Thus newarr = arr[['name', 'age']].copy() would be exactly the same size as arr because elements are copied wholesale and each row is a single element in the NumPy array.Some infrastructure would have to be implemented at a fundamental level to handle partial-element manipulation similar at least in spirit to what is needed to handle bit-level striding on a fundamental level. Also, I don't remember if we resolved how hidden fields would be shown in the array interface. So, I think that we may be stuck with #1 which at least is consistent with the fancy-indexing is a copy pattern (and is just syntatic sugar for capability you've already implemented in recfunctions). Mmh, I'd also vote for #2 for performance reasons, but as the implementation seems quite involved, I suppose that #1 would be great too. Cheers, -- Francesc Alted ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion