Example #1
0
def test_rotate():
    d = create_shape((101, 102, 103))
    out = rotate(d, (1, 1, 1),
                 angle=.4,
                 center=(10, 10, 10),
                 interpolation="linear")
    return out
Example #2
0
def test_modes():
    d = create_shape((101,101,101))
    outs = []
    for mode in ("constant","edge","wrap"):
        for interp in ("linear", "nearest"):
            print(interp, mode)
            outs.append(rotate(d, axis= (0, 1, 0), angle = 0.4, mode = mode, interpolation=interp))
    return outs
Example #3
0
    x = dx*(np.arange(-Nx/2, Nx/2)+.5)
    y = dx*(np.arange(-Nx/2, Nx/2)+.5)
    z = dx*(np.arange(-Nz/2, Nz/2)+.5)

    Z,Y,X = np.meshgrid(z,y,x,indexing="ij")

    Z,X = np.cos(w)*Z-np.sin(w)*X, np.cos(w)*X+np.sin(w)*Z

    dn = dn0*(Z>0)

    u0 = psf_u0((Nx,Nx), units = (dx,)*2,zfoc = dx*(Nz-1.)/2.,lam = lam, NA= NA)

    u = bpm_3d((Nx,Nx,Nz), units=(dx,)*3, lam=lam, dn =dn,
               u0=u0)

    u1 = np.abs(u[:Nz/2,...])[::-1,...]**2
    u2 = gputools.rotate(abs(u[Nz/2:,...])**2, center = (0,Nx/2,Nx/2),
                         axis = (0.,1.,0),
                         angle = phi(dn0,w),
                         mode = "linear")

    pylab.figure(1)
    pylab.clf()
    pylab.plot(u1[Nz/10,Nx/2,:])
    pylab.plot(u2[Nz/10,Nx/2,:])

    # return u, u0
    #
    #
    #
Example #4
0
def test_rotate():
    d = np.zeros((100,100,100),np.float32)
    rotate(d, (10,10,10), (1,1,1), angle = .4, mode="linear")
Example #5
0
def test_rotate():
    d = np.zeros((100, 100, 100), np.float32)
    rotate(d, (10, 10, 10), (1, 1, 1), angle=.4, interp="linear")
Example #6
0
def test_rotate(angle=  .4, axis = (1,0,0), interpolation = "linear"):
    x = create_shape((100,110,120))
    y = rotate(x,angle = angle, axis = axis, interpolation =interpolation)
    return x, y
Example #7
0
def test_rotate():
    d = create_shape((101,102,103))
    out = rotate(d, (10,10,10), (1,1,1), angle = .4, mode="linear")
    return out
Example #8
0
    Z, Y, X = np.meshgrid(z, y, x, indexing="ij")

    Z, X = np.cos(w) * Z - np.sin(w) * X, np.cos(w) * X + np.sin(w) * Z

    dn = dn0 * (Z > 0)

    u0 = psf_u0((Nx, Nx),
                units=(dx, ) * 2,
                zfoc=dx * (Nz - 1.) / 2.,
                lam=lam,
                NA=NA)

    u = bpm_3d((Nx, Nx, Nz), units=(dx, ) * 3, lam=lam, dn=dn, u0=u0)

    u1 = np.abs(u[:Nz / 2, ...])[::-1, ...]**2
    u2 = gputools.rotate(abs(u[Nz / 2:, ...])**2,
                         center=(0, Nx / 2, Nx / 2),
                         axis=(0., 1., 0),
                         angle=phi(dn0, w),
                         mode="linear")

    pylab.figure(1)
    pylab.clf()
    pylab.plot(u1[Nz / 10, Nx / 2, :])
    pylab.plot(u2[Nz / 10, Nx / 2, :])

    # return u, u0
    #
    #
    #