Ignore:
Timestamp:
Nov 9, 2015 1:20:47 PM (7 years ago)
Author:
vondreele
Message:

enter space group (R -3 c) for Alumina image calibrant - gives better set of lines
some revision to SS derivatives
add ImageJ format (both big & little endian) to tiff importer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstrMath.py

    r2040 r2041  
    912912                dFdui[iref] = 2.*SA*(dfadui[0]+dfadui[1])+2.*SB*(dfbdui[0]+dfbdui[1])
    913913                dFdua[iref] = 2.*SA*(dfadua[0]+dfadua[1])+2.*SB*(dfbdua[0]+dfbdua[1])
    914                 dFdfl[iref] = -(fas[0]+fbs[1])*dfadfl-(fbs[0]+fas[1])*dfbdfl  #array(nRef,)
     914                dFdfl[iref] = -SA*dfadfl-SB*dfbdfl  #array(nRef,)
    915915        dFdbab[iref] = 2.*fas[0]*np.array([np.sum(dfadba*dBabdA),np.sum(-dfadba*parmDict[phfx+'BabA']*SQfactor*dBabdA)]).T+ \
    916916            2.*fbs[0]*np.array([np.sum(dfbdba*dBabdA),np.sum(-dfbdba*parmDict[phfx+'BabA']*SQfactor*dBabdA)]).T
     
    12201220        fbg = fb*GfpuA[0]+fa*GfpuA[1]
    12211221       
    1222         fas = np.sum(np.sum(fag,axis=1),axis=1)
     1222        fas = np.sum(np.sum(fag,axis=1),axis=1)     # 2 x twin
    12231223        fbs = np.sum(np.sum(fbg,axis=1),axis=1)
    12241224        fax = np.array([-fot*sinp,-fotp*cosp])   #positions; 2 x twin x ops x atoms
     
    12381238            dfadua = np.array([np.sum(-Hij[it]*np.swapaxes(fag,-2,-1)[:,it,:,:,nxs],axis=-2) for it in range(nTwin)])
    12391239            dfbdua = np.array([np.sum(-Hij[it]*np.swapaxes(fbg,-2,-1)[:,it,:,:,nxs],axis=-2) for it in range(nTwin)])
    1240             # array(nTwin,2,nAtom,3) & array(2,nTwin,nAtom,6)
     1240            # array(nTwin,2,nAtom,3) & array(2,nTwin,nAtom,6) & array(2,nTwin,nAtom,12)
     1241            dfadGf = np.sum(fa[:,it,:,:,nxs,nxs]*dGdf[0][nxs,nxs,:,:,:,:]-fb[:,it,:,:,nxs,nxs]*dGdf[1][nxs,nxs,:,:,:,:],axis=1)
     1242            dfbdGf = np.sum(fb[:,it,:,:,nxs,nxs]*dGdf[0][nxs,nxs,:,:,:,:]+fa[:,it,:,:,nxs,nxs]*dGdf[1][nxs,nxs,:,:,:,:],axis=1)
    12411243            dfadGx = np.sum(fa[:,it,:,:,nxs,nxs]*dGdx[0][nxs,nxs,:,:,:,:]-fb[:,it,:,:,nxs,nxs]*dGdx[1][nxs,nxs,:,:,:,:],axis=1)
    12421244            dfbdGx = np.sum(fb[:,it,:,:,nxs,nxs]*dGdx[0][nxs,nxs,:,:,:,:]+fa[:,it,:,:,nxs,nxs]*dGdx[1][nxs,nxs,:,:,:,:],axis=1)
    1243             dfadGx = np.sum(fa[:,it,:,:,nxs,nxs]*dGdu[0][nxs,nxs,:,:,:,:]-fb[:,it,:,:,nxs,nxs]*dGdu[1][nxs,nxs,:,:,:,:],axis=1)
    1244             dfbdGx = np.sum(fb[:,it,:,:,nxs,nxs]*dGdu[0][nxs,nxs,:,:,:,:]+fa[:,it,:,:,nxs,nxs]*dGdu[1][nxs,nxs,:,:,:,:],axis=1)
    1245             # array (2,nAtom,wave,3)
     1245            dfadGu = np.sum(fa[:,it,:,:,nxs,nxs]*dGdu[0][nxs,nxs,:,:,:,:]-fb[:,it,:,:,nxs,nxs]*dGdu[1][nxs,nxs,:,:,:,:],axis=1)
     1246            dfbdGu = np.sum(fb[:,it,:,:,nxs,nxs]*dGdu[0][nxs,nxs,:,:,:,:]+fa[:,it,:,:,nxs,nxs]*dGdu[1][nxs,nxs,:,:,:,:],axis=1)
    12461247        else:
    12471248            dfadx = np.sum(twopi*Uniq[:,:3]*np.swapaxes(fax,-2,-1)[:,:,:,nxs],axis=-2)
     
    12491250            dfadua = np.sum(-Hij*np.swapaxes(fag,-2,-1)[:,:,:,nxs],axis=-2)
    12501251            dfbdua = np.sum(-Hij*np.swapaxes(fbg,-2,-1)[:,:,:,nxs],axis=-2)
    1251             # array(2,nAtom,3) & array(2,nAtom,6)
     1252            # array(2,nAtom,3) & array(2,nAtom,6) & array(2,nAtom,12)
     1253            dfadGf = np.sum(fa[:,:,:,nxs,nxs]*dGdf[0][nxs,:,:,:,:]-fb[:,:,:,nxs,nxs]*dGdf[1][nxs,:,:,:,:],axis=1)
     1254            dfbdGf = np.sum(fb[:,:,:,nxs,nxs]*dGdf[0][nxs,:,:,:,:]+fa[:,:,:,nxs,nxs]*dGdf[1][nxs,:,:,:,:],axis=1)
    12521255            dfadGx = np.sum(fa[:,:,:,nxs,nxs]*dGdx[0][nxs,:,:,:,:]-fb[:,:,:,nxs,nxs]*dGdx[1][nxs,:,:,:,:],axis=1)
    12531256            dfbdGx = np.sum(fb[:,:,:,nxs,nxs]*dGdx[0][nxs,:,:,:,:]+fa[:,:,:,nxs,nxs]*dGdx[1][nxs,:,:,:,:],axis=1)
    12541257            dfadGu = np.sum(fa[:,:,:,nxs,nxs]*dGdu[0][nxs,:,:,:,:]-fb[:,:,:,nxs,nxs]*dGdu[1][nxs,:,:,:,:],axis=1)
    12551258            dfbdGu = np.sum(fb[:,:,:,nxs,nxs]*dGdu[0][nxs,:,:,:,:]+fa[:,:,:,nxs,nxs]*dGdu[1][nxs,:,:,:,:],axis=1)   
    1256             # array (2,nAtom,wave,3)
    1257         #NB: the above have been checked against PA(1:10,1:2) in strfctr.for for al2O3!   
    12581259#        GSASIIpath.IPyBreak()
    12591260        if not SGData['SGInv'] and len(TwinLaw) == 1:   #Flack derivative
     
    12781279                2.*(fbs[0]*dfbdGu[0]+fbs[1]*dfbdGu[1])
    12791280        else:
    1280             SA = fas[0]+fas[1]
    1281             SB = fbs[0]+fbs[1]
     1281            SA = fas[0]+fas[1]      #float = A+A' (might be array[nTwin])
     1282            SB = fbs[0]+fbs[1]      #float = B+B' (might be array[nTwin])
    12821283            if nTwin > 1:
    12831284                dFdfr[iref] = [2.*TwMask[it]*(SA[it]*dfadfr[0][it]+SA[it]*dfadfr[1][it]+SB[it]*dfbdfr[0][it]+SB[it]*dfbdfr[1][it])*Mdata/len(Uniq[it]) for it in range(nTwin)]
     
    12851286                dFdui[iref] = [2.*TwMask[it]*(SA[it]*dfadui[it][0]+SA[it]*dfadui[it][1]+SB[it]*dfbdui[it][0]+SB[it]*dfbdui[it][1]) for it in range(nTwin)]
    12861287                dFdua[iref] = [2.*TwMask[it]*(SA[it]*dfadua[it][0]+SA[it]*dfadua[it][1]+SB[it]*dfbdua[it][0]+SB[it]*dfbdua[it][1]) for it in range(nTwin)]
    1287                 dFdGx[iref] = [2.*TwMask[it]*(SA[it]*dfadGx[0]+SA[it]*dfadGx[1]+SB[it]*dfbdGx[0]+SB[it]*dfbdGx[1]) for it in range(nTwin)]
    1288                 dFdGu[iref] = [2.*TwMask[it]*(SA[it]*dfadGu[0]+SA[it]*dfadGu[1]+SB[it]*dfbdGu[0]+SB[it]*dfbdGu[1]) for it in range(nTwin)]
     1288                dFdGf[iref] = [2.*TwMask[it]*(fas[0][it]*dfadGf[0]+fas[1][it]*dfadGf[1]+fbs[0][it]*dfbdGf[0]+fbs[1][it]*dfbdGf[1]) for it in range(nTwin)]
     1289                dFdGx[iref] = [2.*TwMask[it]*(fas[0][it]*dfadGx[0]+fas[1][it]*dfadGx[1]+fbs[0][it]*dfbdGx[0]+fbs[1][it]*dfbdGx[1]) for it in range(nTwin)]
     1290                dFdGu[iref] = [2.*TwMask[it]*(fas[0][it]*dfadGu[0]+fas[1][it]*dfadGu[1]+fbs[0][it]*dfbdGu[0]+fbs[1][it]*dfbdGu[1]) for it in range(nTwin)]
    12891291                dFdtw[iref] = np.sum(TwMask*fas,axis=0)**2+np.sum(TwMask*fbs,axis=0)**2
    12901292               
    12911293            else:   #these are good for no twin single crystals
    12921294                dFdfr[iref] = 2.*(SA*dfadfr[0]+SA*dfadfr[1]+SB*dfbdfr[0]+SB*dfbdfr[1])*Mdata/len(Uniq) #array(nRef,nAtom)
    1293                 dFdx[iref] = 2.*(SA*dfadx[0]+SB*dfbdx[1]+SB*dfbdx[0]+SA*dfadx[1])    #array(nRef,nAtom,3)
    1294                 dFdui[iref] = 2.*(SA*dfadui[0]+SB*dfbdui[1]+SB*dfbdui[0]+SA*dfadui[1])   #array(nRef,nAtom)
    1295                 dFdua[iref] = 2.*(SA*dfadua[0]+SB*dfbdua[1]+SB*dfbdua[0]+SA*dfadua[1])    #array(nRef,nAtom,6)
    1296                 dFdfl[iref] = -(fas[0]-SB)*dfadfl-(fbs[0]+fas[1])*dfbdfl                  #array(nRef,)
    1297                 dFdGx[iref] = 2.*(SA*dfadGx[0]+SA*dfadGx[1]+SB*dfbdGx[0]+SB*dfbdGx[1])      #array(nRef,natom,nwave,6)
    1298                 dFdGu[iref] = 2.*(SA*dfadGu[0]+SA*dfadGu[1]+SB*dfbdGu[0]+SB*dfbdGu[1])      #array(nRef,natom,nwave,6)
     1295                dFdx[iref] = 2.*(SA*dfadx[0]+SA*dfadx[1]+SB*dfbdx[0]+SB*dfbdx[1])    #array(nRef,nAtom,3)
     1296                dFdui[iref] = 2.*(SA*dfadui[0]+SA*dfadui[1]+SB*dfbdui[0]+SB*dfbdui[1])   #array(nRef,nAtom)
     1297                dFdua[iref] = 2.*(SA*dfadua[0]+SA*dfadua[1]+SB*dfbdua[0]+SB*dfbdua[1])    #array(nRef,nAtom,6)
     1298                dFdfl[iref] = -SA*dfadfl-SB*dfbdfl                  #array(nRef,)               
     1299                dFdGf[iref] = 2.*(fas[0]*dfadGf[0]+fas[1]*dfadGf[1]+fbs[0]*dfbdGf[0]+SB*dfbdGf[1])      #array(nRef,natom,nwave,2)
     1300                dFdGx[iref] = 2.*(fas[0]*dfadGx[0]+fas[1]*dfadGx[1]+fbs[0]*dfbdGx[0]+SB*dfbdGx[1])      #array(nRef,natom,nwave,6)
     1301                dFdGu[iref] = 2.*(fas[0]*dfadGu[0]+fas[1]*dfadGu[1]+fbs[0]*dfbdGu[0]+SB*dfbdGu[1])      #array(nRef,natom,nwave,6)
    12991302        dFdbab[iref] = 2.*fas[0]*np.array([np.sum(dfadba*dBabdA),np.sum(-dfadba*parmDict[phfx+'BabA']*SQfactor*dBabdA)]).T+ \
    13001303            2.*fbs[0]*np.array([np.sum(dfbdba*dBabdA),np.sum(-dfbdba*parmDict[phfx+'BabA']*SQfactor*dBabdA)]).T
     
    13141317        dFdvDict[pfx+'AU13:'+str(i)] = 2.*dFdua.T[4][i]
    13151318        dFdvDict[pfx+'AU23:'+str(i)] = 2.*dFdua.T[5][i]
    1316         for j in range(XSSdata.shape[1]):
     1319        for j in range(FSSdata.shape[1]):        #loop over waves Fzero & Fwid?
     1320            dFdvDict[pfx+'Fsin:'+str(i)+':'+str(j)] = dFdGf.T[0][j][i]
     1321            dFdvDict[pfx+'Fcos:'+str(i)+':'+str(j)] = dFdGf.T[1][j][i]
     1322        for j in range(XSSdata.shape[1]):       #loop over waves 'Tzero','Xslope','Yslope','Zslope'?
    13171323            dFdvDict[pfx+'Xsin:'+str(i)+':'+str(j)] = dFdGx.T[0][j][i]
    13181324            dFdvDict[pfx+'Ysin:'+str(i)+':'+str(j)] = dFdGx.T[1][j][i]
     
    13211327            dFdvDict[pfx+'Ycos:'+str(i)+':'+str(j)] = dFdGx.T[4][j][i]
    13221328            dFdvDict[pfx+'Zcos:'+str(i)+':'+str(j)] = dFdGx.T[5][j][i]
    1323         for j in range(USSdata.shape[1]):
     1329        for j in range(USSdata.shape[1]):       #loop over waves
    13241330            dFdvDict[pfx+'U11sin:'+str(i)+':'+str(j)] = dFdGu.T[0][j][i]
    13251331            dFdvDict[pfx+'U22sin:'+str(i)+':'+str(j)] = dFdGu.T[1][j][i]
Note: See TracChangeset for help on using the changeset viewer.