Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-02 Thread Stephan Hoyer
On Thu, Nov 2, 2017 at 3:35 PM Nathan Goldbaum wrote: > Ah, but what if the dtype modifies the interface? That might sound evil, > but it's something that's been proposed. For example, if I wanted to > replace yt's YTArray in a backward compatibile way with a dtype and just > use plain ndarrays e

Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-02 Thread Stephan Hoyer
Maybe the best of both worlds would require explicit opt-in for classes that shouldn't be coerced, e.g., xarray.register_data_type(MyArray) or maybe better yet ;) xarray.void_my_nonexistent_warranty_its_my_fault_if_my_buggy_duck_array_breaks_everything(MyArray) On Thu, Nov 2, 2017 at 3:39 PM Mart

Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-02 Thread Marten van Kerkwijk
I guess my argument boils down to it being better to state that a function only accepts arrays and happily let it break on, e.g., matrix, than use `asarray` to make a matrix into an array even though it really isn't. I do like the dtype ideas, but think I'd agree they're likely to come with their

Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-02 Thread Nathan Goldbaum
On Thu, Nov 2, 2017 at 5:21 PM, Stephan Hoyer wrote: > On Thu, Nov 2, 2017 at 12:42 PM Nathan Goldbaum > wrote: > >> Would this issue be ameliorated given Nathaniel's proposal to try to move >> away from subclasses and towards storing data in dtypes? Or would that just >> mean that xarray would

Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-02 Thread Stephan Hoyer
On Thu, Nov 2, 2017 at 12:42 PM Nathan Goldbaum wrote: > Would this issue be ameliorated given Nathaniel's proposal to try to move > away from subclasses and towards storing data in dtypes? Or would that just > mean that xarray would need to ban dtypes it doesn't know about? > Yes, I think custo

Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-02 Thread josef . pktd
On Thu, Nov 2, 2017 at 5:09 PM, Benjamin Root wrote: > Duck typing is great and all for classes that implement some or all of the > ndarray interface but remember what the main reason for asarray() and > asanyarray(): to automatically promote lists and tuples and other > "array-likes" to ndar

Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-02 Thread Marten van Kerkwijk
On Thu, Nov 2, 2017 at 5:09 PM, Benjamin Root wrote: > Duck typing is great and all for classes that implement some or all of the > ndarray interface but remember what the main reason for asarray() and > asanyarray(): to automatically promote lists and tuples and other > "array-likes" to ndarr

Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-02 Thread Benjamin Root
Duck typing is great and all for classes that implement some or all of the ndarray interface but remember what the main reason for asarray() and asanyarray(): to automatically promote lists and tuples and other "array-likes" to ndarrays. Ignoring the use-case of lists of lists is problematic at

Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-02 Thread Marten van Kerkwijk
My 2ยข here is that all code should feel free to assume certain type of input, as long as it is documented properly, but there is no reason to enforce that by, e.g., putting `asarray` everywhere. Then, for some pieces ducktypes and subclasses will just work like magic, and uses you might never have

Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-02 Thread Matthew Harrigan
Numpy already does support a specific unit, datetime64 and timedelta64, think through that very mechanism. Its also probably the most complicated unit since at least there is no such thing as leap meters. And it works well and is very useful IMHO On Thu, Nov 2, 2017 at 3:40 PM, Nathan Goldbaum

[Numpy-discussion] Python @ FOSDEM 2018

2017-11-02 Thread Pierre de Buyl
Dear SciPythonists and NumPythonists, FOSDEM is a free event for software developers to meet, share ideas and collaborate. Every year, 6500+ of developers of free and open source software from all over the world gather at the event in Brussels. Every year, 6500+ of developers of free and open sou

Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-02 Thread Nathan Goldbaum
On Thu, Nov 2, 2017 at 2:37 PM, Stephan Hoyer wrote: > On Thu, Nov 2, 2017 at 9:45 AM wrote: > >> similar, scipy.special has ufuncs >> what units are those? >> >> Most code that I know (i.e. scipy.stats and statsmodels) does not use only >> "normal mathematical operations with ufuncs" >> I guess

Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-02 Thread Stephan Hoyer
On Thu, Nov 2, 2017 at 9:45 AM wrote: > similar, scipy.special has ufuncs > what units are those? > > Most code that I know (i.e. scipy.stats and statsmodels) does not use only > "normal mathematical operations with ufuncs" > I guess there are a lot of "abnormal" mathematical operations > where j

Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-02 Thread josef . pktd
On Thu, Nov 2, 2017 at 2:39 PM, Marten van Kerkwijk < m.h.vankerkw...@gmail.com> wrote: > Hi Josef, > > Indeed, for some applications one would like to have different units > for different parts of an array. And that means that, at present, the > quantity implementations that we have are no good a

Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-02 Thread Marten van Kerkwijk
Hi Josef, Indeed, for some applications one would like to have different units for different parts of an array. And that means that, at present, the quantity implementations that we have are no good at storing, say, a covariance matrix involving parameters with different units, where thus each ele

Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-02 Thread josef . pktd
On Thu, Nov 2, 2017 at 12:46 PM, Ryan May wrote: > On Thu, Nov 2, 2017 at 6:56 AM, wrote: > >> On Thu, Nov 2, 2017 at 8:46 AM, wrote: >> >>> On Wed, Nov 1, 2017 at 6:55 PM, Nathan Goldbaum >>> wrote: >>> I think the biggest issues could be resolved if __array_concatenate__ were finis

Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-02 Thread josef . pktd
On Thu, Nov 2, 2017 at 12:23 PM, Ryan May wrote: > On Thu, Nov 2, 2017 at 6:46 AM, wrote: > >> >> >> On Wed, Nov 1, 2017 at 6:55 PM, Nathan Goldbaum >> wrote: >> >>> I think the biggest issues could be resolved if __array_concatenate__ >>> were finished. Unfortunately I don't feel like I can ta

Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-02 Thread Ryan May
On Thu, Nov 2, 2017 at 6:56 AM, wrote: > On Thu, Nov 2, 2017 at 8:46 AM, wrote: > >> On Wed, Nov 1, 2017 at 6:55 PM, Nathan Goldbaum >> wrote: >> >>> I think the biggest issues could be resolved if __array_concatenate__ >>> were finished. Unfortunately I don't feel like I can take that on right

Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-02 Thread josef . pktd
On Thu, Nov 2, 2017 at 11:51 AM, Marten van Kerkwijk < m.h.vankerkw...@gmail.com> wrote: > Hi Josef, > > astropy's Quantity is well developed and would give similar results to > pint; all those results make sense if one wants to have consistent > units. A general library code will actually do the

Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-02 Thread Ryan May
On Thu, Nov 2, 2017 at 6:46 AM, wrote: > > > On Wed, Nov 1, 2017 at 6:55 PM, Nathan Goldbaum > wrote: > >> I think the biggest issues could be resolved if __array_concatenate__ >> were finished. Unfortunately I don't feel like I can take that on right now. >> >> See Ryan May's talk at scipy abou

Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-02 Thread Marten van Kerkwijk
Hi Josef, astropy's Quantity is well developed and would give similar results to pint; all those results make sense if one wants to have consistent units. A general library code will actually do the right thing as long as it just uses normal mathematical operations with ufuncs - and as long as it

Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-02 Thread josef . pktd
On Thu, Nov 2, 2017 at 8:46 AM, wrote: > > > On Wed, Nov 1, 2017 at 6:55 PM, Nathan Goldbaum > wrote: > >> I think the biggest issues could be resolved if __array_concatenate__ >> were finished. Unfortunately I don't feel like I can take that on right now. >> >> See Ryan May's talk at scipy abou

Re: [Numpy-discussion] is __array_ufunc__ ready for prime-time?

2017-11-02 Thread josef . pktd
On Wed, Nov 1, 2017 at 6:55 PM, Nathan Goldbaum wrote: > I think the biggest issues could be resolved if __array_concatenate__ were > finished. Unfortunately I don't feel like I can take that on right now. > > See Ryan May's talk at scipy about using an ndarray subclass for units and > the issues