Changeset 3263


Ignore:
Timestamp:
Feb 6, 2018 1:04:54 PM (5 years ago)
Author:
toby
Message:

redo reflection labeling conversions; fix crash on update of dummy range

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIdataGUI.py

    r3258 r3263  
    70957095        G2frame.GPXtree.SetItemPyData(GetGPXtreeItemId(G2frame,item,'Limits'),
    70967096            [(Tmin,Tmax),[Tmin,Tmax]])
    7097         UpdatePWHKPlot(G2frame,kind,item) # redisplay data screen
     7097        wx.CallAfter(UpdatePWHKPlot,G2frame,kind,item) # redisplay data screen
    70987098
    70997099    def OnPlot3DHKL(event):
  • trunk/GSASIIplot.py

    r3262 r3263  
    14821482            if not Id: return
    14831483            Parms,Parms2 = G2frame.GPXtree.GetItemPyData(Id)
     1484            limx = Plot.get_xlim()
     1485            dT = tolerance = np.fabs(limx[1]-limx[0])/100.
    14841486            if G2frame.plotStyle['qPlot'] and 'PWDR' in plottype:
    14851487                q = xpos
    1486                 dsp = 2.*np.pi/q
     1488                if q <= 0:
     1489                    G2frame.G2plotNB.status.SetStatusText('q = %9.5f'%q)
     1490                    return
    14871491                try:
    1488                     xpos = G2lat.Dsp2pos(Parms,2.0*np.pi/xpos)
     1492                    dsp = 2.*np.pi/q
     1493                    xpos = G2lat.Dsp2pos(Parms,2.0*np.pi/q)
    14891494                except ValueError:      #avoid bad value in asin beyond upper limit
     1495                    G2frame.G2plotNB.status.SetStatusText('q = %9.5f'%q)
    14901496                    return
    1491                 limx = Plot.get_xlim()
    1492                 try:
    1493                     xmin = G2lat.Dsp2pos(Parms,2.0*np.pi/limx[0])
    1494                 except ValueError:      #fix bad value in asin beyond upper limit
    1495                     #if 'C' in Parms['Type'][0]: # how to handle TOF?
    1496                     xmin = 0.
    1497                 try:
    1498                     xmax = G2lat.Dsp2pos(Parms,2.0*np.pi/limx[1])
    1499                 except ValueError:      #fix bad value in asin beyond upper limit
    1500                     #if 'C' in Parms['Type'][0]: # how to handle TOF?
    1501                     xmin = 180.
    1502                 wid = np.fabs(xmax - xmin)
     1497                if 'C' in Parms['Type'][0] or 'PKS' in Parms['Type'][0]:
     1498                    wave = G2mth.getWave(Parms)
     1499                    dT = tolerance*wave*90./(np.pi**2*cosd(xpos/2))
     1500                else: # TOF
     1501                    dT = Parms['difC'][1] * 2 * np.pi * tolerance / q**2
    15031502            elif plottype in ['SASD','REFD']:
    15041503                q = xpos
     1504                if q <= 0:
     1505                    G2frame.G2plotNB.status.SetStatusText('q = %9.5f'%q)
     1506                    return
    15051507                dsp = 2.*np.pi/q
    1506                 limx = Plot.get_xlim()
    1507                 wid = np.fabs(2.*np.pi/limx[1] - 2.*np.pi/limx[0])               
    15081508            elif G2frame.plotStyle['dPlot']:
    15091509                dsp = xpos
    1510                 q = 2.*np.pi/dsp
    1511                 xpos = G2lat.Dsp2pos(Parms,xpos)
    1512                 limx = Plot.get_xlim()
    1513                 wid = np.fabs(2.*np.pi/limx[1] - 2.*np.pi/limx[0])               
     1510                if dsp <= 0:
     1511                    G2frame.G2plotNB.status.SetStatusText('d = %9.5f'%dsp)
     1512                    return
     1513                try:
     1514                    q = 2.*np.pi/dsp
     1515                    xpos = G2lat.Dsp2pos(Parms,dsp)
     1516                except ValueError:      #avoid bad value
     1517                    G2frame.G2plotNB.status.SetStatusText('d = %9.5f'%dsp)
     1518                    return               
     1519                dT = tolerance*xpos/dsp
    15141520            elif G2frame.Contour and 'T' in Parms['Type'][0]:
    15151521                xpos = X[int(xpos)]                   
    15161522                dsp = G2lat.Pos2dsp(Parms,xpos)
    15171523                q = 2.*np.pi/dsp
    1518                 limx = Plot.get_xlim()
    1519                 wid = np.fabs(limx[1]-limx[0])
    15201524            else:
    15211525                dsp = G2lat.Pos2dsp(Parms,xpos)
    15221526                q = 2.*np.pi/dsp
    1523                 limx = Plot.get_xlim()
    1524                 wid = np.fabs(limx[1]-limx[0])
    15251527            if G2frame.Contour: #PWDR only
    15261528                if 'C' in Parms['Type'][0]:
     
    15551557                if pickIdText in ['Index Peak List','Unit Cells List',]:
    15561558                    indx = -2
    1557                 found = G2frame.HKL[np.where(np.fabs(G2frame.HKL.T[indx]-xpos) < 0.005*wid)] # finds reflections within 1% of plot range
     1559                # finds reflections within 1% of plot range in units of plot
     1560                found = G2frame.HKL[np.where(np.fabs(G2frame.HKL.T[indx]-xpos) < dT/2.)]
    15581561                if len(found):
    15591562                    if len(found[0]) > 6:   #SS reflections
Note: See TracChangeset for help on using the changeset viewer.