Changeset 5342


Ignore:
Timestamp:
Oct 2, 2022 10:39:19 AM (8 months ago)
Author:
toby
Message:

Add option to highlight classes of reflections in Unit Cells List

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIdataGUI.py

    r5336 r5342  
    31473147        self.HKL = []
    31483148        self.Extinct = []
     3149        self.PlotOpts = {}  # new place to put plotting options
    31493150        self.Lines = []     # lines used for data limits & excluded regions
    31503151        self.MagLines = []  # lines used for plot magnification
  • trunk/GSASIIplot.py

    r5332 r5342  
    192192except TypeError:
    193193    pass
    194 if '2' in platform.python_version_tuple()[0]:
    195     GkDelta = unichr(0x0394)
    196     Gkrho = unichr(0x03C1)
    197     super2 = unichr(0xb2)
    198     Angstr = unichr(0x00c5)
    199     Pwrm1 = unichr(0x207b)+unichr(0x0b9)
    200 else:
    201     GkDelta = chr(0x0394)
    202     Gkrho = chr(0x03C1)
    203     super2 = chr(0xb2)
    204     Angstr = chr(0x00c5)
    205     Pwrm1 = chr(0x207b)+chr(0x0b9)
     194if '2' not in platform.python_version_tuple()[0]:
     195    unichr = chr
     196GkDelta = unichr(0x0394)
     197Gkrho = unichr(0x03C1)
     198super2 = unichr(0xb2)
     199Angstr = unichr(0x00c5)
     200Pwrm1 = unichr(0x207b)+unichr(0x0b9)
    206201# misc global vars
    207202nxs = np.newaxis
     
    38013796            for hkl in G2frame.HKL:
    38023797                clr = orange
     3798                dash = (3,3)
    38033799                if len(hkl) > 6 and hkl[3]:
    38043800                    clr = 'g'
     3801                hklind = G2frame.PlotOpts.get('hklHighlight',0)
     3802                if hklind != 0:  # highlight selected classes of reflections
     3803                    if hkl[hklind-1] != 0:
     3804                        clr = 'b'
     3805                        dash = (5,2)
    38053806                if Page.plotStyle['qPlot']:
    3806                     Plot.axvline(2.*np.pi/G2lat.Pos2dsp(Parms,hkl[-2]),color=clr,dashes=(3,3),lw=1.5)
     3807                    Plot.axvline(2.*np.pi/G2lat.Pos2dsp(Parms,hkl[-2]),color=clr,dashes=dash,lw=1.5)
    38073808                elif Page.plotStyle['dPlot']:
    3808                     Plot.axvline(G2lat.Pos2dsp(Parms,hkl[-2]),color=clr,dashes=(3,3),lw=1.5)
     3809                    Plot.axvline(G2lat.Pos2dsp(Parms,hkl[-2]),color=clr,dashes=dash,lw=1.5)
    38093810                else:
    3810                     Plot.axvline(hkl[-2],color=clr,dashes=(3,3),lw=1.5)
     3811                    Plot.axvline(hkl[-2],color=clr,dashes=dash,lw=1.5)
    38113812            for hkl in G2frame.Extinct: # plot extinct reflections
    38123813                clr = 'b'
     
    43144315            layr.lt_exec('set {} -w 1000'.format(pname))
    43154316       
    4316         import itertools # delay this since not commonly called or needed
     4317        #import itertools # delay this since not commonly called or needed
    43174318
    43184319        try:
     
    44104411                valueList.append([l.get_text(),l.get_position()[0]])
    44114412        # invert lists into columns, use iterator for all values
    4412         if hasattr(itertools,'zip_longest'): #Python 3+
    4413             invertIter = itertools.zip_longest(*valueList,fillvalue=' ')
    4414         else:
    4415             invertIter = itertools.izip_longest(*valueList,fillvalue=' ')
     4413        #if hasattr(itertools,'zip_longest'): #Python 3+
     4414        #    invertIter = itertools.zip_longest(*valueList,fillvalue=' ')
     4415        #else:
     4416        #    invertIter = itertools.izip_longest(*valueList,fillvalue=' ')
    44164417
    44174418        # Start Origin instance
  • trunk/GSASIIpwdGUI.py

    r5338 r5342  
    5757VERY_LIGHT_GREY = wx.Colour(235,235,235)
    5858WACV = wx.ALIGN_CENTER_VERTICAL
    59 if '2' in platform.python_version_tuple()[0]:
    60     GkDelta = unichr(0x0394)
    61     GkSigma = unichr(0x03a3)
    62     GkTheta = unichr(0x03f4)
    63     Gklambda = unichr(0x03bb)
    64     Pwr10 = unichr(0x0b9)+unichr(0x2070)
    65     Pwr20 = unichr(0x0b2)+unichr(0x2070)
    66     Pwrm1 = unichr(0x207b)+unichr(0x0b9)
    67     Pwrm2 = unichr(0x207b)+unichr(0x0b2)
    68     Pwrm6 = unichr(0x207b)+unichr(0x2076)
    69     Pwrm4 = unichr(0x207b)+unichr(0x2074)
    70     Angstr = unichr(0x00c5)
    71     superMinusOne = unichr(0xaf)+unichr(0xb9)
    72 else:
    73     GkDelta = chr(0x0394)
    74     GkSigma = chr(0x03a3)
    75     GkTheta = chr(0x03f4)
    76     Gklambda = chr(0x03bb)
    77     Pwr10 = chr(0x0b9)+chr(0x2070)
    78     Pwr20 = chr(0x0b2)+chr(0x2070)
    79     Pwrm1 = chr(0x207b)+chr(0x0b9)
    80     Pwrm2 = chr(0x207b)+chr(0x0b2)
    81     Pwrm6 = chr(0x207b)+chr(0x2076)
    82     Pwrm4 = chr(0x207b)+chr(0x2074)
    83     Angstr = chr(0x00c5)
    84     superMinusOne = chr(0xaf)+chr(0xb9)
     59if '2' not in platform.python_version_tuple()[0]:
     60    unichr = chr
     61GkDelta = unichr(0x0394)
     62GkSigma = unichr(0x03a3)
     63GkTheta = unichr(0x03f4)
     64Gklambda = unichr(0x03bb)
     65Pwr10 = unichr(0x0b9)+unichr(0x2070)
     66Pwr20 = unichr(0x0b2)+unichr(0x2070)
     67Pwrm1 = unichr(0x207b)+unichr(0x0b9)
     68Pwrm2 = unichr(0x207b)+unichr(0x0b2)
     69Pwrm6 = unichr(0x207b)+unichr(0x2076)
     70Pwrm4 = unichr(0x207b)+unichr(0x2074)
     71Angstr = unichr(0x00c5)
     72superMinusOne = unichr(0xaf)+unichr(0xb9)
     73notEq0 = unichr(0x2260)+'0'
    8574# trig functions in degrees
    8675sind = lambda x: math.sin(x*math.pi/180.)
     
    35303519        vec = ssopt['ModVec']
    35313520        print(' Trying: %s %s modulation vector = %.3f %.3f %.3f'%(controls[13],ssopt['ssSymb'],vec[0],vec[1],vec[2]))
    3532         OnHklShow(None)
     3521        OnHklShow()
    35333522        wx.CallAfter(UpdateUnitCellsGrid,G2frame,data)
    35343523       
     
    36663655        #G2plt.PlotPatterns(G2frame,extraKeys=KeyList)
    36673656       
    3668     def OnHklShow(event):
     3657    def OnHklShow(event=None):
    36693658        PatternId = G2frame.PatternId
    36703659        peaks = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,PatternId, 'Index Peak List'))
     
    37623751        G2frame.dataWindow.RunSubGroups.Enable(True)
    37633752        G2frame.GPXtree.SetItemPyData(UnitCellsId,data)
    3764         OnHklShow(None)
     3753        OnHklShow()
    37653754        wx.CallAfter(UpdateUnitCellsGrid,G2frame,data)
    37663755
     
    38393828        G2frame.GPXtree.SetItemPyData(UnitCellsId,data)
    38403829        G2frame.dataWindow.RefineCell.Enable(True)
    3841         OnHklShow(None)
     3830        OnHklShow()
    38423831        wx.CallAfter(UpdateUnitCellsGrid,G2frame,data)
    38433832       
     
    38643853#        G2frame.dataWindow.RunSubGroups.Enable(True)
    38653854        G2frame.dataWindow.RefineCell.Enable(True)
    3866         OnHklShow(None)
     3855        OnHklShow()
    38673856        wx.CallAfter(UpdateUnitCellsGrid,G2frame,data)
    38683857               
     
    42564245            del SGData['MagSpGrp']
    42574246        ssopt['SGData'] = SGData
    4258         OnHklShow(None)
     4247        OnHklShow()
    42594248        wx.CallAfter(UpdateUnitCellsGrid,G2frame,data)
    42604249           
     
    42714260        SGData['SpnFlp'] = SpnFlp
    42724261        SGData['MagSpGrp'] = G2spc.MagSGSym(SGData)
    4273         OnHklShow(None)
     4262        OnHklShow()
    42744263       
    42754264    def OnBNSlatt(event):
     
    42894278        OprNames,SpnFlp = G2spc.GenMagOps(SGData)
    42904279        SGData['SpnFlp'] = SpnFlp
    4291         OnHklShow(None)
     4280        OnHklShow()
    42924281           
    42934282    def OnShowSpins(event):
     
    43214310        finally:
    43224311            dlg.Destroy()
    4323         OnHklShow(None)
     4312        OnHklShow()
    43244313        wx.CallAfter(UpdateUnitCellsGrid,G2frame,data)
    43254314       
     
    43464335            dlg.Destroy()   
    43474336            return
    4348         import SUBGROUPS as kSUB
     4337        #import SUBGROUPS as kSUB
    43494338        wx.BeginBusyCursor()
    43504339        wx.MessageBox(''' For use of PSEUDOLATTICE, please cite:
     
    43684357       
    43694358    def OnRunSubs(event):
    4370         import SUBGROUPS as kSUB
     4359        #import SUBGROUPS as kSUB
    43714360        G2frame.dataWindow.RunSubGroupsMag.Enable(False)
    43724361        pUCid = G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Unit Cells List')
     
    44684457       
    44694458    def OnRunSubsMag(event):
    4470         import SUBGROUPS as kSUB
     4459        #import SUBGROUPS as kSUB
    44714460        G2frame.dataWindow.RunSubGroups.Enable(False)
    44724461        pUCid = G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Unit Cells List')
     
    47144703    shiftSel.SetSelection(3)
    47154704    littleSizer.Add(shiftSel)
     4705   
     4706    littleSizer.Add(wx.StaticText(G2frame.dataWindow,label=' highlight ',
     4707                                      style=wx.ALIGN_RIGHT),0,WACV)
     4708    G2frame.PlotOpts['hklHighlight'] = G2frame.PlotOpts.get('hklHighlight',0)
     4709    Sel = G2G.G2ChoiceButton(G2frame.dataWindow,
     4710                            [ 'None',] + [c+notEq0 for c in ('h','k','l')],
     4711                            indLoc=G2frame.PlotOpts,indKey='hklHighlight',
     4712                            onChoice=OnHklShow)
     4713    littleSizer.Add(Sel,0,WACV)
     4714   
    47164715    mainSizer.Add(littleSizer,0)
    47174716   
     
    47594758            zeroVar.Bind(wx.EVT_CHECKBOX,OnZeroVar)
    47604759            littleSizer.Add(zeroVar,0,WACV)
     4760           
    47614761    mainSizer.Add(littleSizer,0)
    47624762    mainSizer.Add((5,5),0)
Note: See TracChangeset for help on using the changeset viewer.