Careful copy of numpy array; np.array(oldarray).copy() seems not safe for array with .T (transpose). So instead of .copy(), more explicit way is used: np.array(oldarray, dtype='some', order='C')