def gaussian_xy_high(x, y, dd = ddh): cenx, ceny = angle2xy(twoTheta0, Chi0, dd = dd) two_Theta, Chi = xy2angle(x - sizex/2 + cenx, y - sizey/2 + ceny, dd = dd) two_theta, _chi = two_Theta * D2R, Chi * D2R return gaussian(two_theta, _chi)
D2R = pi/180. R2D = 180./pi #fig = pylab.figure() #ax = Axes3D(fig) hklfit = np.load('hklfit.npy').item() hklxy = np.load('hkl_xy.npy').item() hkl = hklfit.keys()[0] alpha = hklfit[hkl][0] x0, y0 = hklxy[hkl] sizex, sizey = 31, 31 himage, limage = np.zeros((sizex, sizey)), np.zeros((sizex, sizey)) twoTheta0, Chi0 = xy2angle(x0, y0) twotheta0, chi0 = twoTheta0 * D2R, Chi0 * D2R FWHMx, FWHMy, xi, Imax = 0.003, 0.0028, 0., 1700. full2theta, minchi, maxchi = pi, -pi, pi sqcosxi, sin2xi, coef = pow(cos(xi), 2), sin(2*xi), 8*log(2) sqsinxi = 1-sqcosxi coefx, coefy = coef/pow(FWHMx, 2), coef/pow(FWHMy, 2) A, B, C = (sqcosxi*coefx+sqsinxi*coefy)/2, sin2xi*(coefy-coefx)/4, (sqcosxi*coefy+sqsinxi*coefx)/2 gaussian = lambda x, y: Imax*exp(-(A*(x-twotheta0)**2+2*B*(x-twotheta0)*(y-chi0)+C*(y-chi0)**2)) dd = 59.836 expe, var = np.load('exp_var.npy')[0: 2] def gen_prototype(sizex, sizey, ddh = dd * 2, ddl = dd):