Changeset 3150


Ignore:
Timestamp:
Nov 4, 2017 10:14:33 AM (6 years ago)
Author:
vondreele
Message:

fix plotting of inverse pole figures now h-axis horizontal, k-axis "up" and view down l-axis. Reflection marks on Data IPFs not right yet, but cursor position is correct.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIplot.py

    r3138 r3150  
    36043604            if r <= 1.0:
    36053605                if 'equal' in G2frame.Projection:
    3606                     r,p = 2.*npasind(np.sqrt(r)*sq2),npatan2d(ypos,xpos)
     3606                    r,p = 2.*npasind(np.sqrt(r)*sq2),npatan2d(xpos,ypos)
    36073607                else:
    3608                     r,p = 2.*npatand(np.sqrt(r)),npatan2d(ypos,xpos)
     3608                    r,p = 2.*npatand(np.sqrt(r)),npatan2d(xpos,ypos)
    36093609                if p<0.:
    36103610                    p += 360.
    36113611                ipf = lut(r*np.pi/180.,p*np.pi/180.)
    3612                 xyz = np.inner(Bmat.T,np.array([rp2xyz(r,p)]))
     3612                p = 90.-p
     3613                if p<0.:
     3614                    p += 360.
     3615                xyz = np.inner(Bmat,np.array([rp2xyz(r,p)]))
    36133616                x,y,z = list(xyz/np.max(np.abs(xyz)))
    36143617                G2frame.G2plotNB.status.SetStatusText(
     
    36493652    PHI = np.linspace(0.,360.,30,True)
    36503653    PSI = np.linspace(0.,180.,30,True)
    3651     X = np.outer(npsind(PHI),npsind(PSI))
    3652     Y = np.outer(npcosd(PHI),npsind(PSI))
     3654    X = np.outer(npcosd(PHI),npsind(PSI))
     3655    Y = np.outer(npsind(PHI),npsind(PSI))
    36533656    Z = np.outer(np.ones(np.size(PHI)),npcosd(PSI))
    36543657    try:        #temp patch instead of 'mustrain' for old files with 'microstrain'
     
    37993802        Rmd = np.where(Rmd<0.,0.,Rmd)
    38003803        if 'equal' in G2frame.Projection:
    3801             x,y = np.tan(Beta/2.)*np.cos(Phi),np.tan(Beta/2.)*np.sin(Phi)       
     3804            x,y = np.sin(Beta)*np.cos(Phi),np.sin(Beta)*np.sin(Phi)       
    38023805        else:
    38033806            x,y = np.tan(Beta/2.)*np.cos(Phi),np.tan(Beta/2.)*np.sin(Phi)       
     
    38053808        npts = 201
    38063809        X,Y = np.meshgrid(np.linspace(1.,-1.,npts),np.linspace(-1.,1.,npts))
    3807         R,P = np.sqrt(X**2+Y**2).flatten(),npatan2d(X,Y).flatten()
     3810        R,P = np.sqrt(X**2+Y**2).flatten(),npatan2d(Y,X).flatten()
    38083811        P=np.where(P<0.,P+360.,P)
    38093812        if 'equal' in G2frame.Projection:
     
    38223825                    sfac *= 1.05
    38233826            Z = [lut(ri*np.pi/180.,p*np.pi/180.) for ri,p in zip(list(R),list(P))]
    3824             print ('IVP for histogramn: %s: interpolate sfactor: %.2f'%(hist,sfac))
     3827#            print ('IVP for histogramn: %s: interpolate sfactor: %.2f'%(hist,sfac))
    38253828        except AttributeError:
    38263829            G2frame.G2plotNB.Delete(plotType)
     
    38363839        acolor = mpl.cm.get_cmap(G2frame.ContourColor)
    38373840        Img = Plot.imshow(Z.T,aspect='equal',cmap=acolor,extent=[-1,1,-1,1])
    3838         Plot.plot(-x,y,'+',picker=3)
     3841        Plot.plot(y,x,'+',picker=3)
    38393842        Page.figure.colorbar(Img)
    38403843        Plot.axis('off')
     
    38823885                if r <= 1.0:
    38833886                    if 'equal' in G2frame.Projection:
    3884                         r,p = 2.*npasind(np.sqrt(r)*sq2),npatan2d(ypos,xpos)
     3887                        r,p = 2.*npasind(np.sqrt(r)*sq2),npatan2d(xpos,ypos)
    38853888                    else:
    3886                         r,p = 2.*npatand(np.sqrt(r)),npatan2d(ypos,xpos)
     3889                        r,p = 2.*npatand(np.sqrt(r)),npatan2d(xpos,ypos)
    38873890                    ipf = G2lat.invpolfcal(IODFln,SGData,np.array([r,]),np.array([p,]))
    38883891                    xyz = np.inner(Bmat,np.array([rp2xyz(r,p)]))
    3889                     y,x,z = list(xyz/np.max(np.abs(xyz)))
     3892                    x,y,z = list(xyz/np.max(np.abs(xyz)))
    38903893                   
    38913894                    G2frame.G2plotNB.status.SetStatusText(
     
    39433946        if 'Inverse' in SHData['PlotType']:
    39443947            X,Y = np.meshgrid(np.linspace(1.,-1.,npts),np.linspace(-1.,1.,npts))
    3945             R,P = np.sqrt(X**2+Y**2).flatten(),npatan2d(X,Y).flatten()
     3948            R,P = np.sqrt(X**2+Y**2).flatten(),npatan2d(Y,X).flatten()
    39463949            if 'equal' in G2frame.Projection:
    39473950                R = np.where(R <= 1.,2.*npasind(R*sq2),0.0)
Note: See TracChangeset for help on using the changeset viewer.