Transformation compatible with scipy