Changeset 3175


Ignore:
Timestamp:
Dec 6, 2017 9:19:46 AM (4 years ago)
Author:
vondreele
Message:

correct plotting errors in PlotPeakWidths?, add cursor report of position & update plot after inst parm changes to profile shape.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIplot.py

    r3156 r3175  
    7171npatand = lambda x: 180.*np.arctan(x)/np.pi
    7272npatan2d = lambda x,y: 180.*np.arctan2(x,y)/np.pi
     73sq8ln2 = np.sqrt(8.0*np.log(2.0))
    7374if '2' in platform.python_version_tuple()[0]:
    7475    GkDelta = unichr(0x0394)
    7576    Gkrho = unichr(0x03C1)
    7677    super2 = unichr(0xb2)
     78    Angstr = unichr(0x00c5)
     79    Pwrm1 = unichr(0x207b)+unichr(0x0b9)
    7780else:
    7881    GkDelta = chr(0x0394)
    7982    Gkrho = chr(0x03C1)
    8083    super2 = chr(0xb2)
     84    Angstr = chr(0x00c5)
     85    Pwrm1 = chr(0x207b)+chr(0x0b9)
    8186nxs = np.newaxis
    8287#    GSASIIpath.IPyBreak()
     
    34173422#    gamFW = lambda s,g: np.exp(np.log(s**5+2.69269*s**4*g+2.42843*s**3*g**2+4.47163*s**2*g**3+0.07842*s*g**4+g**5)/5.)
    34183423#    gamFW2 = lambda s,g: math.sqrt(s**2+(0.4654996*g)**2)+.5345004*g  #Ubaldo Bafile - private communication
     3424    def OnMotion(event):
     3425        xpos = event.xdata
     3426        if xpos:                                        #avoid out of frame mouse position
     3427            ypos = event.ydata
     3428            G2frame.G2plotNB.status.SetStatusText('q =%.3f%s %sq/q =%.4f'%(xpos,Angstr+Pwrm1,GkDelta,ypos),1)                   
     3429
    34193430    if PatternName:
    34203431        G2frame.PatternId = G2gd.GetGPXtreeItemId(G2frame, G2frame.root, PatternName)
     
    34453456    xylim = []
    34463457    new,plotNum,Page,Plot,lim = G2frame.G2plotNB.FindPlotTab('Peak Widths','mpl')
     3458    Page.canvas.mpl_connect('motion_notify_event', OnMotion)
    34473459    if not new:
    34483460        if not G2frame.G2plotNB.allowZoomReset: # save previous limits
     
    34723484        s = np.sqrt(data[4])*np.pi/18000.   #var -> sig(radians)
    34733485        g = data[6]*np.pi/18000.    #centideg -> radians
    3474         G = G2pwd.getgamFW(g,s)/2.  #delt-theta
    3475         Y = s/nptand(X/2.)
     3486        G = G2pwd.getgamFW(g,s)     #/2.  #delt-theta from TCH fxn
     3487        Y = sq8ln2*s/nptand(X/2.)
    34763488        Z = g/nptand(X/2.)
    34773489        W = G/nptand(X/2.)
     
    34833495        sf = np.sqrt(fit[4])*np.pi/18000.
    34843496        gf = fit[6]*np.pi/18000.
    3485         Gf = G2pwd.getgamFW(gf,sf)/2.
    3486         Yf = sf/nptand(X/2.)
     3497        Gf = G2pwd.getgamFW(gf,sf)      #/2.
     3498        Yf = sq8ln2*sf/nptand(X/2.)
    34873499        Zf = gf/nptand(X/2.)
    34883500        Wf = Gf/nptand(X/2.)
     
    35023514                s = 0.01
    35033515            g = peak[6]*math.pi/18000.
    3504             G = G2pwd.getgamFW(g,s)/2.
    3505             Y.append(s/tand(peak[0]/2.))
     3516            G = G2pwd.getgamFW(g,s)         #/2.
     3517            Y.append(sq8ln2*s/tand(peak[0]/2.))
    35063518            Z.append(g/tand(peak[0]/2.))
    35073519            W.append(G/tand(peak[0]/2.))
  • trunk/GSASIIpwdGUI.py

    r3173 r3175  
    16781678        updateData(insVal,insRef)
    16791679       
     1680    def NewProfile(invalid,value,tc):
     1681        if invalid: return
     1682        updateData(insVal,insRef)
     1683        G2plt.PlotPeakWidths(G2frame)
     1684       
    16801685    def OnItemRef(event):
    16811686        Obj = event.GetEventObject()
     
    18041809                    refFlgElem.append([item,2])
    18051810                    instSizer.Add(wx.StaticText(G2frame.dataWindow,-1,lblWdef(item,nDig[1],insDef[item])),0,WACV)
    1806                     itemVal = G2G.ValidatedTxtCtrl(G2frame.dataWindow,insVal,item,nDig=nDig,typeHint=float,OnLeave=AfterChange)
     1811                    itemVal = G2G.ValidatedTxtCtrl(G2frame.dataWindow,insVal,item,nDig=nDig,typeHint=float,OnLeave=NewProfile)
    18071812                    instSizer.Add(itemVal,0,WACV)
    18081813                    instSizer.Add(RefineBox(item),0,WACV)
Note: See TracChangeset for help on using the changeset viewer.