Changeset 1506


Ignore:
Timestamp:
Sep 26, 2014 9:41:33 AM (9 years ago)
Author:
vondreele
Message:

break ReadPowderInstprm? into two pieces; OpenPowderInstprm? is new. This will allow using instprm type lines for default instrument parameters instead of old style GSAS ones.
Implement import of superlattice phase and structure factors from JANA2006 files.
Draw superlattice structure factors in 2D & 3D.
Develop GUI for superlattice phase information; atom displacement, Uij, frac & mag waves.
Remove old style mag stuff.
Fix bug in STD powder import .routine for y=0 points
fix bug in getVCov for missing parameter problem.
IsHistogram? InAnyPhase? now returns histogram name instead of True
Single crystal Reflection list now has menu with plot commands

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r1500 r1506  
    634634            generalData = data['General']
    635635            SGData = generalData['SGData']
     636            Super = generalData.get('Super',0)
     637            SuperVec = []
     638            for i in range(Super):
     639                SuperVec.append(generalData['SuperVec'][i][0])
     640                SuperVec = np.array(SuperVec)
    636641            UseList = data['Histograms']
    637642            NShkl = len(G2spc.MustrainNames(SGData))
     
    644649                    refDict,reflData = self.PatternTree.GetItemPyData(Id)
    645650                    G,g = G2lat.cell2Gmat(generalData['Cell'][1:7])
     651                    Super = reflData.get('Super',0)
    646652                    for iref,ref in enumerate(reflData['RefList']):
    647                         H = list(ref[:3])
    648                         ref[4] = np.sqrt(1./G2lat.calc_rDsq2(H,G))
    649                         iabsnt,ref[3],Uniq,phi = G2spc.GenHKLf(H,SGData)
     653                        hkl = ref[:3]
     654                        H = list(hkl+np.sum(SuperVec*ref[3:3+Super],axis=0))
     655                        ref[4+Super] = np.sqrt(1./G2lat.calc_rDsq2(H,G))
     656                        iabsnt,ref[3+Super],Uniq,phi = G2spc.GenHKLf(H,SGData)
    650657                    UseList[histoName] = SetDefaultDData(reflData['Type'],histoName)
    651658                elif histoName in PWDRlist:
     
    771778            generalData = data['General']
    772779            SGData = generalData['SGData']
     780            Super = generalData.get('Super',0)
     781            SuperVec = []
     782            for i in range(Super):
     783                SuperVec.append(generalData['SuperVec'][i][0])
     784                SuperVec = np.array(SuperVec)
    773785            UseList = data['Histograms']
    774786            for histoName in newHistList:
     
    779791                G,g = G2lat.cell2Gmat(generalData['Cell'][1:7])
    780792                for iref,ref in enumerate(reflData['RefList']):
    781                     H = list(ref[:3])
    782                     ref[4] = np.sqrt(1./G2lat.calc_rDsq2(H,G))
    783                     iabsnt,ref[3],Uniq,phi = G2spc.GenHKLf(H,SGData)
     793                    hkl = ref[:3]
     794                    H = list(hkl+np.sum(SuperVec*ref[3:3+Super],axis=0))
     795                    ref[4+Super] = np.sqrt(1./G2lat.calc_rDsq2(H,G))
     796                    iabsnt,ref[3+Super],Uniq,phi = G2spc.GenHKLf(H,SGData)
    784797        wx.EndBusyCursor()
    785798       
     
    806819            kind=wx.ITEM_NORMAL,text='Simulate a dataset')
    807820        self.Bind(wx.EVT_MENU, self.OnDummyPowder, id=item.GetId())
    808            
    809     def ReadPowderInstprm(self,instfile):       #fix the write routine for [inst1,inst2] style
     821       
     822    def OpenPowderInstprm(self,instfile):
    810823        '''Read a GSAS-II (new) instrument parameter file
    811824
     
    818831            return None
    819832        File = open(instfile,'r')
    820         S = File.readline()
    821         if not S.startswith('#GSAS-II'): # not a valid file
    822             File.close()
     833        lines = File.readlines()
     834        File.close()
     835        return lines       
     836           
     837    def ReadPowderInstprm(self,instLines):
     838        '''Read lines from a GSAS-II (new) instrument parameter file
     839
     840        :param list instLines: strings from GSAs-II parameter file
     841
     842        '''
     843        if not instLines[0].startswith('#GSAS-II'): # not a valid file
    823844            return None
    824845        newItems = []
    825846        newVals = []
    826         while S:
     847        for S in instLines:
    827848            if S[0] == '#':
    828                 S = File.readline()
    829849                continue
    830850            [item,val] = S[:-1].split(':')
     
    834854            except ValueError:
    835855                newVals.append(val)                       
    836             S = File.readline()               
    837         File.close()
    838856        return G2IO.makeInstDict(newItems,newVals,len(newVals)*[False,]),{}
    839857       
     
    10711089            if os.path.exists(instfile):
    10721090                #print 'debug: try read',instfile
    1073                 instParmList = self.ReadPowderInstprm(instfile)
     1091                Lines = self.OpenPowderInstprm(instfile)
     1092                instParmList = None
     1093                if Lines is not None:
     1094                    instParmList = self.ReadPowderInstprm(Lines)
    10741095                if instParmList is not None:
    10751096                    rd.instfile = instfile
     
    10901111        for ext in '.instprm','.prm','.inst','.ins':
    10911112            instfile = basename + ext
    1092             instParmList = self.ReadPowderInstprm(instfile)
     1113            Lines = self.OpenPowderInstprm(instfile)
     1114            instParmList = None
     1115            if Lines is not None:
     1116                instParmList = self.ReadPowderInstprm(Lines)
    10931117            if instParmList is not None:
    10941118                rd.instfile = instfile
     
    11151139                if instfile is not None and instfile != self.zipfile:
    11161140                    print 'debug:',instfile,'created from ',self.zipfile
    1117                     instParmList = self.ReadPowderInstprm(instfile)
     1141                    Lines = self.OpenPowderInstprm(instfile)
     1142                    instParmList = None
     1143                    if Lines is not None:
     1144                        instParmList = self.ReadPowderInstprm(Lines)
    11181145                    if instParmList is not None:
    11191146                        rd.instfile = instfile
     
    11471174            dlg.Destroy()
    11481175            if not instfile: break
    1149             instParmList = self.ReadPowderInstprm(instfile)
     1176            Lines = self.OpenPowderInstprm(instfile)
     1177            instParmList = None
     1178            if Lines is not None:
     1179                instParmList = self.ReadPowderInstprm(Lines)
    11501180            if instParmList is not None:
    11511181                rd.instfile = instfile
  • trunk/GSASIIgrid.py

    r1503 r1506  
    32023202            help='Compute values of ISODISTORT modes from atom parameters')
    32033203        self.PostfillDataMenu()
     3204       
     3205        # Phase / Imcommensurate "waves" tab
     3206        self.WavesData = wx.MenuBar()
     3207        self.PrefillDataMenu(self.WavesData,helpType='Wave Data', helpLbl='Imcommensurate wave data')
     3208        self.WavesData.Append(menu=wx.Menu(title=''),title='Select tab')
     3209        self.PostfillDataMenu()
    32043210                 
    32053211        # Phase / Draw Options tab
     
    49614967    def OnPlot3DHKL(event):
    49624968        refList = data[1]['RefList']
    4963         phaseName = data[0].get('0::Name','no phase')
    4964         FoMax = np.max(refList.T[8])
     4969        FoMax = np.max(refList.T[8+Super])
    49654970        Hmin = np.array([int(np.min(refList.T[0])),int(np.min(refList.T[1])),int(np.min(refList.T[2]))])
    49664971        Hmax = np.array([int(np.max(refList.T[0])),int(np.max(refList.T[1])),int(np.max(refList.T[2]))])
     
    49694974            'FoMax' : FoMax,'Scale' : 1.0,'Drawing':{'viewPoint':[Vpoint,[]],'default':Vpoint[:],
    49704975            'backColor':[0,0,0],'depthFog':False,'Zclip':10.0,'cameraPos':10.,'Zstep':0.05,
    4971             'Scale':1.0,'oldxy':[],'viewDir':[1,0,0]}}
     4976            'Scale':1.0,'oldxy':[],'viewDir':[1,0,0]},'Super':Super,'SuperVec':SuperVec}
    49724977        G2plt.Plot3DSngl(G2frame,newPlot=True,Data=controls,hklRef=refList,Title=phaseName)
    49734978       
     
    50615066        G2plt.PlotPatterns(G2frame,plotType=kind,newPlot=True)
    50625067    elif kind == 'HKLF':
     5068        Name = G2frame.PatternTree.GetItemText(item)
     5069        phaseName = G2pdG.IsHistogramInAnyPhase(G2frame,Name)
     5070        if phaseName:
     5071            pId = GetPatternTreeItemId(G2frame,G2frame.root,'Phases')
     5072            phaseId =  GetPatternTreeItemId(G2frame,pId,phaseName)
     5073            General = G2frame.PatternTree.GetItemPyData(phaseId)['General']
     5074            Super = General.get('Super',0)
     5075            SuperVec = General.get('SuperVec',[])
     5076        else:
     5077            Super = 0
     5078            SuperVec = []       
    50635079        refList = data[1]['RefList']
    50645080        FoMax = np.max(refList.T[5+data[1].get('Super',0)])
    5065         controls = {'Type' : 'Fosq','ifFc' : True,     
     5081        controls = {'Type' : 'Fo','ifFc' : True,     
    50665082            'HKLmax' : [int(np.max(refList.T[0])),int(np.max(refList.T[1])),int(np.max(refList.T[2]))],
    50675083            'HKLmin' : [int(np.min(refList.T[0])),int(np.min(refList.T[1])),int(np.min(refList.T[2]))],
    5068             'FoMax' : FoMax,'Zone' : '001','Layer' : 0,'Scale' : 1.0,}
     5084            'FoMax' : FoMax,'Zone' : '001','Layer' : 0,'Scale' : 1.0,'Super':Super,'SuperVec':SuperVec}
    50695085        G2plt.PlotSngl(G2frame,newPlot=True,Data=controls,hklRef=refList)
    50705086                 
  • trunk/GSASIImath.py

    r1474 r1506  
    188188                vcov[i1][i2] = covMatrix[varyList.index(name1)][varyList.index(name2)]
    189189            except ValueError:
    190                 vcov[i1][i2] = 0.0
     190                if i1 == i2:
     191                    vcov[i1][i2] = 1.0
     192                else:
     193                    vcov[i1][i2] = 0.0
    191194    return vcov
    192195
     
    29422945        cosTable = np.array(cosTable)**2
    29432946        nRef = len(refs)
    2944         if generalData['doPawley'] and (covData['freshCOV'] or  MCSA['newDmin']):
     2947#        if generalData['doPawley'] and (covData['freshCOV'] or  MCSA['newDmin']):
     2948        if covData['freshCOV'] or  MCSA['newDmin']:
    29452949            vList = covData['varyList']
    29462950            covMatrix = covData['covMatrix']
  • trunk/GSASIIphsGUI.py

    r1503 r1506  
    128128            if generalData['Type'] =='macromolecular':
    129129                generalData['AtomPtrs'] = [6,4,10,12]
    130         if generalData['Type'] in ['modulated','magnetic',] and 'modDim' not in generalData:
    131             generalData['modDim'] = '4'
    132             generalData['modVects'] = [{'mod':[0.01,False],'vect':[0,0,1],'maxInd':4},
    133                 {'mod':[0.01,False],'vect':[0,0,1],'maxInd':4},{'mod':[0.01,False],'vect':[0,0,1],'maxInd':4}]
     130        if generalData['Type'] in ['modulated','magnetic',] and 'Super' not in generalData:
     131            generalData['SuperSg'] = ''
     132            generalData['Super'] = 0
     133            generalData['SuperVec'] = [[[0,0,.1],False,4],[[0,0,.1],False,4],[[0,0,.1],False,4]]
    134134# end of patches
    135135        cx,ct,cs,cia = generalData['AtomPtrs']
     
    511511        def ModulatedSizer(name):
    512512           
     513            def OnSuperGp(event):   #need a check on supersymmetry group rules here!
     514                generalData['SuperSg'] = event.GetValue()
     515           
    513516            def OnDim(event):
    514                 generalData['modDim'] = dim.GetValue()
     517                generalData['Super'] = dim.GetValue()
    515518                wx.CallAfter(UpdateGeneral)
    516519               
     
    518521                Obj = event.GetEventObject()
    519522                ind = Indx[Obj.GetId()]
    520                 axis = Obj.GetValue().split()
     523                vec = Obj.GetValue().split()
    521524                try:
    522                     hkl = [float(axis[i]) for i in range(3)]
     525                    Vec = [float(vec[i]) for i in range(3)]
    523526                except (ValueError,IndexError):
    524                     hkl = generalData['modVects'][ind]['vect']
    525                 if not np.any(np.array(hkl)):
    526                     hkl = generalData['modVects'][ind]['vect']
    527                 generalData['modVects'][ind]['vect'] = hkl
    528                 h,k,l = hkl
     527                    Vec = generalData['SuperVec'][ind][0]
     528                if not np.any(np.array(Vec)):
     529                    Vec = generalData['SuperVec'][ind][0]
     530                generalData['modVects'][ind][0] = hkl
     531                h,k,l = Vec
    529532                Obj.SetValue('%.3f %.3f %.3f'%(h,k,l))
    530533               
    531             def OnVal(event):
     534            def OnVecRef(event):
    532535                Obj = event.GetEventObject()
    533536                ind = Indx[Obj.GetId()]
    534                 try:
    535                     val = float(Obj.GetValue())
    536                     generalData['modVects'][ind]['mod'][0] = val
    537                 except ValueError:
    538                     pass
    539                 Obj.SetValue('%.4f'%(generalData['modVects'][ind]['mod'][0]))
    540 
    541             def OnValRef(event):
    542                 Obj = event.GetEventObject()
    543                 ind = Indx[Obj.GetId()]
    544                 generalData['modVects'][ind]['mod'][1] = Obj.GetValue()
     537                generalData['SuperVec'][ind][1] = Obj.GetValue()
    545538               
    546539            def OnMax(event):
    547540                Obj = event.GetEventObject()
    548541                ind = Indx[Obj.GetId()]
    549                 generalData['modVects'][ind]['maxInd'] = int(Obj.GetValue())
     542                generalData['SuperVec'][ind][2] = int(Obj.GetValue())
    550543           
    551544            Indx = {}
     
    554547            dimSizer.Add(wx.StaticText(General,label=' '+name.capitalize()+' structure controls: '),0,WACV)
    555548            dimSizer.Add(wx.StaticText(General,label=' Modulated structure dimension: '),0,WACV)
    556             dimChoice = ['4','5','6']
    557             dim = wx.ComboBox(General,-1,value=generalData['modDim'],choices=dimChoice,
     549            dimChoice = ['1']       # restricted to (3+1) superlattices for now
     550            dim = wx.ComboBox(General,value=str(generalData['Super']),choices=dimChoice,
    558551                style=wx.CB_READONLY|wx.CB_DROPDOWN)
    559552            dim.Bind(wx.EVT_COMBOBOX,OnDim)
    560553            dimSizer.Add(dim,0,WACV)
     554            dimSizer.Add(wx.StaticText(General,label=' Superspace group: '+generalData['SGData']['SpGrp']),0,WACV)
     555            superGp = wx.TextCtrl(General,value=generalData['SuperSg'],style=wx.TE_PROCESS_ENTER)
     556            superGp.Bind(wx.EVT_TEXT_ENTER,OnSuperGp)       
     557            superGp.Bind(wx.EVT_KILL_FOCUS,OnSuperGp)
     558            dimSizer.Add(superGp,0,WACV)
    561559            modSizer.Add(dimSizer)
    562             vecSizer = wx.FlexGridSizer(1,7,5,5)
     560            vecSizer = wx.FlexGridSizer(1,5,5,5)
    563561            indChoice = ['0','1','2','3','4','5','6','7']
    564             for i in range(int(generalData['modDim'])-3):
     562            for i in range(int(generalData['Super'])):
    565563                vecSizer.Add(wx.StaticText(General,label=' Modulation vector #%d: '%(i+1)),0,WACV)
    566                 vec = generalData['modVects'][i]
     564                vec = generalData['SuperVec'][i][0]
    567565                Vec = wx.TextCtrl(General,
    568                     value=' %.3f %.3f %.3f '%(vec['vect'][0],vec['vect'][1],vec['vect'][2]),
     566                    value=' %.3f %.3f %.3f '%(vec[0],vec[1],vec[2]),
    569567                    style=wx.TE_PROCESS_ENTER)
    570568                Vec.Bind(wx.EVT_TEXT_ENTER,OnVec)       
     
    572570                vecSizer.Add(Vec,0,WACV)
    573571                Indx[Vec.GetId()] = i
    574                 vecSizer.Add(wx.StaticText(General,label=' value: '),0,WACV)
    575                 Val = wx.TextCtrl(General,value='%.4f'%(vec['mod'][0]),style=wx.TE_PROCESS_ENTER)
    576                 Val.Bind(wx.EVT_TEXT_ENTER,OnVal)       
    577                 Val.Bind(wx.EVT_KILL_FOCUS,OnVal)
    578                 vecSizer.Add(Val,0,WACV)
    579                 Indx[Val.GetId()] = i
    580572                Ref = wx.CheckBox(General,label='Refine?')
    581                 Ref.SetValue(vec['mod'][1])
     573                Ref.SetValue(generalData['SuperVec'][i][1])
    582574                Indx[Ref.GetId()] = i
    583                 Ref.Bind(wx.EVT_CHECKBOX, OnValRef)
     575                Ref.Bind(wx.EVT_CHECKBOX, OnVecRef)
    584576                vecSizer.Add(Ref,0,WACV)
    585577                vecSizer.Add(wx.StaticText(General,label=' max index: '),0,WACV)
    586                 Max = wx.ComboBox(General,-1,value='%d'%(vec['maxInd']),choices=indChoice,
     578                Max = wx.ComboBox(General,-1,value='%d'%(generalData['SuperVec'][i][2]),choices=indChoice,
    587579                    style=wx.CB_READONLY|wx.CB_DROPDOWN)
    588580                Max.Bind(wx.EVT_TEXT_ENTER,OnMax)       
     
    13151307        Types += 7*[wg.GRID_VALUE_FLOAT+':10,5',]
    13161308        colLabels = ['Name','Type','refine','x','y','z','frac','site sym','mult','I/A','Uiso','U11','U22','U33','U12','U13','U23']
    1317         if generalData['Type'] == 'magnetic':
    1318             colLabels += ['Mx','My','Mz']
    1319             Types[2] = wg.GRID_VALUE_CHOICE+": ,X,XU,U,M,MX,MXU,MU,F,FX,FXU,FU,FM,FMX,FMU,"
    1320             Types += 3*[wg.GRID_VALUE_FLOAT+':10,4',]
    1321         elif generalData['Type'] == 'macromolecular':
     1309        if generalData['Type'] == 'macromolecular':
    13221310            colLabels = ['res no','residue','chain'] + colLabels
    13231311            Types = [wg.GRID_VALUE_STRING,
    13241312                wg.GRID_VALUE_CHOICE+AAchoice,
    13251313                wg.GRID_VALUE_STRING] + Types
    1326         elif generalData['Type'] == 'modulated':
    1327             Types += []
    1328             colLabels += []
    13291314        SGData = data['General']['SGData']
    13301315        G2frame.dataFrame.SetStatusText('')
     
    13701355        elif generalData['Type'] == 'nuclear':
    13711356            atomData.append([Name,El,'',x,y,z,1,Sytsym,Mult,'I',0.01,0,0,0,0,0,0,atId])
    1372         elif generalData['Type'] == 'magnetic':
    1373             atomData.append([Name,El,'',x,y,z,1,Sytsym,Mult,0,'I',0.01,0,0,0,0,0,0,0,0,0,atId])
     1357        elif generalData['Type'] in ['modulated','magnetic']:
     1358            atomData.append([Name,El,'',x,y,z,1,Sytsym,Mult,0,'I',0.01,0,0,0,0,0,0,[],[],[],[],atId])
    13741359        SetupGeneral()
    13751360        if 'Atoms' in data['Drawing']:           
     
    14461431                atom[6:9]+['1',]+['sticks',]+['',]+[[255,255,255],]+atom[12:]+[[],[]]][0]
    14471432            ct,cs = [4,11]         #type & color
    1448         elif generalData['Type'] == 'magnetic':
    1449             if oldatom:
    1450                 atomInfo = [atom[:2]+oldatom[3:]][0]
    1451             else:
    1452                 atomInfo = [atom[:2]+atom[3:6]+['vdW balls',]+['',]+atom[9:]+[[],[]]][0]
    1453             ct,cs = [1,8]         #type & color
    1454     #     elif generalData['Type'] == 'modulated':
    1455     #        ?????   for future
    14561433        atNum = generalData['AtomTypes'].index(atom[ct])
    14571434        atomInfo[cs] = list(generalData['Color'][atNum])
     
    14721449            elif generalData['Type'] == 'nuclear':
    14731450                atomData.insert(indx,['UNK','UNK','',x,y,z,1,Sytsym,Mult,'I',0.01,0,0,0,0,0,0,atId])
    1474             elif generalData['Type'] == 'magnetic':
    1475                 atomData.insert(indx,['UNK','UNK','',x,y,z,1,Sytsym,Mult,0,'I',0.01,0,0,0,0,0,0,0,0,0,atId])
     1451            elif generalData['Type'] in ['modulated','magnetic']:
     1452                atomData.insert(indx,['UNK','UNK','',x,y,z,1,Sytsym,Mult,0,'I',0.01,0,0,0,0,0,0,[],[],[],[],atId])
    14761453            SetupGeneral()
    14771454
     
    15071484                choice = ['F - site fraction','X - coordinates','U - thermal parameters']
    15081485            elif Type == 'magnetic':
    1509                 choice = ['F - site fraction','X - coordinates','U - thermal parameters','M - magnetic moment']
     1486                choice = ['F - site fraction','X - coordinates','U - thermal parameters']
    15101487            dlg = wx.MultiChoiceDialog(G2frame,'Select','Refinement controls',choice)
    15111488            if dlg.ShowModal() == wx.ID_OK:
     
    19131890                print atom[:ct+1], 'not in Atom array; not updated'
    19141891        wx.CallAfter(FillAtomsGrid,Atoms)
    1915          
     1892       
     1893################################################################################
     1894#### Wave Data page
     1895################################################################################
     1896
     1897    def UpdateWavesData():
     1898       
     1899        def AtomSizer(SS,atom):
     1900           
     1901            def OnWaveType(event):
     1902                atom[-2][SS]['waveType']=waveType.GetValue()
     1903               
     1904            atomSizer = wx.BoxSizer(wx.HORIZONTAL)
     1905            atomSizer.Add(wx.StaticText(waveData,label=' Modulation data for atom:    '+atom[0]+'    WaveType: '),0,WACV)           
     1906            waveType = wx.ComboBox(waveData,value=atom[-2][SS]['waveType'],choices=waveTypes,
     1907                style=wx.CB_READONLY|wx.CB_DROPDOWN)
     1908            waveType.Bind(wx.EVT_COMBOBOX,OnWaveType)
     1909            atomSizer.Add(waveType,0,WACV)
     1910            return atomSizer
     1911           
     1912        def WaveSizer(waveBlk,Stype,typeName,Names):
     1913           
     1914            def OnAddWave(event):
     1915                Obj = event.GetEventObject()
     1916                iatm,item = Indx[Obj.GetId()]
     1917                atomData[iatm][-2][SS][item].append([[0.0 for i in range(numVals[Stype])],False])
     1918                UpdateWavesData()
     1919               
     1920            def OnWaveVal(event):
     1921                Obj = event.GetEventObject()
     1922                iatm,item,iwave,ival = Indx[Obj.GetId()]
     1923                try:
     1924                    val = float(Obj.GetValue())
     1925                except ValueError:
     1926                    val = atomData[iatm][-2][SS][item][iwave][0][ival]
     1927                Obj.SetValue('%.4f'%val)
     1928                atomData[iatm][-2][SS][item][iwave][0][ival] = val
     1929               
     1930            def OnRefWave(event):
     1931                Obj = event.GetEventObject()
     1932                iatm,item,iwave = Indx[Obj.GetId()]
     1933                atomData[iatm][-2][SS][item][iwave][1] = not atomData[iatm][-2][SS][item][iwave][1]
     1934               
     1935            def OnDelWave(event):
     1936                Obj = event.GetEventObject()
     1937                iatm,item,iwave = Indx[Obj.GetId()]
     1938                del atomData[iatm][-2][SS][item][iwave]
     1939                UpdateWavesData()               
     1940               
     1941            waveSizer = wx.BoxSizer(wx.VERTICAL)
     1942            waveHead = wx.BoxSizer(wx.HORIZONTAL)
     1943            waveHead.Add(wx.StaticText(waveData,label=typeName+' modulation parameters: '),0,WACV)
     1944            waveAdd = wx.CheckBox(waveData,label='Add wave?')
     1945            waveAdd.Bind(wx.EVT_CHECKBOX, OnAddWave)
     1946            Indx[waveAdd.GetId()] = [iatm,Stype]
     1947            waveHead.Add(waveAdd,0,WACV)
     1948            waveSizer.Add(waveHead)
     1949            if len(waveBlk):
     1950                waveSizer.Add(wx.StaticText(waveData,label=' Parameters: '+str(Names).rstrip(']').lstrip('[').replace("'",'')),0,WACV)
     1951                if Stype == 'Sfrac':
     1952                    Waves = wx.FlexGridSizer(1,4,5,5)
     1953                else:
     1954                    Waves = wx.FlexGridSizer(1,8,5,5)
     1955                for iwave,wave in enumerate(waveBlk):
     1956                    for ival,val in enumerate(wave[0]):
     1957                        waveVal = wx.TextCtrl(waveData,value='%.4f'%(val),style=wx.TE_PROCESS_ENTER)
     1958                        waveVal.Bind(wx.EVT_TEXT_ENTER,OnWaveVal)
     1959                        waveVal.Bind(wx.EVT_KILL_FOCUS,OnWaveVal)
     1960                        Indx[waveVal.GetId()] = [iatm,Stype,iwave,ival]
     1961                        Waves.Add(waveVal,0,WACV)
     1962                        if len(wave[0]) > 6 and ival == 5:
     1963                            Waves.Add((5,5),0)
     1964                            Waves.Add((5,5),0)
     1965                    waveRef = wx.CheckBox(waveData,label='Refine?')
     1966                    waveRef.SetValue(wave[1])
     1967                    Indx[waveRef.GetId()] = [iatm,Stype,iwave]
     1968                    waveRef.Bind(wx.EVT_CHECKBOX, OnRefWave)
     1969                    Waves.Add(waveRef,0,WACV)
     1970                    waveDel = wx.CheckBox(waveData,label='Delete?')
     1971                    Indx[waveDel.GetId()] = [iatm,Stype,iwave]
     1972                    waveDel.Bind(wx.EVT_CHECKBOX, OnDelWave)
     1973                    Waves.Add(waveDel,0,WACV)               
     1974                waveSizer.Add(Waves)                   
     1975            return waveSizer
     1976           
     1977        Indx = {}
     1978        G2frame.dataFrame.SetStatusText('')
     1979        generalData = data['General']
     1980        cx,ct,cs,cia = generalData['AtomPtrs']
     1981        atomData = data['Atoms']
     1982        if waveData.GetSizer():
     1983            waveData.GetSizer().Clear(True)
     1984        mainSizer = wx.BoxSizer(wx.VERTICAL)
     1985        typeNames = {'Sfrac':' Site fraction','Spos':' Position','Sadp':' Thermal motion','Smag':' Magnetic moment'}
     1986        numVals = {'Sfrac':2,'Spos':6,'Sadp':12,'Smag':6}
     1987        posNames = ['Xsin','Ysin','Zsin','Xcos','Ysin','Zsin']
     1988        adpNames = ['U11sin','U22sin','U33sin','U12sin','U13sin','U23sin',
     1989            'U11cos','U22cos','U33cos','U12cos','U13cos','U23cos']
     1990        magNames = ['MXsin','MYsin','MZsin','MXcos','MYcos','MZcos']
     1991        fracNames = ['Flen','Fcent','Fsin','Fcos']
     1992        waveTypes = ['Fourier','Sawtooth','ZigZag','Crenel/Fourier']
     1993        Labels = {'Spos':posNames,'Sfrac':fracNames,'Sadp':adpNames,'Smag':magNames}
     1994        mainSizer.Add(wx.StaticText(waveData,label=' Incommensurate propagation wave data:'),0,WACV)
     1995        if generalData['Type'] in ['modulated','magnetic']:
     1996            for iatm,atom in enumerate(atomData):
     1997                for SS in ['SS1',]:  #future SS2 & SS3
     1998                    G2gd.HorizontalLine(mainSizer,waveData)
     1999                    mainSizer.Add(AtomSizer(SS,atom))
     2000                    for Stype in ['Sfrac','Spos','Sadp','Smag']:
     2001                        if generalData['Type'] == 'modulated' and Stype == 'Smag':
     2002                            break
     2003                        mainSizer.Add(WaveSizer(atom[-2][SS][Stype],Stype,typeNames[Stype],Labels[Stype]))
    19162004                       
     2005        SetPhaseWindow(G2frame.dataFrame,waveData,mainSizer)
     2006                       
    19172007################################################################################
    19182008#Structure drawing GUI stuff               
     
    27872877            DATData['covData'] = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.root, 'Covariance'))
    27882878        G2stMn.DisAglTor(DATData)
    2789                
     2879                       
    27902880################################################################################
    27912881#### Draw Options page
     
    54005490                G2frame.dataFrame.Bind(wx.EVT_MENU, OnReImport, id=id)               
    54015491            FillAtomsGrid(Atoms)
     5492        elif text == 'Wave Data' and data['General']['Type'] in ['modulated','magnetic']:
     5493            G2gd.SetDataMenuBar(G2frame,G2frame.dataFrame.WavesData)
     5494            FillSelectPageMenu(G2frame.dataFrame.WavesData)
     5495            UpdateWavesData()
     5496            wx.CallAfter(G2plt.PlotStructure,G2frame,data,firstCall=True)
    54025497        elif text == 'Draw Options':
    54035498            G2gd.SetDataMenuBar(G2frame,G2frame.dataFrame.DataDrawOptions)
     
    55125607    G2frame.dataDisplay.AddPage(Atoms,'Atoms')
    55135608    Pages.append('Atoms')
     5609    if data['General']['Type'] in ['modulated','magnetic']:
     5610        waveData = wx.ScrolledWindow(G2frame.dataDisplay)
     5611        G2frame.dataDisplay.AddPage(waveData,'Wave Data')
     5612        Pages.append('Wave Data')       
    55145613    drawOptions = wx.ScrolledWindow(G2frame.dataDisplay)
    55155614    G2frame.dataDisplay.AddPage(drawOptions,'Draw Options')
  • trunk/GSASIIplot.py

    r1504 r1506  
    358358    HKLmin = Data['HKLmin']
    359359    FosqMax = Data['FoMax']
    360     Super = Data.get('Super',0)
     360    Super = Data['Super']
     361    SuperVec = []
     362    for i in range(Super):
     363        SuperVec.append(Data['SuperVec'][i][0])
     364        SuperVec = np.array(SuperVec)
    361365    FoMax = math.sqrt(FosqMax)
    362366    xlabel = ['k, h=','h, k=','h, l=']
     
    370374    time0 = time.time()
    371375    for refl in hklRef:
    372         H = np.array(refl[:3])
    373         if Super and np.any(refl[3:3+Super]):   #skip superlattice reflections for 2D plot
    374             continue
     376        H = refl[:3]
    375377        if 'HKLF' in Name:
    376378            Fosq,sig,Fcsq = refl[5+Super:8+Super]
    377379        else:
    378380            Fosq,sig,Fcsq = refl[8+Super],1.0,refl[9+Super]
    379         HKL.append(H)
     381        HKL.append(H+np.sum(SuperVec*refl[3:3+Super],axis=0))
    380382        HKLF.append([Fosq,sig,Fcsq])
    381383        if H[izone] == Data['Layer']:
     
    410412                    A = (Fosq-Fcsq)/(3*sig)
    411413                if abs(A) < 3.0: A = 0
    412                 B = 0                   
    413             xy = (H[pzone[izone][0]],H[pzone[izone][1]])
     414                B = 0
     415            h = H+np.sum(SuperVec*refl[3:3+Super],axis=0)                   
     416            xy = (h[pzone[izone][0]],h[pzone[izone][1]])
    414417            if Type in ['|DFsq|/sig','|DFsq|>sig','|DFsq|>3sig']:
    415418                if A > 0.0:
     
    431434                            Plot.add_artist(Circle(xy,radius=radius,ec='r',fc='r'))
    432435#    print 'plot time: %.3f'%(time.time()-time0)
    433     HKL = np.array(HKL,dtype=np.int)
     436    HKL = np.array(HKL)
    434437    HKLF = np.array(HKLF)
    435438    Plot.set_xlabel(xlabel[izone]+str(Data['Layer']),fontsize=12)
     
    525528        cell = [10,10,10,90,90,90]
    526529    drawingData = Data['Drawing']
    527     Super = Data.get('Super',0)
     530    Super = Data['Super']
     531    SuperVec = []
     532    for i in range(Super):
     533        SuperVec.append(Data['SuperVec'][i][0])
     534        SuperVec = np.array(SuperVec)
    528535    defaultViewPt = copy.copy(drawingData['viewPoint'])
    529536    Amat,Bmat = G2lat.cell2AB(cell)         #Amat - crystal to cartesian, Bmat - inverse
     
    551558        RC = []
    552559        for i,refl in enumerate(hklRef):
    553             H = np.array(refl[:3])
     560            H = refl[:3]
    554561            if 'HKLF' in Name:
    555562                Fosq,sig,Fcsq = refl[5+Super:8+Super]
    556563            else:
    557564                Fosq,sig,Fcsq = refl[8+Super],1.0,refl[9+Super]
    558             HKL.append(H)
     565            HKL.append(H+np.sum(SuperVec*refl[3:3+Super],axis=0))
    559566            if Data['Type'] == 'Unit':
    560567                R[i] = 0.1
     
    592599        R /= np.max(R)
    593600        R *= Data['Scale']
     601        R = np.where(R<1.e-5,1.e-5,R)
    594602        if Data['Iscale']:
    595603            R = np.where(R<=1.,R,1.)
    596604            C = np.array(C)
    597605            C = (C.T*R).T
    598             R = np.ones_like(R)*0.1     
     606            R = np.ones_like(R)*0.05     
    599607        return HKL,zip(list(R),C)
    600608
  • trunk/GSASIIpwdGUI.py

    r1503 r1506  
    6464            histoList = data['Histograms'].keys()
    6565            if histoName in histoList:
    66                 return True
     66                return G2frame.PatternTree.GetItemText(item)
    6767            item, cookie = G2frame.PatternTree.GetNextChild(phases, cookie)
    6868        return False
     
    25862586    '''respond to selection of PWDR Reflections data tree item.
    25872587    '''
     2588    def OnPlotHKL(event):
     2589        FoMax = np.max(refList.T[8+Super])
     2590        Hmin = np.array([int(np.min(refList.T[0])),int(np.min(refList.T[1])),int(np.min(refList.T[2]))])
     2591        Hmax = np.array([int(np.max(refList.T[0])),int(np.max(refList.T[1])),int(np.max(refList.T[2]))])
     2592        controls = {'Type' : 'Fo','ifFc' : True,'HKLmax' : Hmax,'HKLmin' : Hmin,
     2593            'FoMax' : FoMax,'Zone' : '001','Layer' : 0,'Scale' : 1.0,'Super':Super,'SuperVec':SuperVec}
     2594        G2plt.PlotSngl(G2frame,newPlot=True,Data=controls,hklRef=refList,Title=phaseName)
     2595       
     2596    def OnPlot3DHKL(event):
     2597        FoMax = np.max(refList.T[8+Super])
     2598        Hmin = np.array([int(np.min(refList.T[0])),int(np.min(refList.T[1])),int(np.min(refList.T[2]))])
     2599        Hmax = np.array([int(np.max(refList.T[0])),int(np.max(refList.T[1])),int(np.max(refList.T[2]))])
     2600        Vpoint = [int(np.mean(refList.T[0])),int(np.mean(refList.T[1])),int(np.mean(refList.T[2]))]
     2601        controls = {'Type':'Fosq','Iscale':False,'HKLmax':Hmax,'HKLmin':Hmin,
     2602            'FoMax' : FoMax,'Scale' : 1.0,'Drawing':{'viewPoint':[Vpoint,[]],'default':Vpoint[:],
     2603            'backColor':[0,0,0],'depthFog':False,'Zclip':10.0,'cameraPos':10.,'Zstep':0.05,
     2604            'Scale':1.0,'oldxy':[],'viewDir':[1,0,0]},'Super':Super,'SuperVec':SuperVec}
     2605        G2plt.Plot3DSngl(G2frame,newPlot=True,Data=controls,hklRef=refList,Title=phaseName)
     2606       
     2607    def OnSelectPhase(event):
     2608        dlg = wx.SingleChoiceDialog(G2frame,'Select','Phase',phases)
     2609        try:
     2610            if dlg.ShowModal() == wx.ID_OK:
     2611                sel = dlg.GetSelection()
     2612                G2frame.RefList = phases[sel]
     2613                UpdateReflectionGrid(G2frame,data)
     2614        finally:
     2615            dlg.Destroy()
     2616        G2plt.PlotPatterns(G2frame)
     2617           
    25882618    if not data:
    25892619        print 'No phases, no reflections'
     
    25912621    if HKLF:
    25922622        G2frame.RefList = 1
    2593         phaseName = Name
     2623        phaseName = IsHistogramInAnyPhase(G2frame,Name)
    25942624    else:
    25952625        phaseName = G2frame.RefList
    25962626        phases = data.keys()
    2597    
    2598         def OnSelectPhase(event):
    2599             dlg = wx.SingleChoiceDialog(G2frame,'Select','Phase',phases)
    2600             try:
    2601                 if dlg.ShowModal() == wx.ID_OK:
    2602                     sel = dlg.GetSelection()
    2603                     G2frame.RefList = phases[sel]
    2604                     UpdateReflectionGrid(G2frame,data)
    2605             finally:
    2606                 dlg.Destroy()
    2607             G2plt.PlotPatterns(G2frame)
    2608            
    2609         def OnPlotHKL(event):
    2610             FoMax = np.max(refList.T[8])
    2611             Hmin = np.array([int(np.min(refList.T[0])),int(np.min(refList.T[1])),int(np.min(refList.T[2]))])
    2612             Hmax = np.array([int(np.max(refList.T[0])),int(np.max(refList.T[1])),int(np.max(refList.T[2]))])
    2613             controls = {'Type' : 'Fo','ifFc' : True,'HKLmax' : Hmax,'HKLmin' : Hmin,
    2614                 'FoMax' : FoMax,'Zone' : '001','Layer' : 0,'Scale' : 1.0,}
    2615             G2plt.PlotSngl(G2frame,newPlot=True,Data=controls,hklRef=refList,Title=phaseName)
    2616            
    2617         def OnPlot3DHKL(event):
    2618             FoMax = np.max(refList.T[8])
    2619             Hmin = np.array([int(np.min(refList.T[0])),int(np.min(refList.T[1])),int(np.min(refList.T[2]))])
    2620             Hmax = np.array([int(np.max(refList.T[0])),int(np.max(refList.T[1])),int(np.max(refList.T[2]))])
    2621             Vpoint = [int(np.mean(refList.T[0])),int(np.mean(refList.T[1])),int(np.mean(refList.T[2]))]
    2622             controls = {'Type':'Fosq','Iscale':False,'HKLmax':Hmax,'HKLmin':Hmin,
    2623                 'FoMax' : FoMax,'Scale' : 1.0,'Drawing':{'viewPoint':[Vpoint,[]],'default':Vpoint[:],
    2624                 'backColor':[0,0,0],'depthFog':False,'Zclip':10.0,'cameraPos':10.,'Zstep':0.05,
    2625                 'Scale':1.0,'oldxy':[],'viewDir':[1,0,0]}}
    2626             G2plt.Plot3DSngl(G2frame,newPlot=True,Data=controls,hklRef=refList,Title=phaseName)
    2627        
    26282627    if G2frame.dataDisplay:
    26292628        G2frame.dataFrame.Clear()
    26302629    Inst = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId, 'Instrument Parameters'))[0]
     2630    if phaseName:
     2631        pId = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,'Phases')
     2632        phaseId =  G2gd.GetPatternTreeItemId(G2frame,pId,phaseName)
     2633        General = G2frame.PatternTree.GetItemPyData(phaseId)['General']
     2634        Super = General.get('Super',0)
     2635        SuperVec = General.get('SuperVec',[])
     2636    else:
     2637        Super = 0
     2638        SuperVec = []       
    26312639    rowLabels = []
    26322640    if HKLF:
    26332641        G2gd.SetDataMenuBar(G2frame)
    2634         refs = data[1]['RefList']
    2635         Super = data[1].get('Super',0)
     2642        refList = data[1]['RefList']
     2643        G2gd.SetDataMenuBar(G2frame,G2frame.dataFrame.ReflMenu)
     2644        if not G2frame.dataFrame.GetStatusBar():
     2645            Status = G2frame.dataFrame.CreateStatusBar()   
     2646        G2frame.Bind(wx.EVT_MENU, OnPlotHKL, id=G2gd.wxID_PWDHKLPLOT)
     2647        G2frame.Bind(wx.EVT_MENU, OnPlot3DHKL, id=G2gd.wxID_PWD3DHKLPLOT)
     2648        G2frame.dataFrame.SelectPhase.Enable(False)
     2649        refs = refList
    26362650    else:
    2637         Super = 0   #for now       
    26382651        G2gd.SetDataMenuBar(G2frame,G2frame.dataFrame.ReflMenu)
    26392652        if not G2frame.dataFrame.GetStatusBar():
     
    26472660        try:            #patch for old reflection lists
    26482661            refList = np.array(data[G2frame.RefList]['RefList'])
    2649             I100 = refList.T[8]*refList.T[11]
     2662            I100 = refList.T[8+Super]*refList.T[11+Super]
    26502663        except TypeError:
    2651             refList = np.array([refl[:11] for refl in data[G2frame.RefList]])
    2652             I100 = refList.T[8]*np.array([refl[11] for refl in data[G2frame.RefList]])
     2664            refList = np.array([refl[:11+Super] for refl in data[G2frame.RefList]])
     2665            I100 = refList.T[8+Super]*np.array([refl[11+Super] for refl in data[G2frame.RefList]])
    26532666        Imax = np.max(I100)
    26542667        if Imax:
    26552668            I100 *= 100.0/Imax
    26562669        if 'C' in Inst['Type'][0]:
    2657             refs = np.vstack((refList.T[:15],I100)).T
     2670            refs = np.vstack((refList.T[:15+Super],I100)).T
    26582671        elif 'T' in Inst['Type'][0]:
    2659             refs = np.vstack((refList.T[:18],I100)).T
     2672            refs = np.vstack((refList.T[:18+Super],I100)).T
    26602673           
    26612674    for i in range(len(refs)): rowLabels.append(str(i))
     
    26792692            colLabels = ['H','K','L','mul','d','pos','sig','gam','Fosq','Fcsq','phase','Icorr','alp','bet','wave','Prfo','Abs','Ext','I100']
    26802693            Types += 7*[wg.GRID_VALUE_FLOAT+':10,3',]
     2694        if Super:
     2695            for i in range(Super):
     2696                colLabels.insert(3+i,superLabels[i])
    26812697           
    26822698    G2frame.PeakTable = G2gd.Table(refs,rowLabels=rowLabels,colLabels=colLabels,types=Types)
  • trunk/imports/G2phase.py

    r1503 r1506  
    363363        self.errors = 'no spgroup record found after cell record'
    364364        return False
     365       
    365366    def Reader(self,filename,filepointer, ParentFrame=None, **unused):
    366367        'Read a m50 file using :meth:`ReadJANAPhase`'
     
    382383        Title = os.path.basename(filename)
    383384        Compnd = ''
     385        Type = 'nuclear'
    384386        Atoms = []
    385387        Atypes = []
     388        SuperVec = [[[0,0,.1],False,4],[[0,0,.1],False,4],[[0,0,.1],False,4]]
    386389        S = file.readline()
    387390        line = 1
    388391        SGData = None
     392        SuperSg = ''
    389393        cell = None
     394        nqi = 0
    390395        while S:
    391396            self.errors = 'Error reading at line '+str(line)
     
    398403                Volume = G2lat.calc_V(G2lat.cell2A(cell))
    399404            elif 'spgroup' in S:
     405                if 'X' in S:
     406                    raise self.ImportException("Supersymmetry too high; GSAS-II limited to (3+1) supersymmetry")           
    400407                SpGrp = S.split()[1]
     408                if '(' in SpGrp:    #supercell symmetry - split in 2
     409                    SuperStr = SpGrp.split('(')
     410                    SpGrp = SuperStr[0]
     411                    SuperSg = '('+SuperStr[1]
    401412                SpGrpNorm = G2spc.StandardizeSpcName(SpGrp)
    402413                E,SGData = G2spc.SpcGroup(SpGrp)
    403414                # space group processing failed, try to look up name in table
    404                 if E:
    405                     SpGrpNorm = G2spc.StandardizeSpcName(SpGrp)
    406                     if SpGrpNorm:
    407                         E,SGData = G2spc.SpcGroup(SpGrpNorm)
    408415                while E:
    409416                    print G2spc.SGErrors(E)
     
    421428                SGlines = G2spc.SGPrint(SGData)
    422429                for l in SGlines: print l
     430            elif 'qi' in S[:2]:
     431                if nqi:
     432                    raise self.ImportException("Supersymmetry too high; GSAS-II limited to (3+1) supersymmetry")           
     433                Type = 'modulated'
     434                vec = S.split()[1:]
     435                SuperVec[nqi] = [[float(vec[i]) for i in range(3)],False,4]
     436                nqi += 1
    423437            elif 'atom' in S[:4]:
    424438                Atypes.append(S.split()[1])
     
    431445            self.warnings += "Change this in phase's General tab."
    432446            SGData = G2IO.SGData # P 1
     447        waveTypes = ['Fourier','Sawtooth','ZigZag',]
    433448        filename2 = os.path.splitext(filename)[0]+'.m40'
    434449        file2 = open(filename2,'Ur')
     
    439454        for i in range(4):
    440455            S = file2.readline()           
    441         line = 5
    442456        for i in range(nAtoms):
    443457            S1 = file2.readline()
    444             S2 = file2.readline()
     458            S1N = S1.split()[-3:]   # no. occ, no. pos waves, no. ADP waves
     459            S1N = [int(i) for i in S1N]
     460            S1T = list(S1[60:63])
     461            waveType = waveTypes[int(S1T[1])]
     462            crenelType = ''
     463            Spos = []
     464            Sadp = []
     465            Sfrac = []
     466            Smag = []
    445467            XYZ = [float(S1[27:36]),float(S1[36:45]),float(S1[45:54])]
    446468            SytSym,Mult = G2spc.SytSym(XYZ,SGData)
    447             Type = Atypes[int(S1[9:11])-1]
     469            aType = Atypes[int(S1[9:11])-1]
    448470            Name = S1[:8].strip()
    449471            if S1[11:15].strip() == '1':
     472                S2 = file2.readline()
    450473                Uiso = float(S2[:9])
    451474                Uij = [0,0,0,0,0,0]
    452475                IA = 'I'
    453476            elif S1[11:15].strip() == '2':
     477                S2 = file2.readline()
    454478                IA = 'A'
    455479                Uiso = 0.
    456480                Uij = [float(S2[:9]),float(S2[9:18]),float(S2[18:27]),
    457481                    float(S2[27:36]),float(S2[36:45]),float(S2[45:54])]
    458             Atom = [Name,Type,'',XYZ[0],XYZ[1],XYZ[2],1.0,SytSym,Mult,IA,Uiso,
    459                 Uij[0],Uij[1],Uij[2],Uij[3],Uij[4],Uij[5]]
     482            for i in range(S1N[0]):
     483                if not i:
     484                    FS = file2.readline()
     485                    Sfrac.append(FS[:9])    #'O' or 'delta' = 'length' for crenel
     486                    if int(S1T[0]):  #"", "Legendre" or "Xharm" in 18:27 for "crenel"!
     487                        waveType = 'Crenel/Fourier' #all waves 'Fourier' no other choice
     488                        crenelType = FS[18:27]
     489                Sfrac.append(file2.readline()[:18]) #if not crenel = Osin & Ocos
     490                # else Osin & Ocos except last one is X40 = 'Center'
     491            for i in range(S1N[1]): 
     492                Spos.append(file2.readline()[:54])
     493            for i in range(S1N[2]):
     494                Sadp.append(file2.readline()[:54]+file2.readline())
     495            if sum(S1N):    #if any waves: skip mystery line?
     496                file2.readline()
     497            for i,it in enumerate(Sfrac):
     498                print i,it
     499                if not i:
     500                    if 'Crenel' in waveType:
     501                        vals = [float(it),float(Sfrac[-1][:9])]
     502                    else:
     503                        vals = [float(it),]
     504                else:
     505                    vals = [float(it[:9]),float(it[9:18])]
     506                if 'Crenel' in waveType and i == len(Sfrac)-1:
     507                    del Sfrac[-1]
     508                    break               
     509                Sfrac[i] = [vals,False]
     510                print Sfrac[i]
     511            for i,it in enumerate(Spos):
     512                vals = [float(it[:9]),float(it[9:18]),float(it[18:27]),float(it[27:36]),float(it[36:45]),float(it[45:54])]
     513                Spos[i] = [vals,False]
     514            for i,it in enumerate(Sadp):
     515                vals = [float(it[:9]),float(it[9:18]),float(it[18:27]),float(it[27:36]),float(it[36:45]),float(it[45:54]),
     516                    float(it[54:63]),float(it[63:72]),float(it[72:81]),float(it[81:90]),float(it[90:99]),float(it[99:108])]               
     517                Sadp[i] = [vals,False]
     518            Atom = [Name,aType,'',XYZ[0],XYZ[1],XYZ[2],1.0,SytSym,Mult,IA,Uiso]
     519            Atom += Uij
     520            Atom.append({'SS1':{'waveType':waveType,'crenelType':crenelType,'Sfrac':Sfrac,'Spos':Spos,'Sadp':Sadp,'Smag':Smag}})    #SS2 is for (3+2), etc.
    460521            Atom.append(ran.randint(0,sys.maxint))
    461522            Atoms.append(Atom)
    462             line += 2
    463523        file2.close()
    464524        self.errors = 'Error after read complete'
     
    468528            raise self.ImportException("No cell found")
    469529        Phase = G2IO.SetNewPhase(Name=Title,SGData=SGData,cell=cell+[Volume,])
    470         Phase['General']['Type'] = 'nuclear'
     530        Phase['General']['Type'] = Type
     531        Phase['General']['Super'] = nqi
     532        Phase['General']['SuperVec'] = SuperVec
     533        Phase['General']['SuperSg'] = SuperSg
    471534        Phase['General']['AtomPtrs'] = [3,1,7,9]
    472535        Phase['Atoms'] = Atoms
  • trunk/imports/G2pwd_fxye.py

    r1476 r1506  
    161161                    if j < Nch:
    162162                        x.append(xi)
    163                         y.append(yi)
    164                         w.append(1.0/vi)
     163                        if vi <= 0.:
     164                            y.append(0.)
     165                            w.append(0.)
     166                        else:
     167                            y.append(yi)
     168                            w.append(1.0/vi)
    165169                S = File.readline()
    166170            N = len(x)
  • trunk/imports/G2sfact.py

    r1503 r1506  
    191191            self.errors = 'Error after reading reflections (unexpected!)'
    192192            self.RefDict['RefList'] = np.array(self.RefDict['RefList'])
    193             print self.RefDict['RefList'].shape
    194193            self.RefDict['Type'] = 'SXC'
    195194            self.RefDict['Super'] = self.Super
Note: See TracChangeset for help on using the changeset viewer.