Changeset 420 for trunk/GSASIIstruct.py


Ignore:
Timestamp:
Nov 17, 2011 1:35:34 PM (11 years ago)
Author:
vondreele
Message:

small fixes including
move msg = in SetVaryFlags? outside loop
arrange so plot shows Yo-Yc (was other way around)
put Yo-Yc at bottom in multiplot plots
more on seq refinement plots

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstruct.py

    r419 r420  
    664664    return vcov
    665665   
     666def cellFill(pfx,SGData,parmDict,sigDict):
     667    if SGData['SGLaue'] in ['-1',]:
     668        A = [parmDict[pfx+'A0'],parmDict[pfx+'A1'],parmDict[pfx+'A2'],
     669            parmDict[pfx+'A3'],parmDict[pfx+'A4'],parmDict[pfx+'A5']]
     670        sigA = [sigDict[pfx+'A0'],sigDict[pfx+'A1'],sigDict[pfx+'A2'],
     671            sigDict[pfx+'A3'],sigDict[pfx+'A4'],sigDict[pfx+'A5']]
     672    elif SGData['SGLaue'] in ['2/m',]:
     673        if SGData['SGUniq'] == 'a':
     674            A = [parmDict[pfx+'A0'],parmDict[pfx+'A1'],parmDict[pfx+'A2'],
     675                parmDict[pfx+'A3'],0,0]
     676            sigA = [sigDict[pfx+'A0'],sigDict[pfx+'A1'],sigDict[pfx+'A2'],
     677                sigDict[pfx+'A3'],0,0]
     678        elif SGData['SGUniq'] == 'b':
     679            A = [parmDict[pfx+'A0'],parmDict[pfx+'A1'],parmDict[pfx+'A2'],
     680                0,parmDict[pfx+'A4'],0]
     681            sigA = [sigDict[pfx+'A0'],sigDict[pfx+'A1'],sigDict[pfx+'A2'],
     682                0,sigDict[pfx+'A4'],0]
     683        else:
     684            A = [parmDict[pfx+'A0'],parmDict[pfx+'A1'],parmDict[pfx+'A2'],
     685                0,0,parmDict[pfx+'A5']]
     686            sigA = [sigDict[pfx+'A0'],sigDict[pfx+'A1'],sigDict[pfx+'A2'],
     687                0,0,sigDict[pfx+'A5']]
     688    elif SGData['SGLaue'] in ['mmm',]:
     689        A = [parmDict[pfx+'A0'],parmDict[pfx+'A1'],parmDict[pfx+'A2'],0,0,0]
     690        sigA = [sigDict[pfx+'A0'],sigDict[pfx+'A1'],sigDict[pfx+'A2'],0,0,0]
     691    elif SGData['SGLaue'] in ['4/m','4/mmm']:
     692        A = [parmDict[pfx+'A0'],parmDict[pfx+'A0'],parmDict[pfx+'A2'],0,0,0]
     693        sigA = [sigDict[pfx+'A0'],0,sigDict[pfx+'A2'],0,0,0]
     694    elif SGData['SGLaue'] in ['6/m','6/mmm','3m1', '31m', '3']:
     695        A = [parmDict[pfx+'A0'],parmDict[pfx+'A0'],parmDict[pfx+'A2'],
     696            parmDict[pfx+'A0'],0,0]
     697        sigA = [sigDict[pfx+'A0'],0,sigDict[pfx+'A2'],0,0,0]
     698    elif SGData['SGLaue'] in ['3R', '3mR']:
     699        A = [parmDict[pfx+'A0'],parmDict[pfx+'A0'],parmDict[pfx+'A0'],
     700            parmDict[pfx+'A3'],parmDict[pfx+'A3'],parmDict[pfx+'A3']]
     701        sigA = [sigDict[pfx+'A0'],0,0,sigDict[pfx+'A3'],0,0]
     702    elif SGData['SGLaue'] in ['m3m','m3']:
     703        A = [parmDict[pfx+'A0'],parmDict[pfx+'A0'],parmDict[pfx+'A0'],0,0,0]
     704        sigA = [sigDict[pfx+'A0'],0,0,0,0,0]
     705    return A,sigA
     706       
    666707def getCellEsd(pfx,SGData,A,covData):
    667708    dpr = 180./np.pi
     
    724765def SetPhaseData(parmDict,sigDict,Phases,covData):
    725766   
    726     def cellFill(pfx,SGData,parmDict,sigDict):
    727         if SGData['SGLaue'] in ['-1',]:
    728             A = [parmDict[pfx+'A0'],parmDict[pfx+'A1'],parmDict[pfx+'A2'],
    729                 parmDict[pfx+'A3'],parmDict[pfx+'A4'],parmDict[pfx+'A5']]
    730             sigA = [sigDict[pfx+'A0'],sigDict[pfx+'A1'],sigDict[pfx+'A2'],
    731                 sigDict[pfx+'A3'],sigDict[pfx+'A4'],sigDict[pfx+'A5']]
    732         elif SGData['SGLaue'] in ['2/m',]:
    733             if SGData['SGUniq'] == 'a':
    734                 A = [parmDict[pfx+'A0'],parmDict[pfx+'A1'],parmDict[pfx+'A2'],
    735                     parmDict[pfx+'A3'],0,0]
    736                 sigA = [sigDict[pfx+'A0'],sigDict[pfx+'A1'],sigDict[pfx+'A2'],
    737                     sigDict[pfx+'A3'],0,0]
    738             elif SGData['SGUniq'] == 'b':
    739                 A = [parmDict[pfx+'A0'],parmDict[pfx+'A1'],parmDict[pfx+'A2'],
    740                     0,parmDict[pfx+'A4'],0]
    741                 sigA = [sigDict[pfx+'A0'],sigDict[pfx+'A1'],sigDict[pfx+'A2'],
    742                     0,sigDict[pfx+'A4'],0]
    743             else:
    744                 A = [parmDict[pfx+'A0'],parmDict[pfx+'A1'],parmDict[pfx+'A2'],
    745                     0,0,parmDict[pfx+'A5']]
    746                 sigA = [sigDict[pfx+'A0'],sigDict[pfx+'A1'],sigDict[pfx+'A2'],
    747                     0,0,sigDict[pfx+'A5']]
    748         elif SGData['SGLaue'] in ['mmm',]:
    749             A = [parmDict[pfx+'A0'],parmDict[pfx+'A1'],parmDict[pfx+'A2'],0,0,0]
    750             sigA = [sigDict[pfx+'A0'],sigDict[pfx+'A1'],sigDict[pfx+'A2'],0,0,0]
    751         elif SGData['SGLaue'] in ['4/m','4/mmm']:
    752             A = [parmDict[pfx+'A0'],parmDict[pfx+'A0'],parmDict[pfx+'A2'],0,0,0]
    753             sigA = [sigDict[pfx+'A0'],0,sigDict[pfx+'A2'],0,0,0]
    754         elif SGData['SGLaue'] in ['6/m','6/mmm','3m1', '31m', '3']:
    755             A = [parmDict[pfx+'A0'],parmDict[pfx+'A0'],parmDict[pfx+'A2'],
    756                 parmDict[pfx+'A0'],0,0]
    757             sigA = [sigDict[pfx+'A0'],0,sigDict[pfx+'A2'],0,0,0]
    758         elif SGData['SGLaue'] in ['3R', '3mR']:
    759             A = [parmDict[pfx+'A0'],parmDict[pfx+'A0'],parmDict[pfx+'A0'],
    760                 parmDict[pfx+'A3'],parmDict[pfx+'A3'],parmDict[pfx+'A3']]
    761             sigA = [sigDict[pfx+'A0'],0,0,sigDict[pfx+'A3'],0,0]
    762         elif SGData['SGLaue'] in ['m3m','m3']:
    763             A = [parmDict[pfx+'A0'],parmDict[pfx+'A0'],parmDict[pfx+'A0'],0,0,0]
    764             sigA = [sigDict[pfx+'A0'],0,0,0,0,0]
    765         return A,sigA
    766        
    767767    def PrintAtomsAndSig(General,Atoms,atomsSig):
    768768        print '\n Atoms:'
     
    17201720    parmdict.update(zip(varylist,values))
    17211721   
     1722def GetNewCellParms(parmDict,varyList):
     1723    newCellDict = {}
     1724    Dchoices = ['D11','D22','D33','D12','D13','D23']
     1725    Achoices = ['A'+str(i) for i in range(6)]
     1726   
     1727   
     1728    return newCellDict
     1729   
    17221730def ApplyXYZshifts(parmDict,varyList):
    17231731    ''' takes atom x,y,z shift and applies it to corresponding atom x,y,z value
     
    23382346                        dMdv[varylist.index(name)] += item[0]*dervDict[item[1]]
    23392347                    if name in dependentVars:
     2348                        item = names[name]
    23402349                        depDerivDict[name] += item[0]*dervDict[item[1]]
    23412350
     
    24442453                varylist,Histogram,Phases,calcControls,pawleyLookup)
    24452454            yc[xB:xF] += yb[xB:xF]
    2446             yd[xB:xF] = yc[xB:xF]-y[xB:xF]          #yc-yo then all dydv have no '-' needed
     2455            yd[xB:xF] = y[xB:xF]-yc[xB:xF]
    24472456            Histogram['sumwYd'] = np.sum(np.sqrt(w[xB:xF])*(yd[xB:xF]))
    2448             wdy = np.sqrt(w[xB:xF])*(yd[xB:xF])
     2457            wdy = -np.sqrt(w[xB:xF])*(yd[xB:xF])
    24492458            Histogram['wRp'] = min(100.,np.sqrt(np.sum(wdy**2)/Histogram['sumwYo'])*100.)
    24502459            M = np.concatenate((M,wdy))
     
    24532462    Rwp = min(100.,np.sqrt(np.sum(M**2)/sumwYo)*100.)
    24542463    if dlg:
    2455         GoOn = dlg.Update(Rwp,newmsg='%s%8.3f%s'%('Powder profile wRp =',Rwp,'%'))[0]
     2464        GoOn = dlg.Update(Rwp,newmsg='%s%8.3f%s'%('wRp =',Rwp,'%'))[0]
    24562465        if not GoOn:
    24572466            parmDict['saved values'] = values
     
    25112520        raise Exception       
    25122521    G2mv.Map2Dict(parmDict,varyList)
    2513     print G2mv.VarRemapShow(varyList)
     2522#    print G2mv.VarRemapShow(varyList)
    25142523
    25152524    while True:
     
    25332542        Values2Dict(parmDict, varyList, result[0])
    25342543        G2mv.Dict2Map(parmDict,varyList)
     2544        newCellDict = GetNewCellParms(parmDict,varyList)
    25352545        newAtomDict = ApplyXYZshifts(parmDict,varyList)
    25362546       
     
    25592569                    break
    25602570
    2561     print 'dependentParmList: ',G2mv.dependentParmList
    2562     print 'arrayList: ',G2mv.arrayList
    2563     print 'invarrayList: ',G2mv.invarrayList
    2564     print 'indParmList: ',G2mv.indParmList
    2565     print 'fixedDict: ',G2mv.fixedDict
    2566     print 'test1'
     2571#    print 'dependentParmList: ',G2mv.dependentParmList
     2572#    print 'arrayList: ',G2mv.arrayList
     2573#    print 'invarrayList: ',G2mv.invarrayList
     2574#    print 'indParmList: ',G2mv.indParmList
     2575#    print 'fixedDict: ',G2mv.fixedDict
     2576#    print 'test1'
    25672577    GetFobsSq(Histograms,Phases,parmDict,calcControls)
    2568     print 'test2'
     2578#    print 'test2'
    25692579    sigDict = dict(zip(varyList,sig))
    25702580    covData = {'variables':result[0],'varyList':varyList,'sig':sig,
    2571         'covMatrix':covMatrix,'title':GPXfile,'newAtomDict':newAtomDict}
     2581        'covMatrix':covMatrix,'title':GPXfile,'newAtomDict':newAtomDict,'newCellDict':newCellDict}
    25722582    SetPhaseData(parmDict,sigDict,Phases,covData)
    25732583    SetHistogramPhaseData(parmDict,sigDict,Phases,Histograms)
     
    25762586    SetUsedHistogramsAndPhases(GPXfile,Histograms,Phases,covData)
    25772587#for testing purposes!!!
    2578     file = open('structTestdata.dat','wb')
    2579     cPickle.dump(parmDict,file,1)
    2580     cPickle.dump(varyList,file,1)
    2581     for histogram in Histograms:
    2582         if 'PWDR' in histogram[:4]:
    2583             Histogram = Histograms[histogram]
    2584     cPickle.dump(Histogram,file,1)
    2585     cPickle.dump(Phases,file,1)
    2586     cPickle.dump(calcControls,file,1)
    2587     cPickle.dump(pawleyLookup,file,1)
    2588     file.close()
     2588#    file = open('structTestdata.dat','wb')
     2589#    cPickle.dump(parmDict,file,1)
     2590#    cPickle.dump(varyList,file,1)
     2591#    for histogram in Histograms:
     2592#        if 'PWDR' in histogram[:4]:
     2593#            Histogram = Histograms[histogram]
     2594#    cPickle.dump(Histogram,file,1)
     2595#    cPickle.dump(Phases,file,1)
     2596#    cPickle.dump(calcControls,file,1)
     2597#    cPickle.dump(pawleyLookup,file,1)
     2598#    file.close()
    25892599
    25902600def SeqRefine(GPXfile,dlg):
     
    26832693            Values2Dict(parmDict, varyList, result[0])
    26842694            G2mv.Dict2Map(parmDict,varyList)
     2695            newCellDict = GetNewCellParms(parmDict,varyList)
    26852696            newAtomDict = ApplyXYZshifts(parmDict,varyList)
    26862697           
     
    27112722        sigDict = dict(zip(varyList,sig))
    27122723        covData = {'variables':result[0],'varyList':varyList,'sig':sig,
    2713             'covMatrix':covMatrix,'title':histogram,'newAtomDict':newAtomDict}
     2724            'covMatrix':covMatrix,'title':histogram,'newAtomDict':newAtomDict,'newCellDict':newCellDict}
    27142725        SetHistogramPhaseData(parmDict,sigDict,Phases,Histo,ifPrint)
    27152726        SetHistogramData(parmDict,sigDict,Histo,ifPrint)
Note: See TracChangeset for help on using the changeset viewer.