Changeset 3377


Ignore:
Timestamp:
May 9, 2018 3:50:11 PM (3 years ago)
Author:
vondreele
Message:

revise sequential refinement to retain previous runs & update those refined with new values.
provide a "Clear seq. results" button

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIdataGUI.py

    r3376 r3377  
    55265526           
    55275527        def OnCopySel(event):
    5528             data['Copy2Next'] = copySel.GetValue()
     5528            data['Copy2Next'] = copySel.GetValue()
     5529           
     5530        def OnClrSeq(event):
     5531            sId = GetGPXtreeItemId(G2frame,G2frame.root,'Sequential results')
     5532            if sId:
     5533                dlg = wx.MessageDialog(G2frame,'Are you sure?','Delete sequential results table',wx.OK|wx.CANCEL)
     5534                try:
     5535                    if dlg.ShowModal() == wx.ID_OK:
     5536                        G2frame.GPXtree.Delete(sId)
     5537                finally:
     5538                    dlg.Destroy()
    55295539                   
    55305540        seqSizer = wx.BoxSizer(wx.VERTICAL)
     
    55525562            copySel.SetValue(data['Copy2Next'])
    55535563            selSizer.Add(copySel,0,WACV)
     5564            clrSeq = wx.Button(G2frame.dataWindow,label='Clear previous seq.results')
     5565            clrSeq.Bind(wx.EVT_BUTTON,OnClrSeq)
     5566            selSizer.Add(clrSeq,0,WACV)
    55545567            seqSizer.Add(selSizer,0)
    55555568        return seqSizer
     
    68566869        vals.append([data[name]['variables'][s] if s is not None else None for s in sellist])
    68576870        esds.append([data[name]['sig'][s] if s is not None else None for s in sellist])
    6858         #GSASIIpath.IPyBreak()
    68596871    G2frame.colList += zip(*vals)
    68606872    G2frame.colSigs += zip(*esds)
  • trunk/GSASIIstrIO.py

    r3373 r3377  
    15621562    varyList = covData['varyList']
    15631563    covMatrix = covData['covMatrix']
    1564     vcov = G2mth.getVCov(RMnames,varyList,covMatrix)
    1565     if SGData['SGLaue'] in ['3', '3m1', '31m', '6/m', '6/mmm']:
    1566         vcov[1,1] = vcov[3,3] = vcov[0,1] = vcov[1,0] = vcov[0,0]
    1567         vcov[1,3] = vcov[3,1] = vcov[0,3] = vcov[3,0] = vcov[0,0]
    1568         vcov[1,2] = vcov[2,1] = vcov[2,3] = vcov[3,2] = vcov[0,2]
    1569     elif SGData['SGLaue'] in ['m3','m3m']:
    1570         vcov[0:3,0:3] = vcov[0,0]
    1571     elif SGData['SGLaue'] in ['4/m', '4/mmm']:
    1572         vcov[0:2,0:2] = vcov[0,0]
    1573         vcov[1,2] = vcov[2,1] = vcov[0,2]
    1574     elif SGData['SGLaue'] in ['3R','3mR']:
    1575         vcov[0:3,0:3] = vcov[0,0]
    1576 #        vcov[4,4] = vcov[5,5] = vcov[3,3]
    1577         vcov[3:6,3:6] = vcov[3,3]
    1578         vcov[0:3,3:6] = vcov[0,3]
    1579         vcov[3:6,0:3] = vcov[3,0]
     1564    if len(covMatrix):
     1565        vcov = G2mth.getVCov(RMnames,varyList,covMatrix)
     1566        if SGData['SGLaue'] in ['3', '3m1', '31m', '6/m', '6/mmm']:
     1567            vcov[1,1] = vcov[3,3] = vcov[0,1] = vcov[1,0] = vcov[0,0]
     1568            vcov[1,3] = vcov[3,1] = vcov[0,3] = vcov[3,0] = vcov[0,0]
     1569            vcov[1,2] = vcov[2,1] = vcov[2,3] = vcov[3,2] = vcov[0,2]
     1570        elif SGData['SGLaue'] in ['m3','m3m']:
     1571            vcov[0:3,0:3] = vcov[0,0]
     1572        elif SGData['SGLaue'] in ['4/m', '4/mmm']:
     1573            vcov[0:2,0:2] = vcov[0,0]
     1574            vcov[1,2] = vcov[2,1] = vcov[0,2]
     1575        elif SGData['SGLaue'] in ['3R','3mR']:
     1576            vcov[0:3,0:3] = vcov[0,0]
     1577    #        vcov[4,4] = vcov[5,5] = vcov[3,3]
     1578            vcov[3:6,3:6] = vcov[3,3]
     1579            vcov[0:3,3:6] = vcov[0,3]
     1580            vcov[3:6,0:3] = vcov[3,0]
     1581    else:
     1582        vcov = np.eye(6)
    15801583    delt = 1.e-9
    15811584    drVdA = np.zeros(6)
  • trunk/GSASIIstrMain.py

    r3371 r3377  
    112112        printFile.write(' Refinement time = %8.3fs, %8.3fs/cycle, for %d cycles\n'%(runtime,runtime/ncyc,ncyc))
    113113        printFile.write(' wR = %7.2f%%, chi**2 = %12.6g, GOF = %6.2f\n'%(Rvals['Rwp'],Rvals['chisq'],Rvals['GOF']))
     114        sig = len(varyList)*[None,]
     115        if 'None' in str(type(result[1])):
     116            IfOK = False
     117            covMatrix = []
     118            break
    114119        IfOK = True
    115120        try:
     
    125130            if not len(varyList):
    126131                covMatrix = []
    127                 sig = []
    128132                break
    129133            print ('**** Refinement failed - singular matrix ****')
     
    450454                Rvals['Rwp'],Rvals['chisq'],Rvals['GOF']**2,Rvals['DelChi2']))
    451455            # add the uncertainties into the esd dictionary (sigDict)
     456            if not IfOK:
     457                print('***** Sequential refinement failed at histogram '+histogram)
     458                break
    452459            sigDict = dict(zip(varyList,sig))
    453460            # the uncertainties for dependent constrained parms into the esd dict
     
    489496#            print (' ***** Refinement aborted *****')
    490497#            return False,Msg.msg
    491     if Controls.get('Reverse Seq'):
    492         histNames.reverse()
    493     SeqResult['histNames'] = histNames
     498    SeqResult['histNames'] = [item for item in G2stIO.GetHistogramNames(GPXfile,['PWDR',]) if item in SeqResult.keys()]
    494499    G2stIO.SetSeqResult(GPXfile,Histograms,SeqResult)
    495500    printFile.close()
Note: See TracChangeset for help on using the changeset viewer.