Changeset 2328


Ignore:
Timestamp:
Jun 16, 2016 4:06:26 PM (5 years ago)
Author:
vondreele
Message:

seq dist table entries & plot now have sus computed from v-cov matrix

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIgrid.py

    r2327 r2328  
    34613461            parmDict = data[name]['parmDict']
    34623462            G2mv.GenerateConstraints(groups,parmlist,varyList,constrDict,fixedList,parmDict,SeqHist=ihst)
    3463             derivs = np.array(
    3464                 [EvalPSvarDeriv(calcobj,parmDict.copy(),sampleDict[name],var,ESD)
    3465                  for var,ESD in zip(varyList,sigs)])
    3466             esdList.append(np.sqrt(
    3467                 np.inner(derivs,np.inner(data[name]['covMatrix'],derivs.T)) ))
     3463            if 'Dist' in expr:
     3464                derivs = G2mth.CalcDistDeriv(obj.distance_dict,obj.distance_atoms, parmDict)
     3465                pId = obj.distance_dict['pId']
     3466                aId,bId = obj.distance_atoms
     3467                varyNames = ['%d::dA%s:%d'%(pId,ip,aId) for ip in ['x','y','z']]
     3468                varyNames += ['%d::dA%s:%d'%(pId,ip,bId) for ip in ['x','y','z']]
     3469                VCoV = G2mth.getVCov(varyNames,varyList,data[name]['covMatrix'])
     3470                esdList.append(np.sqrt(np.inner(derivs,np.inner(VCoV,derivs.T)) ))
     3471#                GSASIIpath.IPyBreak()
     3472            elif 'Angle' in expr:
     3473                derivs = G2mth.CalcAngleDeriv(obj.angle_dict,obj.angle_atoms, parmDict)
     3474                pId = obj.angle_dict['pId']
     3475                aId,bId = obj.distance_atoms
     3476                varyNames = ['%d::dA%s:%d'%(pId,ip,aId) for ip in ['x','y','z']]
     3477                varyNames += ['%d::dA%s:%d'%(pId,ip,bId[0]) for ip in ['x','y','z']]
     3478                varyNames += ['%d::dA%s:%d'%(pId,ip,bId[1]) for ip in ['x','y','z']]
     3479                VCoV = G2mth.getVCov(varyNames,varyList,data[name]['covMatrix'])
     3480                esdList.append(np.sqrt(np.inner(derivs,np.inner(VCoV,derivs.T)) ))
     3481            else:
     3482                derivs = np.array(
     3483                    [EvalPSvarDeriv(calcobj,parmDict.copy(),sampleDict[name],var,ESD)
     3484                     for var,ESD in zip(varyList,sigs)])
     3485                esdList.append(np.sqrt(
     3486                    np.inner(derivs,np.inner(data[name]['covMatrix'],derivs.T)) ))
    34683487            PSvarDict = parmDict.copy()
    34693488            PSvarDict.update(sampleDict[name])
     
    34713490            calcobj.UpdateDict(PSvarDict)
    34723491            valList.append(calcobj.EvalExpression())
    3473             if calcobj.su is not None: esdList[-1] = calcobj.su
     3492#            if calcobj.su is not None: esdList[-1] = calcobj.su
    34743493        if not esdList:
    34753494            esdList = None
  • trunk/GSASIImath.py

    r2327 r2328  
    15281528#    GSASIIpath.IPyBreak()
    15291529    return dist   
     1530   
     1531def CalcDistDeriv(distance_dict, distance_atoms, parmDict):
     1532    if not len(parmDict):
     1533        return None
     1534    pId = distance_dict['pId']
     1535    pfx = '%d::'%(pId)
     1536    A = [parmDict['%s::A%d'%(pId,i)] for i in range(6)]
     1537    Amat = G2lat.cell2AB(G2lat.A2cell(A))[0]
     1538    Oxyz = [parmDict['%s::A%s:%d'%(pId,x,distance_atoms[0])] for x in ['x','y','z']]
     1539    Txyz = [parmDict['%s::A%s:%d'%(pId,x,distance_atoms[1])] for x in ['x','y','z']]
     1540    inv = 1
     1541    symNo = distance_dict['symNo']
     1542    Tunit = distance_dict['cellNo']
     1543    SGData = distance_dict['SGData']   
     1544    deriv = getDistDerv(Oxyz,Txyz,Amat,Tunit,symNo,SGData)
     1545    return deriv
    15301546   
    1531 def CalcDistSu(distance_dict, distance_atoms, parmDict,covData={}):
    1532     '''default doc string
    1533    
    1534     :param type name: description
    1535    
    1536     :returns: type name: description
    1537    
    1538     '''
    1539     sig = 0.001
    1540    
    1541     return sig
    1542 
    15431547def CalcAngle(angle_dict, angle_atoms, parmDict):
    15441548    if not len(parmDict):
     
    15731577    return angle
    15741578
    1575 def CalcAngleSu(angle_dict, angle_atoms, parmDict,covData={}):
    1576     '''default doc string
    1577    
    1578     :param type name: description
    1579    
    1580     :returns: type name: description
    1581    
    1582     '''
    1583     sig = 0.5
    1584    
    1585     return sig
     1579def CalcAngleDeriv(angle_dict, angle_atoms, parmDict):
     1580    if not len(parmDict):
     1581        return None
     1582    pId = angle_dict['pId']
     1583    pfx = '%d::'%(pId)
     1584    A = [parmDict['%s::A%d'%(pId,i)] for i in range(6)]
     1585    Amat = G2lat.cell2AB(G2lat.A2cell(A))[0]
     1586    Oxyz = [parmDict['%s::A%s:%d'%(pId,x,distance_atoms[0])] for x in ['x','y','z']]
     1587    Txyz = [parmDict['%s::A%s:%d'%(pId,x,distance_atoms[1])] for x in ['x','y','z']]
     1588    inv = 1
     1589    symNo = distance_dict['symNo']
     1590    Tunit = distance_dict['cellNo']
     1591    SGData = distance_dict['SGData']   
     1592    deriv = getDistDerv(Oxyz,Txyz,Amat,Tunit,symNo,SGData)
     1593    return deriv
    15861594
    15871595def getSyXYZ(XYZ,ops,SGData):
Note: See TracChangeset for help on using the changeset viewer.