[Numpy-discussion] use of concatenate with subclass of ndarray

Bryce Hendrix bhendrix@enthought....
Thu Mar 29 13:12:49 CDT 2007


Yeah, I think we may need to write some custom wrapper functions for the 
functions we use which don't call __new__. I don't really see another 
way around it since by the time __array_finalize__ gets called there are 
no units and the problems with mixed units.

bryce

Pierre GM wrote:
> On Thursday 29 March 2007 13:47:48 Bryce Hendrix wrote:
>   
>> doh! I followed the example on the Wiki which does not define the class
>> attribute in the class scope, but in __new__. Adding the declaration to
>> the class scope seems to work.
>>     
>
> Yeah, sorry about that, I really should update this wiki page. I gonna try 
> later this afternoon/evening.
> Glad it works, though.
>
> However, that only part of your problem:
> With concatenate, what unit should take precedence ? In your example, 
> concatenating unit_ary_1 and unit_ary_2 should give a unit_array w/ meters as 
> units. But what if you concatenate unit_1 and unit_3 ? Meters or feet ?
>
> The idea would be to write a custom concatenate function, that would convert 
> the units of each argument to the unit of the first one (for example), and 
> call numpy.concatenate. Or something like that.
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20070329/c1f22452/attachment.html 


More information about the Numpy-discussion mailing list