def errFitZSS(values, ibrav, d, H, tth, wave, vec, Vref, Z, Zref): Zero = Z if Zref: Zero = values[-1] A = Values2A(ibrav, values) Vec = Values2Vec(ibrav, vec, Vref, values) Qo = 1. / d**2 Qc = G2lat.calc_rDsqZSS(H, A, Vec, Zero, tth, wave) return (Qo - Qc)
def errFitZSS(values,ibrav,d,H,tth,wave,vec,Vref,Z,Zref): Zero = Z if Zref: Zero = values[-1] A = Values2A(ibrav,values) Vec = Values2Vec(ibrav,vec,Vref,values) Qo = 1./d**2 Qc = G2lat.calc_rDsqZSS(H,A,Vec,Zero,tth,wave) return (Qo-Qc)
def ZSSfunc(values,peaks,dmin,Inst,SGData,SSGData,vec,Vref,maxH,A,wave,Z,dlg=None): Vec = Val2Vec(vec,Vref,values) HKL = G2pwd.getHKLMpeak(dmin,Inst,SGData,SSGData,Vec,maxH,A) Peaks = np.array(IndexSSPeaks(peaks,HKL)[1]).T Qo = 1./Peaks[-2]**2 Qc = G2lat.calc_rDsqZSS(Peaks[4:8],A,Vec,Z,Peaks[0],wave) chi = np.sum((Qo-Qc)**2) if dlg: dlg.Pulse() return chi
def refinePeaksZSS(peaks,wave,Inst,SGData,SSGData,maxH,ibrav,A,vec,vecRef,Zero,ZeroRef): 'needs a doc string' dmin = getDmin(peaks) OK,smin,Aref,Vref,Z,result = FitHKLZSS(wave,ibrav,peaks,A,vec,vecRef,Zero,ZeroRef) Peaks = np.array(peaks).T H = Peaks[4:8] Peaks[9] = 1./np.sqrt(G2lat.calc_rDsqZSS(H,Aref,Vref,Z,Peaks[0],wave)) #H,A,vec,Z,tth,lam peaks = Peaks.T HKL = G2pwd.getHKLMpeak(dmin,Inst,SGData,SSGData,Vref,maxH,Aref) M20,X20 = calc_M20SS(peaks,HKL) return len(HKL),M20,X20,Aref,Vref,Z
def refinePeaksZSS(peaks, wave, Inst, SGData, SSGData, maxH, ibrav, A, vec, vecRef, Zero, ZeroRef): 'needs a doc string' dmin = getDmin(peaks) OK, smin, Aref, Vref, Z, result = FitHKLZSS(wave, ibrav, peaks, A, vec, vecRef, Zero, ZeroRef) Peaks = np.array(peaks).T H = Peaks[4:8] Peaks[9] = 1. / np.sqrt( G2lat.calc_rDsqZSS(H, Aref, Vref, Z, Peaks[0], wave)) #H,A,vec,Z,tth,lam peaks = Peaks.T HKL = G2pwd.getHKLMpeak(dmin, Inst, SGData, SSGData, Vref, maxH, Aref) M20, X20 = calc_M20SS(peaks, HKL) return len(HKL), M20, X20, Aref, Vref, Z
def ZSSfunc(values, peaks, dmin, Inst, SGData, SSGData, vec, Vref, maxH, A, wave, Z, dlg=None): Vec = Val2Vec(vec, Vref, values) HKL = G2pwd.getHKLMpeak(dmin, Inst, SGData, SSGData, Vec, maxH, A) Peaks = np.array(IndexSSPeaks(peaks, HKL)[1]).T Qo = 1. / Peaks[-2]**2 Qc = G2lat.calc_rDsqZSS(Peaks[4:8], A, Vec, Z, Peaks[0], wave) chi = np.sum((Qo - Qc)**2) if dlg: dlg.Pulse() return chi