[Numpy-discussion] hstack(arr_Int32, arr_float32) fails because of casting rules

Sebastian Haase haase at msg.ucsf.edu
Thu Aug 24 19:09:48 CDT 2006


Hi,
I get
TypeError: array cannot be safely cast to required type

when calling hstack()  ( which calls  concatenate() )
on two arrays being a int32 and a float32 respectively.

I understand now that a int32 cannot be safely converted into a float32
but why does  concatenate  not automatically
up(?) cast to float64  ??

Is this really required to be done *explicitly* every time ?  
** In general it makes float32 cubersome to use. **

(
Background:  my large image data is float32 (float64 would require too much 
memory)  and the hstack call happens inside scipy plt module when I try to 
get a 1d line profile and the "y_data" is hstack'ed with the x-axis values 
(int32))
)

Thanks,
Sebastian Haase




More information about the Numpy-discussion mailing list