Changeset 943


Ignore:
Timestamp:
Jun 5, 2013 2:38:00 PM (10 years ago)
Author:
vondreele
Message:

more work on MC/SA

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r942 r943  
    19281928        parmDict[pfx+'Amul'] = len(G2spc.GenAtom(XYZ,SGData))
    19291929           
    1930     def getRBparms(item,mfx,aTypes,RBdata,parmDict,varyList):
     1930    def getRBparms(item,mfx,aTypes,RBdata,atNo,parmDict,varyList):
    19311931        parmDict[mfx+'MolCent'] = item['MolCent']
    19321932        parmDict[mfx+'RBId'] = item['RBId']
     
    19631963                    lower.append(limits[0])
    19641964                    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):
    19681971        '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))
    19731978        keys = {'Atype:':Tdata,'Amul:':Mdata,
    19741979            '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):
    19761982            for key in keys:
    19771983                parm = pfx+key+str(iatm)
     
    19801986        return Tdata,Mdata,Xdata
    19811987   
    1982 #    def mcsaSfCalc(refList,G,SGData,parmDict):
     1988#    def mcsaSfCalc(refList,RBdata,G,SGData,parmDict):
    19831989#        ''' Compute structure factors for all h,k,l for phase
    19841990#        input:
     
    20362042    generalData = data['General']
    20372043    SGData = generalData['SGData']
    2038     pId = data['pId']
    20392044    fixAtoms = data['Atoms']                       #if any
    20402045    cx,ct,cs = generalData['AtomPtrs'][:3]
     
    20522057            name = pfx+pstr[i]
    20532058            parmDict[name] = atm[cx+i]
    2054         atNo += 1       
     2059        atNo += 1
     2060    parmDict['nfixAt'] = len(fixAtoms)       
    20552061    mcsaControls = generalData['MCSA controls']
    20562062    reflName = mcsaControls['Data source']
     
    20612067    for i,item in enumerate(MCSAObjs):
    20622068        mfx = str(i)+':'
     2069        parmDict[mfx+'Type'] = item['Type']
    20632070        if item['Type'] == 'MD':
    20642071            getMDparms(item,mfx,parmDict,varyList)
     
    20692076        elif item['Type'] in ['Residue','Vector']:
    20702077            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)
    20722081    FFtables = G2el.GetFFtable(aTypes)
    20732082    refs = []
    20742083    if 'PWDR' in reflName:
    20752084        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]
    20772086            if d >= mcsaControls['dmin']:
    20782087                sig = gamFW(sig,gam)/sq8ln2        #--> sig from FWHM
     
    21052114                Uniq,phi = G2spc.GenHKLf([h,k,l],SGData)[2:]
    21062115                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])
    21082117        nRef = len(refs)
     2118        pfx = str(data['pId'])+'::PWLref:'
    21092119        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]
    21302136        rcov += (rcov.T-np.diagflat(np.diagonal(rcov)))
    21312137        Rdiag = np.sqrt(np.diag(rcov))
  • trunk/ReadMarCCDFrame.py

    r939 r943  
    446446        File.seek(4096)
    447447        self.image = ar.array(self.arrayTypeCode,File.read(self.byteDepth*self.TIFFsizeX*self.TIFFsizeY))
    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()
     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()
    451451        self.viewDirection = abs(self.viewDirection - 1)
    452452
Note: See TracChangeset for help on using the changeset viewer.