Changeset 3153 for trunk/GSASIIplot.py


Ignore:
Timestamp:
Nov 13, 2017 2:31:44 PM (6 years ago)
Author:
vondreele
Message:

Add choice of setero projection & equal area inv. pole figures in Phase/Data? window
make inv. pole fig plotting/tool tip & cursor position all agree. Use proper coordinate system for cursor position.
NB: k-axis horizontal; h-axis up, so one is looking down l-axis for inv. pole figs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIplot.py

    r3151 r3153  
    35833583   
    35843584    def OnPick(event):
    3585         if plotType not in ['Inv. pole figure',]:
     3585        if 'Inv. pole figure' not in plotType:
    35863586            return
    35873587        ind = event.ind[0]
     
    35963596       
    35973597    def OnMotion(event):
    3598         if plotType not in ['Inv. pole figure',]:
     3598        if 'Inv. pole figure' not in plotType:
    35993599            return
    36003600        if event.xdata and event.ydata:                 #avoid out of frame errors
     
    36033603            r = xpos**2+ypos**2
    36043604            if r <= 1.0:
    3605                 if 'equal' in G2frame.Projection:
     3605                if 'Eq. area' in plotType:
    36063606                    r,p = 2.*npasind(np.sqrt(r)*sq2),npatan2d(xpos,ypos)
    36073607                else:
     
    36133613                if p<0.:
    36143614                    p += 360.
    3615                 xyz = np.inner(Bmat,np.array([rp2xyz(r,p)]))
    3616                 x,y,z = list(xyz/np.max(np.abs(xyz)))
     3615                xyz = np.inner(Amat,np.array([rp2xyz(r,p)]))
     3616                y,x,z = list(xyz/np.max(np.abs(xyz)))
    36173617                G2frame.G2plotNB.status.SetStatusText(
    36183618                    'psi =%9.3f, beta =%9.3f, MRD =%9.3f hkl=%5.2f,%5.2f,%5.2f'%(r,p,ipf,x,y,z),1)
     
    36293629    phase = generalData['Name']
    36303630    plotType = generalData['Data plot type']
    3631     plotDict = {'Mustrain':'Mustrain','Size':'Size','Preferred orientation':'Pref.Ori.','Inv. pole figure':''}
     3631    plotDict = {'Mustrain':'Mustrain','Size':'Size','Preferred orientation':'Pref.Ori.',
     3632        'St. proj. Inv. pole figure':'','Eq. area Inv. pole figure':''}
    36323633    for ptype in plotDict:
    36333634        G2frame.G2plotNB.Delete(ptype)
     
    37593760            Plot.set_xlabel(r'$\psi$',fontsize=16)
    37603761            Plot.set_ylabel('MRD',fontsize=14)
    3761     elif plotType in ['Inv. pole figure',]:
     3762    elif 'Inv. pole figure' in plotType:
     3763        sq2 = 1.0/math.sqrt(2.0)
    37623764        Id = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,hist)
    37633765        rId = G2gd.GetGPXtreeItemId(G2frame,Id,'Reflection Lists')
     
    38013803        Rmd = np.array(Rmd)
    38023804        Rmd = np.where(Rmd<0.,0.,Rmd)
    3803         if 'equal' in G2frame.Projection:
    3804             x,y = np.sin(Beta)*np.cos(Phi),np.sin(Beta)*np.sin(Phi)       
     3805        if 'Eq. area' in plotType:
     3806            x,y = np.sin(Beta/2.)*np.cos(Phi)/sq2,np.sin(Beta/2.)*np.sin(Phi)/sq2       
    38053807        else:
    38063808            x,y = np.tan(Beta/2.)*np.cos(Phi),np.tan(Beta/2.)*np.sin(Phi)       
    3807         sq2 = 1.0/math.sqrt(2.0)
    38083809        npts = 201
    38093810        X,Y = np.meshgrid(np.linspace(1.,-1.,npts),np.linspace(-1.,1.,npts))
    38103811        R,P = np.sqrt(X**2+Y**2).flatten(),npatan2d(Y,X).flatten()
    38113812        P=np.where(P<0.,P+360.,P)
    3812         if 'equal' in G2frame.Projection:
     3813        if 'Eq. area' in plotType:
    38133814            R = np.where(R <= 1.,2.*npasind(R*sq2),0.0)
    38143815        else:
    38153816            R = np.where(R <= 1.,2.*npatand(R),0.0)
    38163817        Z = np.zeros_like(R)
    3817 #        GSASIIpath.IPyBreak()
    38183818        try:
    38193819            sfac = 0.1
     
    38893889                        r,p = 2.*npatand(np.sqrt(r)),npatan2d(xpos,ypos)
    38903890                    ipf = G2lat.invpolfcal(IODFln,SGData,np.array([r,]),np.array([p,]))
    3891                     xyz = np.inner(Bmat,np.array([rp2xyz(r,p)]))
    3892                     x,y,z = list(xyz/np.max(np.abs(xyz)))
     3891                    xyz = np.inner(Amat,np.array([rp2xyz(r,p)]))
     3892                    y,x,z = list(xyz/np.max(np.abs(xyz)))
    38933893                   
    38943894                    G2frame.G2plotNB.status.SetStatusText(
Note: See TracChangeset for help on using the changeset viewer.