BUG: adapt to numpy > 1.8

np.diag is not writeable in recent numpy versions