Changeset 1286


Ignore:
Timestamp:
Apr 18, 2014 3:55:06 PM (8 years ago)
Author:
vondreele
Message:

improvements to HKL plotting for powders & single xtal data
a note that powder extinction is missing in G2strMath

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIgrid.py

    r1285 r1286  
    40564056    mainSizer.Add((5,10),0)
    40574057   
    4058     scaleSizer = wx.BoxSizer(wx.HORIZONTAL)
    4059     scaleSizer.Add(wx.StaticText(parent=G2frame.dataDisplay,label=' Scale'),0,
    4060         WACV|wx.EXPAND)
    4061     scaleSel = wx.Slider(parent=G2frame.dataDisplay,maxValue=1000,minValue=1,
    4062         style=wx.SL_HORIZONTAL,value=int(data['Scale']*10))
    4063     scaleSizer.Add(scaleSel,1,wx.EXPAND|wx.RIGHT|WACV)
    4064     scaleSel.SetLineSize(10)
    4065     scaleSel.SetPageSize(10)
    4066     scaleSel.Bind(wx.EVT_SLIDER, OnScaleSlider)
    4067     mainSizer.Add(scaleSizer,0,wx.EXPAND|wx.RIGHT)
     4058#    scaleSizer = wx.BoxSizer(wx.HORIZONTAL)
     4059#    scaleSizer.Add(wx.StaticText(parent=G2frame.dataDisplay,label=' Scale'),0,
     4060#        WACV|wx.EXPAND)
     4061#    scaleSel = wx.Slider(parent=G2frame.dataDisplay,maxValue=1000,minValue=1,
     4062#        style=wx.SL_HORIZONTAL,value=int(data['Scale']*10))
     4063#    scaleSizer.Add(scaleSel,1,wx.EXPAND|wx.RIGHT|WACV)
     4064#    scaleSel.SetLineSize(10)
     4065#    scaleSel.SetPageSize(10)
     4066#    scaleSel.Bind(wx.EVT_SLIDER, OnScaleSlider)
     4067##    mainSizer.Add(scaleSizer,0,wx.EXPAND|wx.RIGHT)
    40684068    mainSizer.Add((0,10),0)   
    40694069   
     
    40854085    mainSizer.Add((0,10),0)   
    40864086       
    4087     izone = zones.index(data['Zone'])
    4088     layerSizer = wx.BoxSizer(wx.HORIZONTAL)
    4089     layerSizer.Add(wx.StaticText(parent=G2frame.dataDisplay,label=' Layer'),0,
    4090         WACV|wx.EXPAND)
    4091     layerSel = wx.Slider(parent=G2frame.dataDisplay,maxValue=HKLmax[izone],minValue=HKLmin[izone],
    4092         style=wx.SL_HORIZONTAL|wx.SL_AUTOTICKS|wx.SL_LABELS,value=0)
    4093     layerSel.SetLineSize(1)
    4094     layerSel.SetPageSize(1)
    4095     layerSel.Bind(wx.EVT_SLIDER, OnLayerSlider)   
    4096     layerSizer.Add(layerSel,1,wx.EXPAND|wx.RIGHT|WACV)
    4097     layerSizer.Add((10,0),0)   
    4098     mainSizer.Add(layerSizer,1,wx.EXPAND|wx.RIGHT)
     4087#    izone = zones.index(data['Zone'])
     4088#    layerSizer = wx.BoxSizer(wx.HORIZONTAL)
     4089#    layerSizer.Add(wx.StaticText(parent=G2frame.dataDisplay,label=' Layer'),0,
     4090#        WACV|wx.EXPAND)
     4091#    layerSel = wx.Slider(parent=G2frame.dataDisplay,maxValue=HKLmax[izone],minValue=HKLmin[izone],
     4092#        style=wx.SL_HORIZONTAL|wx.SL_AUTOTICKS|wx.SL_LABELS,value=0)
     4093#    layerSel.SetLineSize(1)
     4094#    layerSel.SetPageSize(1)
     4095#    layerSel.Bind(wx.EVT_SLIDER, OnLayerSlider)   
     4096#    layerSizer.Add(layerSel,1,wx.EXPAND|wx.RIGHT|WACV)
     4097#    layerSizer.Add((10,0),0)   
     4098#    mainSizer.Add(layerSizer,1,wx.EXPAND|wx.RIGHT)
    40994099
    41004100       
  • trunk/GSASIIplot.py

    r1285 r1286  
    239239################################################################################
    240240           
    241 def PlotSngl(self,newPlot=False,Data=None,hklRef=None,Title=''):
     241def PlotSngl(G2frame,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
     
    246246    global HKL,HKLF
    247247
    248     def OnPlotKeyPress(event):
     248    def OnSCKeyPress(event):
     249        i = zones.index(Data['Zone'])
    249250        newPlot = False
    250251        if event.key == 'h':
     
    259260            Data['Scale'] /= 1.1
    260261        elif event.key == '+':
    261             Data['Layer'] += 1
     262            Data['Layer'] = min(Data['Layer']+1,HKLmax[i])
    262263        elif event.key == '-':
    263             Data['Layer'] -= 1
     264            Data['Layer'] = max(Data['Layer']-1,HKLmin[i])
    264265        elif event.key == '0':
    265266            Data['Layer'] = 0
    266         PlotSngl(self,False,Data,hklRef,Title)
     267        PlotSngl(G2frame,False,Data,hklRef,Title)
    267268
    268269    def OnSCMotion(event):
     
    279280                HKLtxt = '(%3d,%3d,%3d)'%(xpos,ypos,zpos)
    280281            Page.canvas.SetToolTipString(HKLtxt)
    281             self.G2plotNB.status.SetFields(['HKL = '+HKLtxt,''])
     282            G2frame.G2plotNB.status.SetStatusText('HKL = '+HKLtxt,0)
     283            G2frame.G2plotNB.status.SetStatusText('Use K-box to set plot controls',1)
    282284               
    283285    def OnSCPick(event):
     
    297299        if len(hklf):
    298300            Fosq,sig,Fcsq = hklf[0]
    299             HKLtxt = '(%3d,%3d,%3d %.2f %.3f %.2f %.2f)'%(h,k,l,Fosq,sig,Fcsq,(Fosq-Fcsq)/(scale*sig))
    300             self.G2plotNB.status.SetFields(['','HKL, Fosq, sig, Fcsq, delFsq/sig = '+HKLtxt])
     301            HKLtxt = '( %.2f %.3f %.2f %.2f)'%(Fosq,sig,Fcsq,(Fosq-Fcsq)/(scale*sig))
     302            G2frame.G2plotNB.status.SetStatusText('Fosq, sig, Fcsq, delFsq/sig = '+HKLtxt,1)
    301303                                 
    302304    try:
    303         plotNum = self.G2plotNB.plotList.index('Structure Factors')
    304         Page = self.G2plotNB.nb.GetPage(plotNum)
     305        plotNum = G2frame.G2plotNB.plotList.index('Structure Factors')
     306        Page = G2frame.G2plotNB.nb.GetPage(plotNum)
    305307        if not newPlot:
    306308            Plot = Page.figure.gca()          #get previous powder plot & get limits
     
    309311        Plot = Page.figure.gca()          #get a fresh plot after clf()
    310312    except ValueError:
    311         Plot = self.G2plotNB.addMpl('Structure Factors').gca()
    312         plotNum = self.G2plotNB.plotList.index('Structure Factors')
    313         Page = self.G2plotNB.nb.GetPage(plotNum)
     313        Plot = G2frame.G2plotNB.addMpl('Structure Factors').gca()
     314        plotNum = G2frame.G2plotNB.plotList.index('Structure Factors')
     315        Page = G2frame.G2plotNB.nb.GetPage(plotNum)
    314316        Page.canvas.mpl_connect('pick_event', OnSCPick)
    315317        Page.canvas.mpl_connect('motion_notify_event', OnSCMotion)
    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',)
     318        Page.canvas.mpl_connect('key_press_event', OnSCKeyPress)
     319        Page.keyPress = OnSCKeyPress
     320        Page.Choice = (' key press','u: increase scale','d: decrease scale',
     321            'h: select 100 zone','k: select 010 zone','l: select 001 zone',
     322            '+: increase index','-: decrease index','0: zero layer',)
    320323    Page.SetFocus()
    321324   
     325    G2frame.G2plotNB.status.SetStatusText('Use K-box to set plot controls',1)
    322326    Plot.set_aspect(aspect='equal')
    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:]
     327    Name = G2frame.PatternTree.GetItemText(G2frame.PatternId)
     328    if 'HKLF' in Name:
     329        HKLref = G2frame.PatternTree.GetItemPyData(G2frame.PatternId)[1]['RefList']
     330        Data = G2frame.PatternTree.GetItemPyData(
     331            G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId, 'HKL Plot Controls'))
     332        Title = Name[5:]
    328333    else:
    329334        HKLref = hklRef
     
    346351    for refl in HKLref:
    347352        H = np.array(refl[:3])
    348         if self.Sngl:
     353        if 'HKLF' in Name:
    349354            Fosq,sig,Fcsq = refl[5:8]
    350355        else:
     
    403408    Plot.set_xlabel(xlabel[izone]+str(Data['Layer']),fontsize=12)
    404409    Plot.set_ylabel(ylabel[izone],fontsize=12)
    405     Plot.set_xlim((HKLmin[pzone[izone][0]],HKLmax[pzone[izone][0]]))
    406     Plot.set_ylim((HKLmin[pzone[izone][1]],HKLmax[pzone[izone][1]]))
    407     Page.canvas.draw()
    408 #    if not newPlot:
    409 #        Page.toolbar.push_current()
    410 #        Plot.set_xlim(xylim[0])
    411 #        Plot.set_ylim(xylim[1])
     410    if not newPlot:
     411        Page.toolbar.push_current()
     412        Plot.set_xlim(xylim[0])
     413        Plot.set_ylim(xylim[1])
    412414#        xylim = []
    413 #        Page.toolbar.push_current()
    414 #        Page.toolbar.draw()
    415 #    else:
    416 #        Page.canvas.draw()
     415        Page.toolbar.push_current()
     416        Page.toolbar.draw()
     417    else:
     418        Plot.set_xlim((HKLmin[pzone[izone][0]],HKLmax[pzone[izone][0]]))
     419        Plot.set_ylim((HKLmin[pzone[izone][1]],HKLmax[pzone[izone][1]]))
     420        Page.canvas.draw()
    417421       
    418422################################################################################
  • trunk/GSASIIpwdGUI.py

    r1285 r1286  
    23132313           
    23142314        def OnPlotHKL(event):
    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,}
     2315            FoMax = np.max(refList.T[8])
     2316            controls = {'Type' : 'Fo','ifFc' : True,     
     2317                'HKLmax' : [int(np.max(refList.T[0])),int(np.max(refList.T[1])),int(np.max(refList.T[2]))],
     2318                'HKLmin' : [int(np.min(refList.T[0])),int(np.min(refList.T[1])),int(np.min(refList.T[2]))],
     2319                'FoMax' : FoMax,'Zone' : '001','Layer' : 0,'Scale' : 1.0,}
    23202320            G2plt.PlotSngl(G2frame,newPlot=True,Data=controls,hklRef=refList,Title=phaseName)
    23212321       
  • trunk/GSASIIstrMath.py

    r1275 r1286  
    10361036   
    10371037def GetIntensityCorr(refl,uniq,G,g,pfx,phfx,hfx,SGData,calcControls,parmDict):
    1038     'Needs a doc string'
     1038    'Needs a doc string'    #need powder extinction!
    10391039    Icorr = parmDict[phfx+'Scale']*parmDict[hfx+'Scale']*refl[3]               #scale*multiplicity
    10401040    if 'X' in parmDict[hfx+'Type']:
     
    10471047   
    10481048def GetIntensityDerv(refl,uniq,G,g,pfx,phfx,hfx,SGData,calcControls,parmDict):
    1049     'Needs a doc string'
     1049    'Needs a doc string'    #need powder extinction derivs!
    10501050    dIdsh = 1./parmDict[hfx+'Scale']
    10511051    dIdsp = 1./parmDict[phfx+'Scale']
Note: See TracChangeset for help on using the changeset viewer.