Changeset 1792 for trunk/GSASIIphsGUI.py


Ignore:
Timestamp:
Apr 17, 2015 11:50:01 AM (8 years ago)
Author:
vondreele
Message:

remove Exceptions from seqRefine; now returns & makes Message dialog
make histograms go in order of tree items not random dict order
make sph. harm. stuff work on arrays of hkl - speed up of texture calculations
implement selected copy for Data parameters (phase fraction, etc.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r1790 r1792  
    38083808        UseList = data['Histograms']
    38093809        hist = DData.G2hist
     3810        keyList = G2frame.GetHistogramNames(hist[:4])
    38103811        sourceDict = UseList[hist]
    38113812        if 'HKLF' in sourceDict['Histogram']:
     
    38163817        for name in copyNames:
    38173818            copyDict[name] = copy.deepcopy(sourceDict[name])        #force copy
    3818         keyList = sorted(UseList.keys())
    38193819        if UseList:
    38203820            dlg = G2G.G2MultiChoiceDialog(G2frame.dataFrame, 'Copy parameters',
    3821                 'Copy parameters to which histograms?',
    3822                 keyList)
     3821                'Copy parameters to which histograms?',keyList)
    38233822            try:
    38243823                if dlg.ShowModal() == wx.ID_OK:
     
    38603859                for bab in babNames:
    38613860                    copyDict[name][bab] = sourceDict[name][bab][1]                       
    3862         keyList = sorted(UseList.keys())
     3861        keyList = G2frame.GetHistogramNames(hist[:4])
    38633862        if UseList:
    38643863            dlg = G2G.G2MultiChoiceDialog(G2frame.dataFrame, 'Copy parameters',
     
    38953894            finally:
    38963895                dlg.Destroy()
    3897                
    38983896       
    38993897    def OnSelDataCopy(event):
    3900         hst = G2frame.PatternTree.GetItemText(G2frame.PatternId)
    3901         histList = GetHistsLikeSelected(G2frame)
    3902         if not histList:
    3903             G2frame.ErrorDialog('No match','No histograms match '+hst,G2frame.dataFrame)
    3904             return
    3905 #        # Assemble a list of item labels
    3906 #        TextTable = {key:label for key,label,dig in
    3907 #                     SetupSampleLabels(hst,data.get('Type'),Inst['Type'][0])
    3908 #                     }
    3909 #        # get flexible labels
    3910 #        TextTable.update({
    3911 #            key:Controls[key] for key in Controls if key.startswith('FreePrm')
    3912 #            })
    3913 #        # add a few extra
    3914 #        TextTable.update({
    3915 #            'Type':'Diffractometer type',
    3916 #            'InstrName':'Instrument Name',
    3917 #            })
    3918 #        # Assemble a list of dict entries that would be labeled in the Sample
    3919 #        # params data window (drop ranId and items not used).
    3920 #        keyList = [i for i in data.keys() if i in TextTable]
    3921 #        keyText = [TextTable[i] for i in keyList]
    3922 #        # sort both lists together, ordered by keyText
    3923 #        keyText, keyList = zip(*sorted(zip(keyText,keyList))) # sort lists
    3924 #        selectedKeys = []
    3925 #        dlg = G2G.G2MultiChoiceDialog(
    3926 #            G2frame.dataFrame,
    3927 #            'Select which sample parameters\nto copy',
    3928 #            'Select sample parameters', keyText)
    3929 #        try:
    3930 #            if dlg.ShowModal() == wx.ID_OK:
    3931 #                selectedKeys = [keyList[i] for i in dlg.GetSelections()]
    3932 #        finally:
    3933 #            dlg.Destroy()
    3934 #        if not selectedKeys: return # nothing to copy
    3935 #        copyDict = {}
    3936 #        for parm in selectedKeys:
    3937 #            copyDict[parm] = data[parm]
    3938 #        dlg = G2G.G2MultiChoiceDialog(
    3939 #            G2frame.dataFrame,
    3940 #            'Copy sample params from\n'+str(hst[5:])+' to...',
    3941 #            'Copy sample parameters', histList)
    3942 #        try:
    3943 #            if dlg.ShowModal() == wx.ID_OK:
    3944 #                result = dlg.GetSelections()
    3945 #                for i in result:
    3946 #                    item = histList[i]
    3947 #                    Id = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,item)
    3948 #                    sampleData = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,Id,'Sample Parameters'))
    3949 #                    sampleData.update(copy.deepcopy(copyDict))
    3950 #        finally:
    3951 #            dlg.Destroy()           
    3952         G2plt.PlotPatterns(G2frame,plotType='SASD',newPlot=False)
     3898        UseList = data['Histograms']
     3899        hist = DData.G2hist
     3900        keyList = G2frame.GetHistogramNames(hist[:4])
     3901        sourceDict = UseList[hist]
     3902        copyDict = {}
     3903        if 'HKLF' in sourceDict['Histogram']:
     3904            copyNames = ['Scale','Extinction','Babinet']
     3905        else:  #PWDR 
     3906            copyNames = ['Scale','Pref.Ori.','Size','Mustrain','HStrain','Extinction','Babinet']
     3907        dlg = G2G.G2MultiChoiceDialog(G2frame.dataFrame,'Select which parameters to copy',
     3908            'Select phase data parameters', copyNames)
     3909        try:
     3910            if dlg.ShowModal() == wx.ID_OK:
     3911                selectedItems = [copyNames[i] for i in dlg.GetSelections()]
     3912        finally:
     3913            dlg.Destroy()
     3914        if not selectedItems: return # nothing to copy
     3915        copyDict = {}
     3916        for parm in selectedItems:
     3917            copyDict[parm] = copy.deepcopy(sourceDict[parm])
     3918        if UseList:
     3919            dlg = G2G.G2MultiChoiceDialog(G2frame.dataFrame, 'Copy parameters',
     3920                    'Copy parameters to which histograms?',keyList)
     3921            try:
     3922                if dlg.ShowModal() == wx.ID_OK:
     3923                    for sel in dlg.GetSelections():
     3924                        UseList[keyList[sel]].update(copy.deepcopy(copyDict))
     3925            finally:
     3926                dlg.Destroy()           
    39533927
    39543928       
     
    59265900        phaseName = General['Name']
    59275901        Histograms = data['Histograms']
     5902        keyList = G2frame.GetHistogramNames('PWDR')
    59285903        histNames = []
    59295904        refData = {}
    59305905        Gangls = {}
    5931         for name in Histograms.keys():
     5906        for name in keyList:
    59325907            if 'PWDR' in name:
    59335908                im = 0
     
    59475922                else:   # xray - typical caked 2D image data
    59485923                    refData[name] = np.column_stack((Refs[0],Refs[1],Refs[2],Refs[5+im],Refs[8+im],Refs[12+im+it],np.zeros_like(Refs[0])))
    5949         Error = G2mth.FitTexture(General,Gangls,refData)
     5924        Error = G2mth.FitTexture(General,Gangls,refData,keyList)
    59505925        if Error:
    59515926            wx.MessageBox(Error,caption='Fit Texture Error',style=wx.ICON_EXCLAMATION)
Note: See TracChangeset for help on using the changeset viewer.