Changeset 1780 for trunk/GSASIIphsGUI.py


Ignore:
Timestamp:
Apr 7, 2015 5:14:33 PM (7 years ago)
Author:
vondreele
Message:

force collapse of all children when main tree item is collapsed
begin texture fitting from seq. refinements
fix bugs in plotting if all SH coeff = 0
set background on Fcsq when delt = 3sig & 10 sig

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r1778 r1780  
    38973897       
    38983898    def OnSelDataCopy(event):
    3899         print 'selected data copy'
    3900         event.Skip()
     3899        hst = G2frame.PatternTree.GetItemText(G2frame.PatternId)
     3900        histList = GetHistsLikeSelected(G2frame)
     3901        if not histList:
     3902            G2frame.ErrorDialog('No match','No histograms match '+hst,G2frame.dataFrame)
     3903            return
     3904#        # Assemble a list of item labels
     3905#        TextTable = {key:label for key,label,dig in
     3906#                     SetupSampleLabels(hst,data.get('Type'),Inst['Type'][0])
     3907#                     }
     3908#        # get flexible labels
     3909#        TextTable.update({
     3910#            key:Controls[key] for key in Controls if key.startswith('FreePrm')
     3911#            })
     3912#        # add a few extra
     3913#        TextTable.update({
     3914#            'Type':'Diffractometer type',
     3915#            'InstrName':'Instrument Name',
     3916#            })
     3917#        # Assemble a list of dict entries that would be labeled in the Sample
     3918#        # params data window (drop ranId and items not used).
     3919#        keyList = [i for i in data.keys() if i in TextTable]
     3920#        keyText = [TextTable[i] for i in keyList]
     3921#        # sort both lists together, ordered by keyText
     3922#        keyText, keyList = zip(*sorted(zip(keyText,keyList))) # sort lists
     3923#        selectedKeys = []
     3924#        dlg = G2G.G2MultiChoiceDialog(
     3925#            G2frame.dataFrame,
     3926#            'Select which sample parameters\nto copy',
     3927#            'Select sample parameters', keyText)
     3928#        try:
     3929#            if dlg.ShowModal() == wx.ID_OK:
     3930#                selectedKeys = [keyList[i] for i in dlg.GetSelections()]
     3931#        finally:
     3932#            dlg.Destroy()
     3933#        if not selectedKeys: return # nothing to copy
     3934#        copyDict = {}
     3935#        for parm in selectedKeys:
     3936#            copyDict[parm] = data[parm]
     3937#        dlg = G2G.G2MultiChoiceDialog(
     3938#            G2frame.dataFrame,
     3939#            'Copy sample params from\n'+str(hst[5:])+' to...',
     3940#            'Copy sample parameters', histList)
     3941#        try:
     3942#            if dlg.ShowModal() == wx.ID_OK:
     3943#                result = dlg.GetSelections()
     3944#                for i in result:
     3945#                    item = histList[i]
     3946#                    Id = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,item)
     3947#                    sampleData = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,Id,'Sample Parameters'))
     3948#                    sampleData.update(copy.deepcopy(copyDict))
     3949#        finally:
     3950#            dlg.Destroy()           
     3951        G2plt.PlotPatterns(G2frame,plotType='SASD',newPlot=False)
     3952
    39013953       
    39023954    def OnPwdrAdd(event):
     
    58705922                           
    58715923    def OnTextureRefine(event):
    5872         print 'refine texture from C[i,j] in seq. result'
     5924        General = data['General']
     5925        phaseName = General['Name']
     5926        Histograms = data['Histograms']
     5927        histNames = []
     5928        refData = {}
     5929        SamAngs = {}
     5930        for name in Histograms.keys():
     5931            if 'PWDR' in name:
     5932                im = 0
     5933                it = 0
     5934                histNames.append(name)
     5935                Id = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,name)
     5936                Sample = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,Id,'Sample Parameters'))
     5937                SamAngs[name] = copy.copy([Sample[item] for item in['Omega','Chi','Phi','Azimuth']])
     5938                RefDict = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,Id,'Reflection Lists'))[phaseName]
     5939                Refs = RefDict['RefList'].T  #np.array!
     5940                if 'T' in RefDict['Type']: it = 3  #TOF offset for alp, bet, wave
     5941                if RefDict['Super']: im = 1     #(3+1) offset for m
     5942                refData[name] = np.column_stack((Refs[0],Refs[1],Refs[2],Refs[8+im],Refs[12+im+it]))
     5943        Error = G2mth.FitTexture(General,SamAngs,refData)
     5944        if Error:
     5945            wx.MessageBox(Error,caption='Fit Texture Error',style=wx.ICON_EXCLAMATION)
     5946        G2ddG.UpdateDData(G2frame,DData,data)
    58735947           
    58745948    def OnTextureClear(event):
Note: See TracChangeset for help on using the changeset viewer.