xx, yy = np.meshgrid(x, y)

my = np.sin(2 * pi * xx / l)
mz = np.cos(2 * pi * xx / l)
mx = np.zeros_like(my)

mwx = fi.window_image(mx, power=1 / 20)
mwy = fi.window_image(my, power=1 / 20)
mwz = fi.window_image(mz, power=1 / 20)
h, _, _, _ = sfct.stray_field_calc_thick(mx, my, mz, Ms, t, size, height)

flen = len(h[0])

fx = np.linspace(-size / 2, size / 2, flen, endpoint=False)

bx, bz = helix_field(fx, height)

plt.close('all')

fig1, ax1 = plt.subplots()
plt.plot(fx, h[0][int(flen / 2), :])
plt.plot(fx, bx)

fig1, ax1 = plt.subplots()
plt.plot(fx, h[2][int(flen / 2), :])
plt.plot(fx, bz)

fp.format_plots(plt)

plt.show()
示例#2
0
    #    bz0list[2*j] = popt[4]
    #    bz0list[2*j+1] = rpopt[4]

    plt.figure(1)
    csubplot = plt.subplot(gs[(j % 5), int(np.floor(j / 5) * 2)])
    plt.plot(xFit, cal_func(xFit, *guess), 'g-')
    plt.errorbar(x, y, yerr=ye, color='#000000', fmt='.')
    plt.plot(xFit, cal_func(xFit, *popt), 'r-')
    csubplot = plt.subplot(gs[(j % 5), int(np.floor(j / 5) * 2 + 1)])
    plt.plot(xFit, cal_func(xFit, *rguess), 'g-')
    plt.errorbar(x, ry, yerr=rye, color='#000000', fmt='.')
    plt.plot(xFit, cal_func(xFit, *rpopt), 'r-')

snum = 9
fig, ax = plt.subplots()
plt.plot(xFit, cal_func(xFit, *fits[snum]))
plt.errorbar(x, yShorts[snum], yerr=yeShorts[snum], color='#000000', fmt='.')

fp.format_plots(plt, small=False)
plt.show()

print('h mean = ' + str(np.mean(hlist)) + ' +/- ' + str(np.std(hlist)))
# print('theta mean = '+str(np.mean(thetalist))+' +/- '+str(np.std(thetalist)))
# print('phi mean = '+str(np.mean(philist))+' +/- '+str(np.std(philist)))
print('edge width mean = ' + str(np.mean(dwlist)) + ' +/- ' +
      str(np.std(dwlist)))

print("r2 mean = " + str(np.mean(r2list)))

#print('bz0 mean = '+str(np.mean(bz0list))+' +/- '+str(np.std(bz0list)))