[Numpy-discussion] type and kind for custom dtypes

2019-05-05 Thread Alex Samuel
Hi, I'm working on building a number of related custom dtypes, and I'm not sure how to set the type and kind fields in PyArray_Descr. I tried using type='V' and choosing a single unused kind for all my dtypes; this mostly worked, except I found that coercions would sometimes treat values of tw

Re: [Numpy-discussion] type and kind for custom dtypes

2019-05-05 Thread Alex Samuel
> On May 5, 2019, at 10:58, Alex Samuel wrote: > > Through trial and error, I've found that if I choose an unused type code for > each dtype, coercion seems to work as I expect it to (no coercion unless I've > provided a cast). The kind doesn't seem to matte

Re: [Numpy-discussion] type and kind for custom dtypes

2019-05-06 Thread Alex Samuel
Thanks very much for looking into this! > The reason is that when the "kind" and "itemsize" and "byte order" are > identical, the numpy code decides that data types can be cast (because > they are equivalent). So basically, the "kind" must not be equal unless > the "type"/dtype only differs in pre

Re: [Numpy-discussion] type and kind for custom dtypes

2019-05-06 Thread Alex Samuel
> We are now starting the progress of trying to improve the situation > with creating custom dtypes. > There will actually be discussions about this end of next week (in > Berkeley). But in any case I would be very interested in your specific > use-case and needs, and hopefully we can help you also

[Numpy-discussion] casting from datetime64

2019-05-12 Thread Alex Samuel
Hi, When registering a custom cast function from datetime64 to another dtype, how can I get the units? I am calling PyArray_RegisterCastFunc from NPY_DATETIME. Ideally, I'd like to register a separate cast function for each datetime64 units (or none at all... I don't want all units to be casta

Re: [Numpy-discussion] casting from datetime64

2019-05-13 Thread Alex Samuel
e I could duplicate the struct layout in my own code to fish out the field I need. Obviously, compatibility is my own problem then. Regards, Alex On Mon, May 13, 2019, at 01:31, Sebastian Berg wrote: > Hi Alex, > > On Mon, 2019-05-13 at 00:35 -0400, Alex Samuel wrote: > > Hi, >