Changeset 1087 for trunk/GSASIIstrMath.py
 Timestamp:
 Oct 7, 2013 12:30:10 PM (8 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIIstrMath.py
r1078 r1087 18 18 import numpy.linalg as nl 19 19 import scipy.optimize as so 20 import scipy.stats as st 20 21 import GSASIIpath 21 22 GSASIIpath.SetVersionNumber("$Revision$") … … 1876 1877 Limits = calcControls[hfx+'Limits'] 1877 1878 x,y,w,yc,yb,yd = Histogram['Data'] 1878 W = wtFactor*w1879 1879 yc *= 0.0 #zero full calcd profiles 1880 1880 yb *= 0.0 … … 1882 1882 xB = np.searchsorted(x,Limits[0]) 1883 1883 xF = np.searchsorted(x,Limits[1]) 1884 yc[xB:xF],yb[xB:xF] = getPowderProfile(parmDict,x[xB:xF], 1885 varylist,Histogram,Phases,calcControls,pawleyLookup) 1886 yc[xB:xF] += yb[xB:xF] 1887 if not np.any(y): #fill dummy data 1888 rv = st.poisson(yc[xB:xF]) 1889 y[xB:xF] = rv.rvs() 1890 w[xB:xF] = np.where(y[xB:xF]>0.,1./y[xB:xF],1.0) 1891 yd[xB:xF] = y[xB:xF]yc[xB:xF] 1892 W = wtFactor*w 1893 wdy = ma.sqrt(W[xB:xF])*(yd[xB:xF]) 1884 1894 Histogram['Residuals']['Nobs'] = ma.count(x[xB:xF]) 1885 1895 Nobs += Histogram['Residuals']['Nobs'] 1886 1896 Histogram['Residuals']['sumwYo'] = ma.sum(W[xB:xF]*y[xB:xF]**2) 1887 1897 SumwYo += Histogram['Residuals']['sumwYo'] 1888 yc[xB:xF],yb[xB:xF] = getPowderProfile(parmDict,x[xB:xF],1889 varylist,Histogram,Phases,calcControls,pawleyLookup)1890 yc[xB:xF] += yb[xB:xF]1891 yd[xB:xF] = y[xB:xF]yc[xB:xF]1892 wdy = ma.sqrt(W[xB:xF])*(yd[xB:xF])1893 1898 Histogram['Residuals']['R'] = min(100.,ma.sum(ma.abs(yd[xB:xF]))/ma.sum(y[xB:xF])*100.) 1894 1899 Histogram['Residuals']['wR'] = min(100.,ma.sqrt(ma.sum(wdy**2)/Histogram['Residuals']['sumwYo'])*100.)
Note: See TracChangeset
for help on using the changeset viewer.