Changeset 2093 for trunk/GSASIIIO.py


Ignore:
Timestamp:
Dec 15, 2015 11:48:46 AM (6 years ago)
Author:
toby
Message:

autoint: show IMGs to be integrated; replace PWDR when auto-integrated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIIO.py

    r2087 r2093  
    871871        print('project save successful')
    872872
    873 def SaveIntegration(G2frame,PickId,data):
     873def SaveIntegration(G2frame,PickId,data,Overwrite=False):
    874874    'Save image integration results as powder pattern(s)'
    875875    azms = G2frame.Integrate[1]
     
    904904        Aname = name+" Azm= %.2f"%((azm+dazm)%360.)
    905905        item, cookie = G2frame.PatternTree.GetFirstChild(G2frame.root)
    906         nOcc = 0
    907         while item:
    908             Name = G2frame.PatternTree.GetItemText(item)
    909             if Aname in Name:
    910                 nOcc += 1
    911             item, cookie = G2frame.PatternTree.GetNextChild(G2frame.root, cookie)
    912         if nOcc:
    913             Aname += '(%d)'%(nOcc)
     906        # if Overwrite delete any duplicate
     907        if Overwrite and G2gd.GetPatternTreeItemId(G2frame,G2frame.root,Aname):
     908            print('Replacing '+Aname)
     909            item = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,Aname)
     910            G2frame.PatternTree.Delete(item)
     911        else:
     912            nOcc = 0
     913            while item:
     914                Name = G2frame.PatternTree.GetItemText(item)
     915                if Aname in Name:
     916                    nOcc += 1
     917                item, cookie = G2frame.PatternTree.GetNextChild(G2frame.root, cookie)
     918            if nOcc:
     919                Aname += '(%d)'%(nOcc)
    914920        Sample = G2pdG.SetDefaultSample()
    915921        Sample['Gonio. radius'] = data['distance']
Note: See TracChangeset for help on using the changeset viewer.