Changeset 3266 for trunk


Ignore:
Timestamp:
Feb 8, 2018 1:31:55 PM (7 years ago)
Author:
vondreele
Message:

change modulated wave type assignments so one for each kind of wave (pos, frac, etc).
implement optional display of PNT data set positions on pole figure plots. Picker displays histo. name.

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/GSASIImath.py

    r3261 r3266  
    16301630        atxyz = G2spc.MoveToUnitCell(np.array(atom[cx:cx+3]))[0]
    16311631        atuij = np.array(atom[cia+2:cia+8])
    1632         waveType = atom[-1]['SS1']['waveType']
    16331632        Sfrac = atom[-1]['SS1']['Sfrac']
    16341633        Spos = atom[-1]['SS1']['Spos']
     
    16511650                scof = []
    16521651                ccof = []
    1653                 for i,sfrac in enumerate(Sfrac):
     1652                waveType = Sfrac[0]
     1653                for i,sfrac in enumerate(Sfrac[1:]):
    16541654                    if not i and 'Crenel' in waveType:
    16551655                        Fade[ind] += fracCrenel(tauT,sfrac[0][0],sfrac[0][1])
     
    16621662                scof = []
    16631663                ccof = []
    1664                 for i,spos in enumerate(Spos):
     1664                waveType = Spos[0]
     1665                for i,spos in enumerate(Spos[1:]):
    16651666                    if waveType in ['ZigZag','Block'] and not i:
    16661667                        Tminmax = spos[0][:2]
     
    16781679                scof = []
    16791680                ccof = []
    1680                 for i,spos in enumerate(Smag):
     1681                waveType = Smag[0]
     1682                for i,spos in enumerate(Smag[1:]):
    16811683                    scof.append(spos[0][:3])
    16821684                    ccof.append(spos[0][3:])
     
    16891691                scof = []
    16901692                ccof = []
    1691                 for i,sadp in enumerate(Sadp):
     1693                waveType = Sadp[0]
     1694                for i,sadp in enumerate(Sadp[1:]):
    16921695                    scof.append(sadp[0][:6])
    16931696                    ccof.append(sadp[0][6:])
  • TabularUnified trunk/GSASIIphsGUI.py

    r3258 r3266  
    11771177                generalData['4DmapData'] = mapDefault.copy()
    11781178                generalData['4DmapData'].update({'MapType':'Fobs'})
     1179            atomData = data['Atoms']
     1180            for atom in atomData:
     1181                if 'waveType' in atom[-1]['SS1']:
     1182                    waveType = atom[-1]['SS1']['waveType']
     1183                    for parm in ['Sfrac','Spos','Sadp','Smag']:
     1184                        if len(atom[-1]['SS1'][parm]):
     1185                            wType = 'Fourier'
     1186                            if parm == 'Sfrac':
     1187                                if 'Crenel' in waveType:
     1188                                    wType = 'Crenel'
     1189                            elif parm == 'Spos':
     1190                                if not 'Crenel' in waveType:
     1191                                    wType = waveType
     1192                            atom[-1]['SS1'][parm] = [wType,]+atom[-1]['SS1'][parm]
     1193                    del atom[-1]['SS1']['waveType']
    11791194        if 'Modulated' not in generalData:
    11801195            generalData['Modulated'] = False
     
    22222237
    22232238        # UpdateGeneral execution starts here
     2239#patches       
     2240        if 'Pawley dmax' not in data['General']:
     2241            data['General']['Pawley dmax'] = 100.0
     2242        if 'SGFixed' not in data['General']['SGData']:
     2243            data['General']['SGData']['SGFixed'] = False
     2244        if 'SGGray' not in data['General']['SGData']:
     2245            data['General']['SGData']['SGGray'] = False
     2246#end patches       
    22242247        if General.GetSizer():
    22252248            General.GetSizer().Clear(True)
     
    22392262            mainSizer.Add(ElemSizer())
    22402263        G2G.HorizontalLine(mainSizer,General)
    2241 #patches       
    2242         if 'Pawley dmax' not in generalData:
    2243             generalData['Pawley dmax'] = 100.0
    2244         if 'SGFixed' not in generalData['SGData']:
    2245             generalData['SGData']['SGFixed'] = False
    2246         if 'SGGray' not in generalData['SGData']:
    2247             generalData['SGData']['SGGray'] = False
    2248 #end patches       
    22492264        if generalData['Type'] == 'magnetic':
    22502265            if not generalData['SGData']['SGFixed']:
     
    45824597        cx,ct,cs,cia = generalData['AtomPtrs']
    45834598        typeNames = {'Sfrac':' Site fraction','Spos':' Position','Sadp':' Thermal motion','Smag':' Magnetic moment'}
    4584         numVals = {'Sfrac':2,'Spos':6,'Sadp':12,'Smag':6,'ZigZag':5,'Block':5}
     4599        numVals = {'Sfrac':2,'Spos':6,'Sadp':12,'Smag':6,'ZigZag':5,'Block':5,'Crenel':2,'SawTooth':3}
    45854600        posNames = ['Xsin','Ysin','Zsin','Xcos','Ycos','Zcos','Tmin','Tmax','Xmax','Ymax','Zmax']
    45864601        adpNames = ['U11sin','U22sin','U33sin','U12sin','U13sin','U23sin',
     
    45884603        magNames = ['MXsin','MYsin','MZsin','MXcos','MYcos','MZcos']
    45894604        fracNames = ['Fsin','Fcos','Fzero','Fwid']
    4590         waveTypes = ['Fourier','ZigZag','Block','Crenel/Fourier']
     4605        waveTypes = {'Sfrac':['Fourier','Crenel'],'Spos':['Fourier','ZigZag','Block','SawTooth'],'Sadp':['Fourier',],'Smag':['Fourier',]}
    45914606        Labels = {'Spos':posNames,'Sfrac':fracNames,'Sadp':adpNames,'Smag':magNames}
    45924607        Indx = {}
     
    46324647            def AtomSizer(atom):
    46334648               
    4634                 def OnWaveType(event):
    4635                     atom[-1]['SS1']['waveType'] = waveType.GetValue()
    4636                     atom[-1]['SS1']['Spos'] = []
    4637                     wx.CallAfter(RepaintAtomInfo,G2frame.waveData.GetScrollPos(wx.VERTICAL))               
    4638                    
    46394649                def OnShowWave(event):
    46404650                    Obj = event.GetEventObject()
     
    46454655                atomSizer = wx.BoxSizer(wx.HORIZONTAL)
    46464656                atomSizer.Add(wx.StaticText(waveData,label=
    4647                 ' Modulation data for atom: %s  Site sym: %s  WaveType: '%(atom[0],atom[cs].strip())),0,WACV)           
    4648                 waveType = wx.ComboBox(waveData,value=atom[-1]['SS1']['waveType'],choices=waveTypes,
    4649                     style=wx.CB_READONLY|wx.CB_DROPDOWN)
    4650                 waveType.Bind(wx.EVT_COMBOBOX,OnWaveType)
    4651                 atomSizer.Add(waveType,0,WACV)
     4657                ' Modulation data for atom: %s  Site sym: %s'%(atom[0],atom[cs].strip())),0,WACV)           
    46524658                axchoice = ['x','y','z']
    46534659                if len(D4Map['rho']):
     
    46604666                return atomSizer
    46614667               
    4662             def WaveSizer(iatm,waveType,waveBlk,Stype,typeName,Names):
     4668            def WaveSizer(iatm,wavedata,Stype,typeName,Names):
    46634669               
     4670                def OnWaveType(event):
     4671                    Obj = event.GetEventObject()
     4672                    item = Indx[Obj.GetId()]
     4673                    if not len(atm[-1]['SS1'][item]):
     4674                        atm[-1]['SS1']['Spos'] = [0,[]]
     4675                        atm[-1]['SS1'][Stype][0] = waveType.GetValue()
     4676                        wx.CallAfter(RepaintAtomInfo,G2frame.waveData.GetScrollPos(wx.VERTICAL))
     4677                    else:
     4678                        if len(waveTypes[Stype]) > 1:
     4679                            waveType.SetValue(atm[-1]['SS1'][Stype][0])
     4680                            G2G.G2MessageBox(G2frame,'Warning: can only change wave type if no waves','Not changed')
     4681                   
    46644682                def OnAddWave(event):
    46654683                    Obj = event.GetEventObject()
    4666                     iatm,item = Indx[Obj.GetId()]
     4684                    item = Indx[Obj.GetId()]
    46674685                    nt = numVals[Stype]
    4668                     if not len(atomData[iatm][-1]['SS1'][item]) and waveType in ['ZigZag','Block'] and Stype == 'Spos':
    4669                         nt = numVals[waveType]
    4670                     atomData[iatm][-1]['SS1'][item].append([[0.0 for i in range(nt)],False])
     4686                    if not len(atm[-1]['SS1'][item][1]) and waveTyp in ['ZigZag','Block','Crenel','SawTooth']:
     4687                        nt = numVals[waveTyp]
     4688                    atm[-1]['SS1'][item][1].append([[0.0 for i in range(nt)],False])
    46714689                    wx.CallAfter(RepaintAtomInfo,G2frame.waveData.GetScrollPos(wx.VERTICAL))
    46724690                   
     
    46744692                    event.Skip()
    46754693                    Obj = event.GetEventObject()
    4676                     iatm,item,iwave,ival = Indx[Obj.GetId()]
     4694                    item,iwave,ival = Indx[Obj.GetId()]
    46774695                    try:
    46784696                        val = float(Obj.GetValue())
    4679                         if waveType in ['ZigZag','Block'] and Stype == 'Spos' and ival < 2 and not iwave:
     4697                        if waveTyp in ['ZigZag','Block'] and ival < 2 and not iwave:
    46804698                            if ival == 1: #Tmax
    46814699                                val = min(1.0,max(0.0,val))
    46824700                            elif ival == 0: #Tmin
    4683                                 val = max(-1.,min(val,atomData[iatm][-1]['SS1'][item][iwave][0][1]))
     4701                                val = max(-1.,min(val,atm[-1]['SS1'][item][1][iwave][1][1]))
    46844702                    except ValueError:
    4685                         val = atomData[iatm][-1]['SS1'][item][iwave][0][ival]
     4703                        val = atm[-1]['SS1'][item][iwave][1][ival]
    46864704                    Obj.SetValue('%.5f'%val)
    4687                     atomData[iatm][-1]['SS1'][item][iwave][0][ival] = val
     4705                    atm[-1]['SS1'][item][iwave][1][ival] = val
    46884706                   
    46894707                def OnRefWave(event):
    46904708                    Obj = event.GetEventObject()
    4691                     iatm,item,iwave = Indx[Obj.GetId()]
    4692                     atomData[iatm][-1]['SS1'][item][iwave][1] = not atomData[iatm][-1]['SS1'][item][iwave][1]
     4709                    item,iwave = Indx[Obj.GetId()]
     4710                    atm[-1]['SS1'][item][1][iwave][2] = not atm[-1]['SS1'][item][1][iwave][2]
    46934711                   
    46944712                def OnDelWave(event):
    46954713                    Obj = event.GetEventObject()
    4696                     iatm,item,iwave = Indx[Obj.GetId()]
    4697                     del atomData[iatm][-1]['SS1'][item][iwave]
     4714                    item,iwave = Indx[Obj.GetId()]
     4715                    del atm[-1]['SS1'][item][1][iwave]
    46984716                    wx.CallAfter(RepaintAtomInfo,G2frame.waveData.GetScrollPos(wx.VERTICAL))               
    46994717               
     4718                waveTyp,waveBlk = 'Fourier',[]
     4719                if len(wavedata):
     4720                    waveTyp = wavedata[0]
     4721                    waveBlk = wavedata[1:]
    47004722                waveSizer = wx.BoxSizer(wx.VERTICAL)
    47014723                waveHead = wx.BoxSizer(wx.HORIZONTAL)
    47024724                waveHead.Add(wx.StaticText(waveData,label=typeName+' modulation parameters: '),0,WACV)
    4703                 waveAdd = wx.CheckBox(waveData,label='Add wave?')
     4725                waveAdd = wx.CheckBox(waveData,label='Add wave?   WaveType: ')
    47044726                waveAdd.Bind(wx.EVT_CHECKBOX, OnAddWave)
    4705                 Indx[waveAdd.GetId()] = [iatm,Stype]
     4727                Indx[waveAdd.GetId()] = Stype
    47064728                waveHead.Add(waveAdd,0,WACV)
     4729                waveType = wx.ComboBox(waveData,value=waveTyp,choices=waveTypes[Stype],
     4730                    style=wx.CB_READONLY|wx.CB_DROPDOWN)
     4731                Indx[waveType.GetId()] = Stype
     4732                waveType.Bind(wx.EVT_COMBOBOX,OnWaveType)
     4733                waveHead.Add(waveType,0,WACV)
    47074734                waveSizer.Add(waveHead)
    47084735                if len(waveBlk):
     
    47104737                    for iwave,wave in enumerate(waveBlk):
    47114738                        if not iwave:
    4712                             if waveType in ['ZigZag','Block']:
     4739                            if waveTyp in ['ZigZag','Block','SawTooth','Crenel']:
    47134740                                nx = 1
    4714                             CSI = G2spc.GetSSfxuinel(waveType,1,xyz,SGData,SSGData)
     4741                            CSI = G2spc.GetSSfxuinel(waveTyp,Stype,1,xyz,SGData,SSGData)
    47154742                        else:
    4716                             CSI = G2spc.GetSSfxuinel('Fourier',iwave+1-nx,xyz,SGData,SSGData)
     4743                            CSI = G2spc.GetSSfxuinel('Fourier',Stype,iwave+1-nx,xyz,SGData,SSGData)
    47174744                        waveName = 'Fourier'
    47184745                        if Stype == 'Sfrac':
    4719                             if 'Crenel' in waveType and not iwave:
     4746                            if 'Crenel' in waveTyp and not iwave:
    47204747                                waveName = 'Crenel'
    47214748                                names = Names[2:]
     
    47244751                            Waves = wx.FlexGridSizer(0,4,5,5)
    47254752                        elif Stype == 'Spos':
    4726                             if waveType in ['ZigZag','Block'] and not iwave:
     4753                            if waveTyp in ['ZigZag','Block'] and not iwave:
    47274754                                names = Names[6:]
    47284755                                Waves = wx.FlexGridSizer(0,7,5,5)
    4729                                 waveName = waveType
     4756                                waveName = waveTyp
    47304757                            else:
    47314758                                names = Names[:6]
     
    47404767                                waveVal.Bind(wx.EVT_TEXT_ENTER,OnWaveVal)
    47414768                                waveVal.Bind(wx.EVT_KILL_FOCUS,OnWaveVal)
    4742                                 Indx[waveVal.GetId()] = [iatm,Stype,iwave,ival]
     4769                                Indx[waveVal.GetId()] = [Stype,iwave,ival]
    47434770                            else:
    47444771                                waveVal = wx.TextCtrl(waveData,value='%.5f'%(val),style=wx.TE_READONLY)
     
    47504777                        waveRef = wx.CheckBox(waveData,label='Refine?')
    47514778                        waveRef.SetValue(wave[1])
    4752                         Indx[waveRef.GetId()] = [iatm,Stype,iwave]
     4779                        Indx[waveRef.GetId()] = [Stype,iwave]
    47534780                        waveRef.Bind(wx.EVT_CHECKBOX, OnRefWave)
    47544781                        Waves.Add(waveRef,0,WACV)
     
    47574784                        else:
    47584785                            waveDel = wx.CheckBox(waveData,label='Delete?')
    4759                             Indx[waveDel.GetId()] = [iatm,Stype,iwave]
     4786                            Indx[waveDel.GetId()] = [Stype,iwave]
    47604787                            waveDel.Bind(wx.EVT_CHECKBOX, OnDelWave)
    47614788                            Waves.Add(waveDel,0,WACV)
     
    47744801                if generalData['Type'] != 'magnetic' and Stype == 'Smag':
    47754802                    break
    4776                 atomSizer.Add(WaveSizer(iatm,atm[-1]['SS1']['waveType'],atm[-1]['SS1'][Stype],Stype,typeNames[Stype],Labels[Stype]))                       
     4803               
     4804                atomSizer.Add(WaveSizer(iatm,atm[-1]['SS1'][Stype],Stype,typeNames[Stype],Labels[Stype]))                       
    47774805            return atomSizer
    47784806
     
    60866114            wx.CallAfter(G2plt.PlotTexture,G2frame,data)
    60876115           
     6116        def OnShoDet(event):
     6117            Obj = event.GetEventObject()
     6118            textureData['ShoDet'] = Obj.GetValue()
     6119            wx.CallAfter(G2plt.PlotTexture,G2frame,data)           
     6120           
    60886121        def OnColorSel(event):
    60896122            Obj = event.GetEventObject()
     
    62636296       
    62646297        # UpdateTexture executable starts here
    6265         if Texture.GetSizer(): Texture.GetSizer().Clear(True)
    6266         G2frame.GetStatusBar().SetStatusText('',1)
    62676298        generalData = data['General']       
    62686299        SGData = generalData['SGData']
     
    62726303            textureData = generalData['SH Texture'] = {'Order':0,'Model':'cylindrical',
    62736304                'Sample omega':[False,0.0],'Sample chi':[False,0.0],'Sample phi':[False,0.0],
    6274                 'SH Coeff':[False,{}],'SHShow':False,'PFhkl':[0,0,1],
     6305                'SH Coeff':[False,{}],'SHShow':False,'PFhkl':[0,0,1],'ShoDet':False,
    62756306                'PFxyz':[0,0,1.],'PlotType':'Pole figure'}
    62766307        if 'SHShow' not in textureData:
     
    62806311        if 'Penalty' not in textureData:
    62816312            textureData['Penalty'] = [['',],0.1,False,1.0]
     6313        if 'ShoDet' not in textureData:
     6314            textureData['ShoDet'] = False
    62826315        shModels = ['cylindrical','none','shear - 2/m','rolling - mmm']
    62836316        SamSym = dict(zip(shModels,['0','-1','2/m','mmm']))
     6317        keyList = G2frame.GetHistogramNames(['PWDR',])
     6318        UseList = data['Histograms']
     6319        HistsInPhase = [name for name in keyList if name in UseList]
     6320       
     6321        textureData['det Angles'] = []
     6322        for hist in HistsInPhase:
     6323            pId = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,hist)       #only use 1st histogram
     6324            Sample = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,pId,'Sample Parameters'))
     6325            Inst = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,pId,'Instrument Parameters'))[0]
     6326            textureData['det Angles'] = []
     6327            if 'NT' in Inst['Type'][0]:
     6328                Tth = Inst['2-theta'][1]/2.
     6329                Gangls = [Sample['Phi'],Sample['Chi'],Sample['Omega'],Sample['Azimuth']]
     6330                Sangls = [textureData['Sample omega'][1],textureData['Sample chi'][1],textureData['Sample phi'][1]]
     6331                phi,gam,x,x = G2lat.SamAng(Tth,Gangls,Sangls,False)
     6332                if phi > 90.:
     6333                    phi = 180.-phi
     6334                    gam += 180.
     6335                gam %= 360.
     6336                textureData['det Angles'].append([hist,phi,gam])           
     6337       
     6338        G2frame.GetStatusBar().SetStatusText('',1)
    62846339        if Texture.GetSizer():
    62856340            Texture.GetSizer().Clear(True)
     
    63266381            projSel.Bind(wx.EVT_COMBOBOX,OnProjSel)
    63276382            PTSizer.Add(projSel,0,WACV)
    6328             PTSizer.Add((0,5),0)
     6383            if textureData['PlotType'] == 'Pole figure' and len(textureData['det Angles']):
     6384                shoDet = wx.CheckBox(Texture,-1,label=' Show detectors?')
     6385                shoDet.SetValue(textureData['ShoDet'])
     6386                shoDet.Bind(wx.EVT_CHECKBOX, OnShoDet)
     6387                PTSizer.Add(shoDet,0,WACV)
     6388            else:
     6389                PTSizer.Add((0,5),0)
    63296390        if textureData['PlotType'] in ['Pole figure','Axial pole distribution','3D pole distribution']:
    63306391            PTSizer.Add(wx.StaticText(Texture,-1,' Pole figure HKL: '),0,WACV)
  • TabularUnified trunk/GSASIIplot.py

    r3263 r3266  
    39743974                    pf = G2lat.polfcal(ODFln,SamSym[textureData['Model']],np.array([r,]),np.array([p,]))
    39753975                    G2frame.G2plotNB.status.SetStatusText('phi =%9.3f, gam =%9.3f, MRD =%9.3f'%(r,p,pf),1)
    3976 
     3976                   
     3977    def OnPick(event):
     3978        pick = event.artist
     3979        Dettext = pick.get_gid()
     3980        Page.SetToolTipString(Dettext)
     3981
     3982#TODO: add histogram positions to polefigures
    39773983    if '3D' in SHData['PlotType']:
    39783984        new,plotNum,Page,Plot,lim = G2frame.G2plotNB.FindPlotTab('Texture','3d')
     
    39843990    else:
    39853991        Page.canvas.mpl_connect('motion_notify_event', OnMotion)
     3992        Page.canvas.mpl_connect('pick_event', OnPick)
    39863993    Page.Choice = None
    39873994    G2frame.G2plotNB.status.SetStatusText('')   
     
    40704077            Z = np.reshape(Z,(npts,npts))
    40714078            try:
    4072                 CS = Plot.contour(Y,X,Z,aspect='equal')
     4079                CS = Plot.contour(Y,X,Z)
    40734080                Plot.clabel(CS,fontsize=9,inline=1)
    40744081            except ValueError:
     
    40774084            Img = Plot.imshow(Z.T,aspect='equal',cmap=acolor,extent=[-1,1,-1,1])
    40784085            Page.figure.colorbar(Img)
     4086            if 'det Angles' in textureData and textureData['ShoDet']:
     4087                Rdet = np.array([item[1] for item in textureData['det Angles']])
     4088                Pdet = np.array([item[2] for item in textureData['det Angles']])
     4089                if 'equal' in G2frame.Projection:
     4090                    Rdet = npsind(Rdet/2.)/sq2
     4091                else:
     4092                    Rdet = nptand(Rdet/2.)
     4093                Xdet = list(npcosd(Pdet)*Rdet)
     4094                Ydet = list(npsind(Pdet)*Rdet)
     4095                for i,[x,y] in enumerate(zip(Xdet,Ydet)):
     4096                    Plot.plot(x,-y,'k+',picker=5,gid=textureData['det Angles'][i][0])
    40794097            h,k,l = SHData['PFhkl']
    40804098            Plot.axis('off')
     
    41414159    rhoSize = np.array(Map['rho'].shape)
    41424160    atxyz = np.array(atom[cx:cx+3])
    4143     waveType = atom[-1]['SS1']['waveType']
    41444161    Spos = atom[-1]['SS1']['Spos']
    41454162    tau = np.linspace(0.,2.,101)
     
    41484165        scof = []
    41494166        ccof = []
    4150         for i,spos in enumerate(Spos):
     4167        waveType = Spos[0]
     4168        for i,spos in enumerate(Spos[1:]):
    41514169            if waveType in ['ZigZag','Block'] and not i:
    41524170                Tminmax = spos[0][:2]
  • TabularUnified trunk/GSASIIspc.py

    r3257 r3266  
    21472147    return SGOps[nA],SSGOps[nA],iC,SGData['SGCen'][nC],unit
    21482148   
    2149 def GetSSfxuinel(waveType,nH,XYZ,SGData,SSGData,debug=False):
     2149def GetSSfxuinel(waveType,Stype,nH,XYZ,SGData,SSGData,debug=False):
    21502150   
    21512151    def orderParms(CSI):
     
    24842484    tau = np.linspace(-1,1,49,True)
    24852485    #make modulation arrays - one parameter at a time
    2486     #site fractions
    2487     CSI['Sfrac'],dF,dFTP = DoFrac()
    2488     #positions
    2489     CSI['Spos'],dX,dXTP = DoXYZ()       
    2490     #anisotropic thermal motion
    2491     CSI['Sadp'],dU,dUTP = DoUij()
    2492     CSI['Spos'][0] = orderParms(CSI['Spos'][0])
    2493     CSI['Sadp'][0] = orderParms(CSI['Sadp'][0])           
     2486    if Stype == 'Sfrac':
     2487        CSI['Sfrac'],dF,dFTP = DoFrac()
     2488    elif Stype == 'Spos':
     2489        CSI['Spos'],dX,dXTP = DoXYZ()       
     2490        CSI['Spos'][0] = orderParms(CSI['Spos'][0])
     2491    elif Stype == 'Sadp':
     2492        CSI['Sadp'],dU,dUTP = DoUij()
     2493        CSI['Sadp'][0] = orderParms(CSI['Sadp'][0])           
    24942494    if debug:
    24952495        return CSI,tau,[dF,dFTP],[dX,dXTP],[dU,dUTP]
  • TabularUnified trunk/GSASIIstrIO.py

    r3255 r3266  
    987987                if len(Waves):
    988988                    pFile.write(' atom: %s, site sym: %s, type: %s wave type: %s:\n'%
    989                         (at[ct-1],at[cs],Stype,AtomSS['waveType']))
    990                 for iw,wave in enumerate(Waves):                   
     989                        (at[ct-1],at[cs],Stype,Waves[0]))
     990                else:
     991                    continue
     992                for iw,wave in enumerate(Waves[1:]):                   
    991993                    line = ''
    992                     if AtomSS['waveType'] in ['Block','ZigZag'] and Stype == 'Spos' and not iw:
     994                    if Waves[0] in ['Block','ZigZag'] and Stype == 'Spos' and not iw:
    993995                        for item in names[Stype][6:]:
    994996                            line += '%8s '%(item)                       
     
    12441246                if General.get('Modulated',False):
    12451247                    AtomSS = at[-1]['SS1']
    1246                     waveType = AtomSS['waveType']
    1247                     phaseDict[pfx+'waveType:'+str(i)] = waveType
    12481248                    for Stype in ['Sfrac','Spos','Sadp','Smag']:
    12491249                        Waves = AtomSS[Stype]
     1250                        if len(Waves):
     1251                            waveType = Waves[0]
     1252                        else:
     1253                            continue
     1254                        phaseDict[pfx+Stype[1].upper()+'waveType:'+str(i)] = waveType
    12501255                        nx = 0
    1251                         for iw,wave in enumerate(Waves):
     1256                        for iw,wave in enumerate(Waves[1:]):
    12521257                            if not iw:
    12531258                                if waveType in ['ZigZag','Block']:
    12541259                                    nx = 1
    1255                                 CSI = G2spc.GetSSfxuinel(waveType,1,at[cx:cx+3],SGData,SSGData)
     1260                                CSI = G2spc.GetSSfxuinel(waveType,Stype,1,at[cx:cx+3],SGData,SSGData)
    12561261                            else:
    1257                                 CSI = G2spc.GetSSfxuinel('Fourier',iw+1-nx,at[cx:cx+3],SGData,SSGData)
     1262                                CSI = G2spc.GetSSfxuinel('Fourier',Stype,iw+1-nx,at[cx:cx+3],SGData,SSGData)
    12581263                            uId,uCoef = CSI[Stype]
    12591264                            stiw = str(i)+':'+str(iw)
     
    16851690        for i,at in enumerate(Atoms):
    16861691            AtomSS = at[-1]['SS1']
    1687             waveType = AtomSS['waveType']
    16881692            for Stype in ['Sfrac','Spos','Sadp','Smag']:
    16891693                Waves = AtomSS[Stype]
    16901694                if len(Waves):
     1695                    waveType = Waves[0]
     1696                else:
     1697                    continue
     1698                if len(Waves):
    16911699                    pFile.write(' atom: %s, site sym: %s, type: %s wave type: %s:\n'%
    16921700                        (at[ct-1],at[cs],Stype,waveType))
    1693                     for iw,wave in enumerate(Waves):
     1701                    for iw,wave in enumerate(Waves[1:]):
    16941702                        stiw = ':'+str(i)+':'+str(iw)
    16951703                        namstr = '  names :'
     
    20222030                if General.get('Modulated',False):
    20232031                    AtomSS = at[-1]['SS1']
    2024                     waveType = AtomSS['waveType']
    20252032                    for Stype in ['Sfrac','Spos','Sadp','Smag']:
    20262033                        Waves = AtomSS[Stype]
    2027                         for iw,wave in enumerate(Waves):
     2034                        if len(Waves):
     2035                            waveType = Waves[0]
     2036                        else:
     2037                            continue
     2038                        for iw,wave in enumerate(Waves[1:]):
    20282039                            stiw = str(i)+':'+str(iw)
    20292040                            if Stype == 'Spos':
     
    20472058                                    'MXcos:'+stiw,'MYcos:'+stiw,'MZcos:'+stiw]
    20482059                            for iname,name in enumerate(names):
    2049                                 AtomSS[Stype][iw][0][iname] = parmDict[pfx+name]
     2060                                AtomSS[Stype][iw+1][0][iname] = parmDict[pfx+name]
    20502061                                if pfx+name in sigDict:
    20512062                                    wavesSig[name] = sigDict[pfx+name]
  • TabularUnified trunk/GSASIIstrMath.py

    r3254 r3266  
    634634        'MXsin:':MSSdata[0],'MYsin:':MSSdata[1],'MZsin:':MSSdata[2],'MXcos:':MSSdata[3],'MYcos:':MSSdata[4],'MZcos:':MSSdata[5]}
    635635    for iatm in range(Natoms):
    636         waveTypes.append(parmDict[pfx+'waveType:'+str(iatm)])
     636        for kind in ['F','P','A','M']:
     637            wavetype = []
     638            wavetype += [parmDict.get(pfx+kind+'waveType:'+str(iatm),''),]
     639            waveTypes.append(wavetype)
    637640        for key in keys:
    638641            for m in range(Nwave[key[0]]):
  • TabularUnified trunk/imports/G2phase.py

    r3252 r3266  
    345345        if shNcof:
    346346            shCoef = {}
    347             nRec = [i+1 for i in range((shNcof-1)/6+1)]
     347            nRec = [i+1 for i in range((shNcof-1)//6+1)]
    348348            for irec in nRec:
    349349                ODkey = keyList[0][:6]+'OD'+'%3dA'%(irec)
     
    584584            Atom.append([])
    585585            Atom.append([])
    586             Atom.append({'SS1':{'waveType':waveType,'Sfrac':Sfrac,'Spos':Spos,'Sadp':Sadp,'Smag':Smag}})    #SS2 is for (3+2), etc.
     586            Atom.append({'SS1':{'Sfrac':[waveType,]+Sfrac,'Spos':[waveType,]+Spos,'Sadp':['Fourier',]+Sadp,'Smag':['Fourier',]+Smag}})    #SS2 is for (3+2), etc.
    587587            Atoms.append(Atom)
    588588        file2.close()
  • TabularUnified trunk/imports/G2phase_CIF.py

    r3261 r3266  
    496496                   
    497497                    if nim >= 0:
    498                         Sfrac = [[sfrac,False] for sfrac in Sfrac[:nim]]
     498                        Sfrac = [waveType,]+[[sfrac,False] for sfrac in Sfrac[:nim]]
    499499                    else:
    500500                        Sfrac = []
     
    512512                                Spos[im-1][ix+3] = cif.get_number_with_esd(val)[0]
    513513                    if nim >= 0:
    514                         Spos = [[spos,False] for spos in Spos[:nim]]
     514                        Spos = [waveType,]+[[spos,False] for spos in Spos[:nim]]
    515515                    else:
    516516                        Spos = []
     
    519519                        for i,item in enumerate(UijFdict['_atom_site_u_fourier_atom_site_label']):
    520520                            if item == atomlist[0]:
    521                                 waveType = 'Fourier'                               
    522521                                ix = ['U11','U22','U33','U12','U13','U23'].index(UijFdict['_atom_site_u_fourier_tens_elem'][i])
    523522                                im = int(UijFdict['_atom_site_u_fourier_wave_vector_seq_id'][i])
     
    529528                                Sadp[im-1][ix+6] = cif.get_number_with_esd(val)[0]
    530529                    if nim >= 0:
    531                         Sadp = [[sadp,False] for sadp in Sadp[:nim]]
     530                        Sadp = ['Fourier',]+[[sadp,False] for sadp in Sadp[:nim]]
    532531                    else:
    533532                        Sadp = []
     
    536535                        for i,item in enumerate(MagFdict[Mnames[0]]):
    537536                            if item == atomlist[0]:
    538                                 waveType = 'Fourier'                               
    539537                                ix = ['x','y','z'].index(MagFdict[Mnames[1]][i])
    540538                                im = int(MagFdict[Mnames[2]][i])
     
    545543                                val = MagFdict[Mnames[4]][i]
    546544                                Smag[im-1][ix+3] = cif.get_number_with_esd(val)[0]
    547                         if nim >= 0:
    548                             Smag = [[smag,False] for smag in Smag[:nim]]
    549                         else:
    550                             Smag = []
    551                     SSdict = {'SS1':{'waveType':waveType,'Sfrac':Sfrac,'Spos':Spos,'Sadp':Sadp,'Smag':Smag}}
     545                    if nim >= 0:
     546                        Smag = ['Fourier',]+[[smag,False] for smag in Smag[:nim]]
     547                    else:
     548                        Smag = []
     549                    SSdict = {'SS1':{'Sfrac':Sfrac,'Spos':Spos,'Sadp':Sadp,'Smag':Smag}}
    552550                    if magnetic and atomlist[0] in magatomlabels:
    553551                        matomlist.append(SSdict)
  • TabularUnified trunk/imports/G2pwd_fxye.py

    r3146 r3266  
    394394            elif 'Omega' in S.split('=')[0] or 'Theta' in S.split('=')[0]:  #HIPD weirdness
    395395                try:
    396                     self.Sample['Omega'] = 90.-float(S.split('=')[1])
     396                    self.Sample['Omega'] = float(S.split('=')[1])
    397397                except:
    398398                    pass
    399399            elif 'Chi' in S.split('=')[0]:
    400400                try:
    401                     self.Sample['Chi'] = -float(S.split('=')[1])
     401                    self.Sample['Chi'] = float(S.split('=')[1])
    402402                except:
    403403                    pass                   
Note: See TracChangeset for help on using the changeset viewer.