Changeset 48 for trunk/GSASIIplot.py


Ignore:
Timestamp:
Apr 12, 2010 1:56:43 PM (13 years ago)
Author:
vondreel
Message:

finished ellipse fitting
finished integration range display

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIplot.py

    r47 r48  
    186186                    ypos = event.ydata-ycent
    187187                    if 'line3' in  str(item) or 'line4' in str(item) and not Data['fullIntegrate']:
    188                         ang = int(atan2d(-ypos,xpos))
     188                        ang = int(atan2d(xpos,ypos))
    189189                        imgPage.canvas.SetToolTipString('%6d deg'%(ang))
    190                     elif 'inner' in  str(item.get_gid()) or 'outer' in str(item.get_gid()):
     190                    elif 'line1' in  str(item) or 'line2' in str(item):
    191191                        tth = G2cmp.GetTth(event.xdata,event.ydata,Data)
    192192                        imgPage.canvas.SetToolTipString('%8.3fdeg'%(tth))                           
     
    335335        IOtth = Data['IOtth']
    336336        wave = Data['wavelength']
    337         dsp = wave/(2.0*sind(IOtth[0]/2.0))
    338         ell0 = G2cmp.GetEllipse(dsp,Data)           #=False if dsp didn't yield an ellipse (ugh! a parabola or a hyperbola)
    339         dsp = wave/(2.0*sind(IOtth[1]/2.0))
    340         ell1 = G2cmp.GetEllipse(dsp,Data)           #Ditto & more likely for outer ellipse
     337        dspI = wave/(2.0*sind(IOtth[0]/2.0))
     338        ellI = G2cmp.GetEllipse(dspI,Data)           #=False if dsp didn't yield an ellipse (ugh! a parabola or a hyperbola)
     339        dspO = wave/(2.0*sind(IOtth[1]/2.0))
     340        ellO = G2cmp.GetEllipse(dspO,Data)           #Ditto & more likely for outer ellipse
    341341        if Data['fullIntegrate']:
    342             arcxI = arcyI = np.array(range(0,361))
    343             arcxO = arcyO = np.array(range(0,361))
     342            Azm = np.array(range(0,361))
    344343        else:
    345             arcxI = arcyI = np.array(range(LRAzim[0],LRAzim[1]+1))
    346             arcxO = arcyO = np.array(range(LRAzim[0],LRAzim[1]+1))
    347         if ell0:
    348             cent0,phi0,radii0 = ell0
    349             radii0 = np.sum(G2cmp.makeMat(phi0,2).T*np.array(radii0+[0.,]),axis=1)
    350             arcxI = np.cos(arcxI*math.pi/180.)*radii0[0]+cent0[0]
    351             arcyI = np.sin(arcyI*math.pi/180.)*radii0[1]+cent0[1]
     344            Azm = np.array(range(LRAzim[0],LRAzim[1]+1))
     345        if ellI:
     346            xyI = []
     347            for azm in Azm:
     348                xyI.append(G2cmp.GetDetectorXY(dspI,azm,Data))
     349            xyI = np.array(xyI)
     350            arcxI,arcyI = xyI.T
    352351            imgPlot.plot(arcxI,arcyI,picker=3)
    353         if ell1:
    354             cent1,phi1,radii1 = ell1
    355             radii1 = np.sum(G2cmp.makeMat(phi1,2).T*np.array(radii1+[0.,]),axis=1)
    356             arcxO = np.cos(arcxO*math.pi/180.)*radii1[0]+cent1[0]
    357             arcyO = np.sin(arcyO*math.pi/180.)*radii1[1]+cent1[1]
    358             imgPlot.plot(arcxO,arcyO,picker=3)       
    359         if ell0 and ell1 and not Data['fullIntegrate']:
     352        if ellO:
     353            xyO = []
     354            for azm in Azm:
     355                xyO.append(G2cmp.GetDetectorXY(dspO,azm,Data))
     356            xyO = np.array(xyO)
     357            arcxO,arcyO = xyO.T
     358            imgPlot.plot(arcxO,arcyO,picker=3)
     359        if ellO and ellI and not Data['fullIntegrate']:
    360360            imgPlot.plot([arcxI[0],arcxO[0]],[arcyI[0],arcyO[0]],picker=3)
    361361            imgPlot.plot([arcxI[-1],arcxO[-1]],[arcyI[-1],arcyO[-1]],picker=3)
     
    363363        imgPlot.text(xring,yring,'+',color='b',ha='center',va='center',picker=3)
    364364    if Data['setRings']:
    365         rings = Data['rings']
    366         for xring,yring,tth in rings:
     365        rings = np.concatenate((Data['rings']),axis=0)
     366        for xring,yring,dsp in rings:
    367367            imgPlot.text(xring,yring,'+',ha='center',va='center')           
    368368    for ellipse in Data['ellipses']:
Note: See TracChangeset for help on using the changeset viewer.