示例#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
示例#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
示例#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
    #
    #
    #
示例#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")
示例#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")
示例#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
示例#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
示例#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
    #
    #
    #