Changeset 943
- Timestamp:
- Jun 5, 2013 2:38:00 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIImath.py
r942 r943 1928 1928 parmDict[pfx+'Amul'] = len(G2spc.GenAtom(XYZ,SGData)) 1929 1929 1930 def getRBparms(item,mfx,aTypes,RBdata, parmDict,varyList):1930 def getRBparms(item,mfx,aTypes,RBdata,atNo,parmDict,varyList): 1931 1931 parmDict[mfx+'MolCent'] = item['MolCent'] 1932 1932 parmDict[mfx+'RBId'] = item['RBId'] … … 1963 1963 lower.append(limits[0]) 1964 1964 upper.append(limits[1]) 1965 aTypes |= set(RBdata[item['Type']][item['RBId']]['rbTypes']) 1966 1967 def GetAtomFX(pfx,Natoms,parmDict): 1965 atypes = RBdata[item['Type']][item['RBId']]['rbTypes'] 1966 aTypes |= set(atypes) 1967 atNo += len(atypes) 1968 return atNo 1969 1970 def GetAtomTMX(pfx,RBdata,parmDict): 1968 1971 'Needs a doc string' 1969 Tdata = Natoms*[' ',] 1970 Mdata = np.zeros(Natoms) 1971 Fdata = np.zeros(Natoms) 1972 Xdata = np.zeros((3,Natoms)) 1972 atNo = parmDIct['atNo'] 1973 nfixAt = parmDict['nfixAt'] 1974 Tdata = atNo*[' ',] 1975 Mdata = np.zeros(atNo) 1976 Fdata = np.zeros(atNo) 1977 Xdata = np.zeros((3,atNo)) 1973 1978 keys = {'Atype:':Tdata,'Amul:':Mdata, 1974 1979 'Ax:':Xdata[0],'Ay:':Xdata[1],'Az:':Xdata[2]} 1975 for iatm in range(Natoms): 1980 nObjs = parmDict['nObjs'] 1981 for iatm in range(nfixAt): 1976 1982 for key in keys: 1977 1983 parm = pfx+key+str(iatm) … … 1980 1986 return Tdata,Mdata,Xdata 1981 1987 1982 # def mcsaSfCalc(refList, G,SGData,parmDict):1988 # def mcsaSfCalc(refList,RBdata,G,SGData,parmDict): 1983 1989 # ''' Compute structure factors for all h,k,l for phase 1984 1990 # input: … … 2036 2042 generalData = data['General'] 2037 2043 SGData = generalData['SGData'] 2038 pId = data['pId']2039 2044 fixAtoms = data['Atoms'] #if any 2040 2045 cx,ct,cs = generalData['AtomPtrs'][:3] … … 2052 2057 name = pfx+pstr[i] 2053 2058 parmDict[name] = atm[cx+i] 2054 atNo += 1 2059 atNo += 1 2060 parmDict['nfixAt'] = len(fixAtoms) 2055 2061 mcsaControls = generalData['MCSA controls'] 2056 2062 reflName = mcsaControls['Data source'] … … 2061 2067 for i,item in enumerate(MCSAObjs): 2062 2068 mfx = str(i)+':' 2069 parmDict[mfx+'Type'] = item['Type'] 2063 2070 if item['Type'] == 'MD': 2064 2071 getMDparms(item,mfx,parmDict,varyList) … … 2069 2076 elif item['Type'] in ['Residue','Vector']: 2070 2077 pfx = mfx+':' 2071 getRBparms(item,pfx,aTypes,RBdata,parmDict,varyList) 2078 atNo = getRBparms(item,pfx,aTypes,RBdata,atNo,parmDict,varyList) 2079 parmDict['atNo'] = atNo #total no. of atoms 2080 parmDict['nObj'] = len(MCSAObjs) 2072 2081 FFtables = G2el.GetFFtable(aTypes) 2073 2082 refs = [] 2074 2083 if 'PWDR' in reflName: 2075 2084 for ref in reflData: 2076 h,k,l,m,d,pos,sig,gam, Fsq= ref[:9]2085 h,k,l,m,d,pos,sig,gam,f = ref[:9] 2077 2086 if d >= mcsaControls['dmin']: 2078 2087 sig = gamFW(sig,gam)/sq8ln2 #--> sig from FWHM … … 2105 2114 Uniq,phi = G2spc.GenHKLf([h,k,l],SGData)[2:] 2106 2115 FFs = G2el.getFFvalues(FFtables,SQ) 2107 refs.append([h,k,l,m,f*m, 0.,0.,FFs,Uniq,phi])2116 refs.append([h,k,l,m,f*m,iref,0.,FFs,Uniq,phi]) 2108 2117 nRef = len(refs) 2118 pfx = str(data['pId'])+'::PWLref:' 2109 2119 rcov = np.zeros((nRef,nRef)) 2110 Iref = 0 2111 for iref,refI in enumerate(reflData): 2112 if refI[4] >= mcsaControls['dmin'] and refI[5]: #skip unrefined ones 2113 nameI = pfx+'PWLref:'+str(iref) 2114 if nameI in covData['varyList']: 2115 Iindx = vList.index(nameI) 2116 rcov[Iref][Iref] = covMatrix[Iindx][Iindx] 2117 Jref = 0 2118 for jref,refJ in enumerate(reflData[:iref]): 2119 if refJ[5]: 2120 nameJ = pfx+'PWLref:'+str(jref) 2121 try: 2122 rcov[Iref][Jref] = covMatrix[vList.index(nameI)][vList.index(nameJ)] 2123 except ValueError: 2124 rcov[Iref][Jref] = rcov[Iref][Jref-1] 2125 Jref += 1 2126 else: 2127 rcov[Iref] = rcov[Iref-1] 2128 rcov[Iref][Iref] = rcov[Iref-1][Iref-1] 2129 Iref += 1 2120 for iref,refI in enumerate(refs): 2121 I = refI[5] 2122 nameI = pfx+str(I) 2123 if nameI in vList: 2124 Iindx = vList.index(nameI) 2125 rcov[iref][iref] = covMatrix[Iindx][Iindx] 2126 for jref,refJ in enumerate(refs[:iref]): 2127 J = refJ[5] 2128 nameJ = pfx+str(J) 2129 try: 2130 rcov[iref][jref] = covMatrix[vList.index(nameI)][vList.index(nameJ)] 2131 except ValueError: 2132 rcov[iref][jref] = rcov[iref][jref-1] 2133 else: 2134 rcov[iref] = rcov[iref-1] 2135 rcov[iref][iref] = rcov[iref-1][iref-1] 2130 2136 rcov += (rcov.T-np.diagflat(np.diagonal(rcov))) 2131 2137 Rdiag = np.sqrt(np.diag(rcov)) -
trunk/ReadMarCCDFrame.py
r939 r943 446 446 File.seek(4096) 447 447 self.image = ar.array(self.arrayTypeCode,File.read(self.byteDepth*self.TIFFsizeX*self.TIFFsizeY)) 448 449 450 448 # reverse the array so if can have the same view as is read in marccd 449 # also switch the view direction 450 self.image.reverse() 451 451 self.viewDirection = abs(self.viewDirection - 1) 452 452
Note: See TracChangeset
for help on using the changeset viewer.