Changeset 756


Ignore:
Timestamp:
Sep 11, 2012 2:28:29 PM (11 years ago)
Author:
vondreele
Message:

change display of density maps - now faster
implement a view direction command (not succcessfuly so far)

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r755 r756  
    3939                'rho':[],'rhoMax':0.,'mapSize':10.0,'cutOff':50.,'Flip':False}
    4040# trig functions in degrees
    41 sind = lambda x: math.sin(x*math.pi/180.)
    42 tand = lambda x: math.tan(x*math.pi/180.)
    43 cosd = lambda x: math.cos(x*math.pi/180.)
    44 asind = lambda x: 180.*math.asin(x)/math.pi
     41sind = lambda x: np.sin(x*np.pi/180.)
     42tand = lambda x: np.tan(x*np.pi/180.)
     43cosd = lambda x: np.cos(x*np.pi/180.)
     44asind = lambda x: 180.*np.arcsin(x)/np.pi
     45acosd = lambda x: 180.*np.arccos(x)/np.pi
    4546
    4647class SymOpDialog(wx.Dialog):
     
    25812582               
    25822583            def OnViewDir(event):
     2584                event.Skip()
    25832585                Obj = event.GetEventObject()
    25842586                viewDir = Obj.GetValue().split()
    25852587                try:
    2586                     VD = [float(viewDir[i]) for i in range(3)]
     2588                    Amat,Bmat = G2lat.cell2AB(generalData['Cell'][1:7])
     2589                    VD = np.array([float(viewDir[i]) for i in range(3)])
     2590#                    VD = np.inner(Amat,VD)
     2591                    VD /= np.sqrt(np.sum(VD**2))
     2592                    V = np.array(drawingData['viewDir'])
     2593#                    V = np.inner(Amat,V)
     2594                    V /= np.sqrt(np.sum(V**2))
     2595                    A = acosd(np.sum(V*VD))
     2596                    VX = np.cross(V,VD)
     2597                    QV = G2mth.AVdeg2Q(A,VX)
     2598                    Q = drawingData['Quaternion']
     2599                    drawingData['Quaternion'] = G2mth.prodQQ(Q,QV)
    25872600                except (ValueError,IndexError):
    25882601                    VD = drawingData['viewDir']
    25892602                Obj.SetValue('%.3f %.3f %.3f'%(VD[0],VD[1],VD[2]))
    2590                 drawingData['viewDir'] = VP
     2603                drawingData['viewDir'] = VD
    25912604                G2plt.PlotStructure(G2frame,data)
    25922605                               
  • trunk/GSASIIplot.py

    r755 r756  
    23912391        if key in ['C']:
    23922392            drawingData['viewPoint'] = [[.5,.5,.5],[0,0]]
    2393             VD = np.inner(Bmat,np.array([0,0,1]))
    2394             VD /= np.sqrt(np.sum(VD**2))
    2395             drawingData['viewDir'] = VD
     2393            drawingData['viewDir'] = [0.,0.,1]
    23962394            drawingData['oldxy'] = []
    23972395            drawingData['Quaternion'] = [0.0,0.0,1.0,0.0]
     
    27372735        glPopMatrix()
    27382736       
     2737    def RenderDots(XYZ,RC):
     2738        glEnable(GL_COLOR_MATERIAL)
     2739        XYZ = np.array(XYZ)
     2740        glPushMatrix()
     2741        for xyz,rc in zip(XYZ,RC):
     2742            x,y,z = xyz
     2743            r,c = rc
     2744            glColor3ubv(c)
     2745            glPointSize(r*50)
     2746            glBegin(GL_POINTS)
     2747            glVertex3fv(xyz)
     2748            glEnd()
     2749        glPopMatrix()
     2750        glColor4ubv([0,0,0,0])
     2751        glDisable(GL_COLOR_MATERIAL)
     2752       
    27392753    def RenderSmallSphere(x,y,z,radius,color):
    27402754        glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,color)
     
    27452759        gluSphere(q,radius,4,2)
    27462760        glPopMatrix()
    2747        
     2761               
    27482762    def RenderEllipsoid(x,y,z,ellipseProb,E,R4,color):
    27492763        s1,s2,s3 = E
     
    28492863    def RenderMap(rho,rhoXYZ,indx,Rok):
    28502864        cLevel = drawingData['contourLevel']
     2865        XYZ = []
     2866        RC = []
    28512867        for i,xyz in enumerate(rhoXYZ):
    28522868            if not Rok[i]:
     
    28572873                    alpha = (abs(rho[I,J,K])/mapData['rhoMax']-cLevel)/(1.-cLevel)
    28582874                if rho[I,J,K] < 0.:
    2859                     RenderSmallSphere(x,y,z,0.1*alpha,Rd)
     2875                    XYZ.append(xyz)
     2876                    RC.append([0.1*alpha,Rd])
    28602877                else:
    2861                     RenderSmallSphere(x,y,z,0.1*alpha,Gr)
     2878                    XYZ.append(xyz)
     2879                    RC.append([0.1*alpha,Gr])
     2880        RenderDots(XYZ,RC)
    28622881                           
    28632882    def Draw():
     
    30523071    Page.SetFocus()
    30533072    if mapData['Flip']:
     3073        choice = [' save as/key:','jpeg','tiff','bmp','u: roll up','d: roll down','l: roll left','r: roll right']
     3074    else:
    30543075        choice = [' save as/key:','jpeg','tiff','bmp','c: center on 1/2,1/2,1/2','n: next','p: previous']
    3055     else:
    3056         choice = [' save as/key:','jpeg','tiff','bmp','u: roll up','d: roll down','l: roll left','r: roll right']
    30573076    cb = wx.ComboBox(G2frame.G2plotNB.status,style=wx.CB_DROPDOWN|wx.CB_READONLY,choices=choice)
    30583077    cb.Bind(wx.EVT_COMBOBOX, OnKeyBox)
Note: See TracChangeset for help on using the changeset viewer.