I have a function that modifies an input array dtype if necessary:
def f(ar,dtype): if ar.dtype!=dtype: ar = ar.astype(dtype)
Th