print(np.polynomial.polynomial.polyfit(loopRange[1:], ts[1:], 1))

if (True):
    ts = []
    for loop in loopRange:
        beads = []
        for i in range(loop):
            beads.append(N.Bead(50, 50))

        N.XY(beads, img)

        for i in range(20):
            N.Calibrate(beads, [imgc[i]], i)

        N.ComputeCalibration(beads)
        N.XYZ(beads, img)
        print(beads[0])

        start = time.time()
        for i in range(100):
            N.XYZ(beads, img)
        ts.append(time.time() - start)

    plt.plot(loopRange, np.array(ts), marker="o", label="CPU - Numpy")
    print(np.polynomial.polynomial.polyfit(loopRange[1:], ts[1:], 1))

plt.title("Time to run 100 frames")
plt.ylabel("Time(s)")
plt.xlabel("Bead Number")
plt.grid()
plt.legend()
Example #2
0
mm.SetZ(sz)
T.ComputeCalibration(beads)

plt.title('Calibration R')
plt.imshow(np.flip(beads[0].Rc, axis=0), cmap="gray")
plt.show()

# test
zts = np.arange(500, 4500, 50)
z0s = []
for z in zts:
    mm.SetZ(sz + z)
    for t in range(100):
        img = mm.Get()
        T.XYZ(beads, img)
        z0s.append(beads[0].z)

xs = []
ys = []
yerr = []
for i, z in enumerate(zts):
    x = sz + z
    data = z0s[i * 100:(i * 100 + 100)]
    xs.append(x)
    ys.append(np.mean(data) - x)
    yerr.append(np.std(data))

plt.plot(z0s, marker="o")
plt.grid()
plt.show()