Changeset 3425


Ignore:
Timestamp:
Jun 8, 2018 8:53:57 AM (5 years ago)
Author:
vondreele
Message:

use nxs = np.newaxis in G2spc.
Add 2 functions for checking symm extinct reflections (not in use yet)
fix wx.Colour object showing up in gpx file problem - convert to list[:3] (takes off alpha)

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r3418 r3425  
    58245824           
    58255825            def OnBackColor(event):
    5826                 drawingData['backColor'] = event.GetValue()
     5826                drawingData['backColor'] = list(event.GetValue())[:3]
    58275827                G2plt.PlotStructure(G2frame,data)
    58285828   
     
    59795979           
    59805980            def OnPlaneColor(event):
    5981                 drawingData['Plane'][4] = event.GetValue()
     5981                drawingData['Plane'][4] = list(event.GetValue())[:3]
    59825982                G2plt.PlotStructure(G2frame,data)
    59835983
  • trunk/GSASIIplot.py

    r3403 r3425  
    30963096        '''Respond to a change in color
    30973097        '''
    3098         lbl = plotOpt['colorButtons'].get(event.GetEventObject())
     3098        lbl = plotOpt['colorButtons'].get(list(event.GetEventObject())[:3])
    30993099        if lbl is None:
    31003100            print('Unexpected button',lbl)
  • trunk/GSASIIspc.py

    r3418 r3425  
    2828npsind = lambda x: np.sin(x*np.pi/180.)
    2929npcosd = lambda x: np.cos(x*np.pi/180.)
     30nxs = np.newaxis
    3031DEBUG = False
    3132   
     
    19611962            return True
    19621963       
     1964def checkHKLextc(HKL,SGData):
     1965    Ops = SGData['SGOps']
     1966    OpM = np.array([op[0] for op in Ops])
     1967    OpT = np.array([op[1] for op in Ops])
     1968    HKLS = np.array([HKL,-HKL])     #Freidel's Law
     1969    DHKL = np.reshape(np.inner(HKLS,OpM)-HKL,(-1,3))
     1970    PHKL = np.reshape(np.inner(HKLS,OpT),(-1,))
     1971    for dhkl,phkl in zip(DHKL,PHKL)[1:]:    #skip identity
     1972        if dhkl.any():
     1973            continue
     1974        else:
     1975            if phkl%1.:
     1976                return False
     1977    return True
     1978
     1979def checkMagextc(HKL,SGData):
     1980    Ops = SGData['SGOps']
     1981    Spn = SGData['SpnFlp'][:len(Ops)]
     1982    OpM = np.array([op[0] for op in Ops])
     1983    OpT = np.array([op[1] for op in Ops])
     1984    Mag = np.array([nl.det(opm) for opm in OpM])*Spn
     1985    HKLS = np.array([HKL,-HKL])     #Freidel's Law
     1986    DHKL = np.reshape(np.inner(HKLS,OpM)*Mag[nxs,:,nxs],(-1,3))
     1987    PHKL = np.reshape(np.inner(HKLS,OpT),(-1,))
     1988    for dhkl,phkl in zip(DHKL,PHKL)[1:]:    #skip identity
     1989        if not np.allclose(dhkl,HKL):
     1990            continue
     1991        else:
     1992            print(dhkl,HKL,phkl)
     1993            if phkl%1.:
     1994                return False
     1995    return True
    19631996   
    19641997def checkSSextc(HKL,SSGData):
     
    22772310       
    22782311    def fracCrenel(tau,Toff,Twid):
    2279         Tau = (tau-Toff[:,np.newaxis])%1.
    2280         A = np.where(Tau<Twid[:,np.newaxis],1.,0.)
     2312        Tau = (tau-Toff[:,nxs])%1.
     2313        A = np.where(Tau<Twid[:,nxs],1.,0.)
    22812314        return A
    22822315       
     
    22842317        SA = np.sin(2.*nH*np.pi*tau)
    22852318        CB = np.cos(2.*nH*np.pi*tau)
    2286         A = SA[np.newaxis,np.newaxis,:]*fsin[:,:,np.newaxis]
    2287         B = CB[np.newaxis,np.newaxis,:]*fcos[:,:,np.newaxis]
     2319        A = SA[nxs,nxs,:]*fsin[:,:,nxs]
     2320        B = CB[nxs,nxs,:]*fcos[:,:,nxs]
    22882321        return A+B
    22892322       
     
    22912324        SA = np.sin(2*nH*np.pi*tau)
    22922325        CB = np.cos(2*nH*np.pi*tau)
    2293         A = SA[np.newaxis,np.newaxis,:]*psin[:,:,np.newaxis]
    2294         B = CB[np.newaxis,np.newaxis,:]*pcos[:,:,np.newaxis]
     2326        A = SA[nxs,nxs,:]*psin[:,:,nxs]
     2327        B = CB[nxs,nxs,:]*pcos[:,:,nxs]
    22952328        return A+B   
    22962329
    22972330    def posSawtooth(tau,Toff,slopes):
    22982331        Tau = (tau-Toff)%1.
    2299         A = slopes[:,np.newaxis]*Tau
     2332        A = slopes[:,nxs]*Tau
    23002333        return A
    23012334   
     
    23802413            delt6 = np.eye(6)*0.001
    23812414            if 'Fourier' in waveType:
    2382                 dX = posFourier(tau,nH,delt6[:3],delt6[3:]) #+np.array(XYZ)[:,np.newaxis,np.newaxis]
     2415                dX = posFourier(tau,nH,delt6[:3],delt6[3:]) #+np.array(XYZ)[:,nxs,nxs]
    23832416                  #3x6x12 modulated position array (X,Spos,tau)& force positive
    23842417                CSI = [np.zeros((6,3),dtype='i'),np.zeros((6,3))]
     
    24022435                xsc = np.ones(6,dtype='i')
    24032436                if 'Fourier' in waveType:
    2404                     dXT = posFourier(np.sort(tauT),nH,delt6[:3],delt6[3:])   #+np.array(XYZ)[:,np.newaxis,np.newaxis]
     2437                    dXT = posFourier(np.sort(tauT),nH,delt6[:3],delt6[3:])   #+np.array(XYZ)[:,nxs,nxs]
    24052438                elif waveType == 'Sawtooth':
    2406                     dXT = posSawtooth(tauT,delt4[0],delt4[1:])+np.array(XYZ)[:,np.newaxis,np.newaxis]
     2439                    dXT = posSawtooth(tauT,delt4[0],delt4[1:])+np.array(XYZ)[:,nxs,nxs]
    24072440                elif waveType == 'ZigZag':
    2408                     dXT = posZigZag(tauT,delt5[:2],delt5[2:])+np.array(XYZ)[:,np.newaxis,np.newaxis]
     2441                    dXT = posZigZag(tauT,delt5[:2],delt5[2:])+np.array(XYZ)[:,nxs,nxs]
    24092442                elif waveType == 'Block':
    2410                     dXT = posBlock(tauT,delt5[:2],delt5[2:])+np.array(XYZ)[:,np.newaxis,np.newaxis]
     2443                    dXT = posBlock(tauT,delt5[:2],delt5[2:])+np.array(XYZ)[:,nxs,nxs]
    24112444                dXT = np.inner(sop[0],dXT.T)    # X modulations array(3x6x49) -> array(3x49x6)
    24122445                dXT = np.swapaxes(dXT,1,2)      # back to array(3x6x49)
     
    25922625        else:
    25932626            delt6 = np.eye(6)*0.001
    2594             dM = posFourier(tau,nH,delt6[:3],delt6[3:]) #+np.array(Mxyz)[:,np.newaxis,np.newaxis]
     2627            dM = posFourier(tau,nH,delt6[:3],delt6[3:]) #+np.array(Mxyz)[:,nxs,nxs]
    25952628              #3x6x12 modulated moment array (M,Spos,tau)& force positive
    25962629            CSI = [np.zeros((6,3),dtype='i'),np.zeros((6,3))]
     
    26022635                sdet,ssdet,dtau,dT,tauT = getTauT(tau,sop,ssop,XYZ)
    26032636                msc = np.ones(6,dtype='i')
    2604                 dMT = posFourier(np.sort(tauT),nH,delt6[:3],delt6[3:])   #+np.array(XYZ)[:,np.newaxis,np.newaxis]
     2637                dMT = posFourier(np.sort(tauT),nH,delt6[:3],delt6[3:])   #+np.array(XYZ)[:,nxs,nxs]
    26052638                dMT = np.inner(sop[0],dMT.T)    # X modulations array(3x6x49) -> array(3x49x6)
    26062639                dMT = np.swapaxes(dMT,1,2)      # back to array(3x6x49)
     
    28932926        U = np.inner(A.T,H)
    28942927        S = np.array(MustrainCoeff(U,SGData))
    2895         Sum = np.sqrt(np.sum(np.multiply(S,Shkl[:,np.newaxis]),axis=0))
    2896         rad = np.sqrt(np.sum((Sum[:,np.newaxis]*H)**2,axis=1))
     2928        Sum = np.sqrt(np.sum(np.multiply(S,Shkl[:,nxs]),axis=0))
     2929        rad = np.sqrt(np.sum((Sum[:,nxs]*H)**2,axis=1))
    28972930        return (muiso-rad)**2
    28982931       
Note: See TracChangeset for help on using the changeset viewer.