Beispiel #1
0
def polar(invert=False, fisheye=1, radius=2 ** 0.5, *args, **kwargs):
    if invert:
        if fisheye == 1:
            return map_coordinates.__call__("numpy.abs(x)/" + str(radius) + "+1J*((numpy.angle(x))/(2*numpy.pi))")
        else:
            return map_coordinates.__call__(
                "(numpy.abs(x)/" + str(radius) + ")**" + str(fisheye) + "+1J*((numpy.angle(x))/(2*numpy.pi))"
            )
    else:
        if fisheye == 1:
            return map_coordinates.__call__("numpy.real(x)*numpy.exp(1J*2*numpy.pi*numpy.imag(x))*" + str(radius))
        else:
            return map_coordinates.__call__(
                "numpy.real(x)**" + str(1.0 / fisheye) + "*numpy.exp(1J*2*numpy.pi*numpy.imag(x))*" + str(radius)
            )
Beispiel #2
0
def rand_rotation(amount=30,random_generator=lambda amount:numpy.random.normal(0,amount/100*numpy.pi)):
    return map_coordinates.__call__("x*numpy.exp(1J*%f)"%(random_generator(amount=30)))