On 9 February 2013 00:12, Jaime Fernández del Río <jaime.f...@gmail.com> wrote:
> TypeError: array cannot be safely cast to required type

With version 1.7.rc1

TypeError: Cannot cast array data from dtype('uint16') to
dtype('uint8') according to the rule 'safe'.


I have also tried with bigger values of lut, being it uint32, so, when
they are casted to uint16 they are modified, and it will do it without
complaining:


>>> lut = np.random.randint(256000, size=(65536,)).astype('uint16')
>>> arr = np.random.randint(65536, size=(1000, 1000)).astype('uint16')
>>> np.take(lut, arr, out=arr)
>>> arr.dtype
dtype('uint16')
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to