Changeset 1285


Ignore:
Timestamp:
Apr 18, 2014 1:10:27 PM (8 years ago)
Author:
vondreele
Message:

Add hkl plotting for powder reflection sets

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIIO.py

    r1276 r1285  
    16391639            'Layer' : 0,
    16401640            'Scale' : 1.0,
    1641             'log-lin' : 'lin',
    16421641            }
    16431642
  • trunk/GSASIIgrid.py

    r1284 r1285  
    25922592        self.SelectPhase = self.ReflEdit.Append(help='Select phase for reflection list',id=wxID_SELECTPHASE,
    25932593            kind=wx.ITEM_NORMAL,text='Select phase')
    2594 #        self.ReflMenu.Append(id=wxID_PWDHKLPLOT,kind=wx.ITEM_NORMAL,text='Plot HKLs',
    2595 #            help='Plot HKLs from powder pattern')      #can't work yet; no HKL Plot Controls!
     2594        self.ReflEdit.Append(id=wxID_PWDHKLPLOT,kind=wx.ITEM_NORMAL,text='Plot HKLs',
     2595            help='Plot HKLs from powder pattern')
    25962596        self.PostfillDataMenu()
    25972597       
  • trunk/GSASIIplot.py

    r1284 r1285  
    239239################################################################################
    240240           
    241 def PlotSngl(self,newPlot=False):
     241def PlotSngl(self,newPlot=False,Data=None,hklRef=None,Title=''):
    242242    '''Single crystal structure factor plotting package - displays zone of reflections as rings proportional
    243243        to F, F**2, etc. as requested
     
    245245    from matplotlib.patches import Circle,CirclePolygon
    246246    global HKL,HKLF
     247
     248    def OnPlotKeyPress(event):
     249        newPlot = False
     250        if event.key == 'h':
     251            Data['Zone'] = '100'
     252        elif event.key == 'k':
     253            Data['Zone'] = '010'
     254        elif event.key == 'l':
     255            Data['Zone'] = '001'
     256        elif event.key == 'u':
     257            Data['Scale'] *= 1.1
     258        elif event.key == 'd':
     259            Data['Scale'] /= 1.1
     260        elif event.key == '+':
     261            Data['Layer'] += 1
     262        elif event.key == '-':
     263            Data['Layer'] -= 1
     264        elif event.key == '0':
     265            Data['Layer'] = 0
     266        PlotSngl(self,False,Data,hklRef,Title)
    247267
    248268    def OnSCMotion(event):
     
    287307            xylim = Plot.get_xlim(),Plot.get_ylim()
    288308        Page.figure.clf()
    289         Page.Choice = None
    290309        Plot = Page.figure.gca()          #get a fresh plot after clf()
    291310    except ValueError:
     
    295314        Page.canvas.mpl_connect('pick_event', OnSCPick)
    296315        Page.canvas.mpl_connect('motion_notify_event', OnSCMotion)
    297     Page.Choice = None
     316        Page.canvas.mpl_connect('key_press_event', OnPlotKeyPress)
     317    Page.Choice = (' key press','u: increase scale','d: decrease scale',
     318        'h: select 100 zone','k: select 010 zone','l: select 001 zone',
     319        '+: increase index','-: decrease index','0: zero layer',)
    298320    Page.SetFocus()
    299321   
    300322    Plot.set_aspect(aspect='equal')
    301     HKLref = self.PatternTree.GetItemPyData(self.Sngl)[1]['RefList']
    302     Data = self.PatternTree.GetItemPyData(
    303         G2gd.GetPatternTreeItemId(self,self.Sngl, 'HKL Plot Controls'))
     323    if self.Sngl:
     324        HKLref = self.PatternTree.GetItemPyData(self.Sngl)[1]['RefList']
     325        Data = self.PatternTree.GetItemPyData(
     326            G2gd.GetPatternTreeItemId(self,self.Sngl, 'HKL Plot Controls'))
     327        Title = self.PatternTree.GetItemText(self.Sngl)[5:]
     328    else:
     329        HKLref = hklRef
     330   
    304331    Type = Data['Type']           
    305332    scale = Data['Scale']
     
    313340    pzone = [[1,2],[0,2],[0,1]]
    314341    izone = zones.index(Data['Zone'])
    315     Plot.set_title(self.PatternTree.GetItemText(self.Sngl)[5:])
     342    Plot.set_title(Title)
    316343    HKL = []
    317344    HKLF = []
     
    319346    for refl in HKLref:
    320347        H = np.array(refl[:3])
    321         Fosq,sig,Fcsq = refl[5:8]
     348        if self.Sngl:
     349            Fosq,sig,Fcsq = refl[5:8]
     350        else:
     351            Fosq,sig,Fcsq = refl[8],1.0,refl[9]
    322352        HKL.append(H)
    323353        HKLF.append([Fosq,sig,Fcsq])
  • trunk/GSASIIpwdGUI.py

    r1283 r1285  
    23132313           
    23142314        def OnPlotHKL(event):
    2315             PlotSngl(self,newPlot=True)           #this isn't going to work; no HKL plot controls!
     2315            controls = {'Type' : 'Fo','ifFc' : True,    #
     2316                'HKLmax' : [np.max(refList.T[0]),np.max(refList.T[1]),np.max(refList.T[2])],
     2317                'HKLmin' : [np.min(refList.T[0]),np.min(refList.T[1]),np.min(refList.T[2])],
     2318                'FoMax' : np.sqrt(np.max(refList.T[8])),
     2319                'Zone' : '001','Layer' : 0,'Scale' : 1.0,}
     2320            G2plt.PlotSngl(G2frame,newPlot=True,Data=controls,hklRef=refList,Title=phaseName)
    23162321       
    23172322    if G2frame.dataDisplay:
Note: See TracChangeset for help on using the changeset viewer.