Changeset 3254


Ignore:
Timestamp:
Feb 1, 2018 12:44:02 PM (5 years ago)
Author:
vondreele
Message:

fix XsSave? names problem (G2IO)
try to get ProgressBar? box to stay on top
various fixes for entering modulated & modulated magnetic structures from scratch
fix import of super lattice structure factors

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIIO.py

    r3246 r3254  
    799799    return Id       #last powder pattern generated
    800800   
    801 def XYsave(G2frame,XY,labelX='X',labelY='Y',names=None):
     801def XYsave(G2frame,XY,labelX='X',labelY='Y',names=[]):
    802802    'Save XY table data'
    803803    pth = G2G.GetExportPath(G2frame)
     
    817817        return
    818818    for i in range(len(XY)):
    819         if names != None:
     819        if len(names):
    820820            header = '%s,%s(%s)\n'%(labelX,labelY,names[i])
    821821        else:
  • trunk/GSASIIdataGUI.py

    r3251 r3254  
    42894289            return
    42904290        dlg = wx.ProgressDialog('Residual','All data Rw =',101.0,
    4291             style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE|wx.PD_CAN_ABORT,
     4291            style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE|wx.PD_CAN_ABORT|wx.STAY_ON_TOP,
    42924292            parent=self)
    42934293        Size = dlg.GetSize()
     
    42954295            dlg.SetSize((int(Size[0]*1.2),Size[1])) # increase size a bit along x
    42964296        dlg.CenterOnParent()
     4297        dlg.Raise()
    42974298        Rw = 100.00
    42984299        self.SaveTreeSetting()
  • trunk/GSASIImath.py

    r3247 r3254  
    34553455        ang0 = np.angle(Fh0,deg=True)/360.
    34563456        for H,phi in list(zip(Uniq,Phi))[1:]:
     3457            H = np.array(H,dtype=int)
    34573458            ang = (np.angle(Fhklm[H[0],H[1],H[2],H[3]],deg=True)/360.-phi)
    34583459            dH = H-hklm
  • trunk/GSASIIphsGUI.py

    r3247 r3254  
    14851485                                generalData['SuperSg'] = SetDefaultSSsymbol()
    14861486                            generalData['SSGData'] = G2spc.SSpcGroup(generalData['SGData'],generalData['SuperSg'])[1]
    1487                             if 'Super' not in generalData:
     1487                            if 'SuperVec' not in generalData:
    14881488                                generalData['Super'] = 1
    14891489                                generalData['SuperVec'] = [[0.,0.,0.],False,4]
     
    15081508                        wx.CallAfter(UpdateGeneral)
    15091509                else:
    1510                     G2frame.ErrorDialog('Modulation type change error','Can change modulation only if there are no atoms')
    1511                     modulated.SetValue(generalData['Modulated'])               
     1510                    if generalData['Type'] == 'magnetic':
     1511                        pages = [G2frame.phaseDisplay.GetPageText(PageNum) for PageNum in range(G2frame.phaseDisplay.GetPageCount())]
     1512                        generalData['Modulated'] = modulated.GetValue()
     1513                        if generalData['Modulated']:
     1514                            if 'SuperSg' not in generalData:
     1515                                generalData['SuperSg'] = SetDefaultSSsymbol()
     1516                            generalData['SSGData'] = G2spc.SSpcGroup(generalData['SGData'],generalData['SuperSg'])[1]
     1517                            if 'SuperVec' not in generalData:
     1518                                generalData['Super'] = 1
     1519                                generalData['SuperVec'] = [[0.,0.,0.],False,4]
     1520                                generalData['SSGData'] = {}
     1521                            if '4DmapData' not in generalData:
     1522                                generalData['4DmapData'] = mapDefault.copy()
     1523                                generalData['4DmapData'].update({'MapType':'Fobs'})
     1524                            if 'Wave Data' not in pages:
     1525                                G2frame.waveData = wx.ScrolledWindow(G2frame.phaseDisplay)
     1526                                G2frame.phaseDisplay.InsertPage(3,G2frame.waveData,'Wave Data')
     1527                                Id = wx.NewId()
     1528                                TabSelectionIdDict[Id] = 'Wave Data'
     1529                        Atoms = data['Atoms']
     1530                        for atom in Atoms:
     1531                            atom += [[],[],{'SS1':{'waveType':'Fourier','Sfrac':[],'Spos':[],'Sadp':[],'Smag':[]}}]
     1532                        wx.CallAfter(UpdateGeneral)
     1533                    else:
     1534                        G2frame.ErrorDialog('Modulation type change error','Can change modulation only if there are no atoms')
     1535                        modulated.SetValue(generalData['Modulated'])               
    15121536               
    15131537            nameSizer = wx.BoxSizer(wx.HORIZONTAL)
     
    18601884            modSizer = wx.BoxSizer(wx.HORIZONTAL)
    18611885            modSizer.Add(wx.StaticText(General,label=' '+name.capitalize()+' structure controls: '),0,WACV)
    1862             SpGrp = generalData['SGData']['SpGrp']
    1863             if generalData['SGData']['SGGray']:
     1886            SGData = generalData['SGData']
     1887            SpGrp = SGData['SpGrp']
     1888            if SGData['SGGray']:
    18641889                SpGrp += " 1'"
    18651890            modSizer.Add(wx.StaticText(General,label=' Superspace group: %s '%SpGrp),0,WACV)
    18661891            Choice = []
    1867             if not generalData['SGData']['SGFixed']:
    1868                 SSChoice = G2spc.SSChoice(generalData['SGData'])
    1869                 if generalData['SGData']['SGGray']:
    1870                     SSChoice = [item+'s' for item in SSChoice]
     1892            if not SGData['SGFixed']:
     1893                SSChoice = G2spc.SSChoice(SGData)
    18711894                for item in SSChoice:
    1872                     E,SSG = G2spc.SSpcGroup(generalData['SGData'],item)
     1895                    E,SSG = G2spc.SSpcGroup(SGData,item)
    18731896                    if SSG: Choice.append(item)
     1897                if SGData['SGGray']:
     1898                    Choice = [G2spc.fixGray(SGData,item) for item in Choice]
    18741899            if len(Choice):
    18751900                superGp = wx.ComboBox(General,value=generalData['SuperSg'],choices=Choice,style=wx.CB_DROPDOWN|wx.TE_PROCESS_ENTER)
     
    48274852        if 'Plane' not in drawingData:
    48284853            drawingData['Plane'] = [[0,0,1],False,False,0.0,[255,255,0]]
     4854        if 'magMult' not in drawingData:
     4855            drawingData['magMult'] = 1.0
    48294856        cx,ct,cs,ci = [0,0,0,0]
    48304857        if generalData['Type'] in ['nuclear','faulted',]:
  • trunk/GSASIIplot.py

    r3248 r3254  
    29832983################################################################################
    29842984           
    2985 def PlotXY(G2frame,XY,XY2=None,labelX='X',labelY='Y',newPlot=False,
     2985def PlotXY(G2frame,XY,XY2=[],labelX='X',labelY='Y',newPlot=False,
    29862986    Title='',lines=False,names=[],names2=[],vertLines=[]):
    29872987    '''simple plot of xy data
     
    30183018            if len(XY):
    30193019                G2IO.XYsave(G2frame,XY,labelX,labelY,names)
    3020             if XY2 != []:
     3020            if len(XY2):
    30213021                G2IO.XYsave(G2frame,XY2,labelX,labelY,names2)
    30223022#        else:
     
    62546254    def Set4DMapRoll(newxy):
    62556255        rho = generalData['4DmapData']['rho']
    6256         roll = GetRoll(newxy,rho.shape[:3])
    6257         generalData['4DmapData']['rho'] = np.roll(np.roll(np.roll(rho,roll[0],axis=0),roll[1],axis=1),roll[2],axis=2)
     6256        if len(rho):
     6257            roll = GetRoll(newxy,rho.shape[:3])
     6258            generalData['4DmapData']['rho'] = np.roll(np.roll(np.roll(rho,roll[0],axis=0),roll[1],axis=1),roll[2],axis=2)
    62586259       
    62596260    def SetPeakRoll(newxy):
  • trunk/GSASIIspc.py

    r3247 r3254  
    10801080
    10811081    """
    1082    
    1083 #    def checkModSym():
    1084 #        '''
    1085 #        Checks to see if proposed modulation form is allowed for Laue group
    1086 #        '''
    1087 #        if LaueId in [0,] and LaueModId in [0,]:
    1088 #            return True
    1089 #        elif LaueId in [1,]:
    1090 #            try:
    1091 #                if modsym.index('1/2') != ['A','B','C'].index(SGData['SGLatt']):
    1092 #                    return False
    1093 #                if 'I'.index(SGData['SGLatt']) and modsym.count('1/2') not in [0,2]:
    1094 #                    return False
    1095 #            except ValueError:
    1096 #                pass
    1097 #            if SGData['SGUniq'] == 'a' and LaueModId in [5,6,7,8,9,10,]:
    1098 #                return True
    1099 #            elif SGData['SGUniq'] == 'b' and LaueModId in [3,4,13,14,15,16,]:
    1100 #                return True
    1101 #            elif SGData['SGUniq'] == 'c' and LaueModId in [1,2,19,20,21,22,]:
    1102 #                return True
    1103 #        elif LaueId in [2,] and LaueModId in [i+7 for i in range(18)]:
    1104 #            try:
    1105 #                if modsym.index('1/2') != ['A','B','C'].index(SGData['SGLatt']):
    1106 #                    return False
    1107 #                if SGData['SGLatt'] in ['I','F',] and modsym.index('1/2'):
    1108 #                    return False
    1109 #            except ValueError:
    1110 #                pass
    1111 #            return True
    1112 #        elif LaueId in [3,4,] and LaueModId in [19,22,]:
    1113 #            try:
    1114 #                if SGData['SGLatt'] == 'I' and modsym.count('1/2'):
    1115 #                    return False
    1116 #            except ValueError:
    1117 #                pass
    1118 #            return True
    1119 #        elif LaueId in [7,8,9,] and LaueModId in [19,25,]:
    1120 #            if (SGData['SGLatt'] == 'R' or SGData['SGPtGrp'] in ['3m1','-3m1']) and modsym.count('1/3'):
    1121 #                return False
    1122 #            return True
    1123 #        elif LaueId in [10,11,] and LaueModId in [19,]:
    1124 #            return True
    1125 #        return False
    1126        
     1082           
    11271083    def fixMonoOrtho():
    11281084        mod = ''.join(modsym).replace('1/2','0').replace('1','0')
     
    11471103        else:   #orthorhombic
    11481104            return [-SSGKl[i] if mod[i] in ['a','b','g'] else SSGKl[i] for i in range(3)]
    1149                
     1105       
    11501106    def extendSSGOps(SSGOps):
    11511107        for OpA in SSGOps:
     
    14091365        return gensym
    14101366                           
    1411 #    LaueModList = [
    1412 #        'abg','ab0','ab1/2','a0g','a1/2g',  '0bg','1/2bg','a00','a01/2','a1/20',
    1413 #        'a1/21/2','a01','a10','0b0','0b1/2', '1/2b0','1/2b1/2','0b1','1b0','00g',
    1414 #        '01/2g','1/20g','1/21/2g','01g','10g', '1/31/3g']
    1415 #    LaueList = ['-1','2/m','mmm','4/m','4/mmm','3R','3mR','3','3m1','31m','6/m','6/mmm','m3','m3m']
    1416 #    GenSymList = ['','s','0s','s0', '00s','0s0','s00','s0s','ss0','0ss','q00','0q0','00q','qq0','q0q', '0qq',
    1417 #        'q','qqs','s0s0','00ss','s00s','t','t00','t0','h','h00','000s','0000s']
    14181367    Fracs = {'1/2':0.5,'1/3':1./3,'1':1.0,'0':0.,'s':.5,'t':1./3,'q':.25,'h':1./6,'a':0.,'b':0.,'g':0.}
    1419 #    LaueId = LaueList.index(SGData['SGLaue'])
    14201368    if SGData['SGLaue'] in ['m3','m3m']:
    14211369        return '(3+1) superlattices not defined for cubic space groups',None
     
    14261374    except ValueError:
    14271375        return 'Error in superspace symbol '+SSymbol,None
    1428 #    if ''.join(gensym) not in GenSymList:
    1429 #        if SGData['SGGray'] and ''.join(gensym[:-1]) not in GenSymList:
    1430 #            return 'unknown generator symbol '+''.join(gensym),None
    1431 #    try:
    1432 #        LaueModId = LaueModList.index(''.join(modsym))
    1433 #    except ValueError:
    1434 #        return 'Unknown modulation symbol '+''.join(modsym),None
    1435 #    if not checkModSym():
    1436 #        return 'Modulation '+''.join(modsym)+' not consistent with space group '+SGData['SpGrp'],None
    14371376    modQ = [Fracs[mod] for mod in modsym]
    14381377    SSGKl = SGData['SSGKl'][:]
     
    15191458    return ssChoice
    15201459
     1460def fixGray(SGData,SSymbol):
     1461    modsym,gensym = SSymbol.replace(' ','').split(')')
     1462    modsym += ')'
     1463    if gensym:
     1464        gensym += 's'
     1465    else:
     1466        if SGData['SGPtGrp'] in ['1','2','m','3','4','6']:
     1467            gensym += '0s'
     1468        elif SGData['SGPtGrp'] in ['2/m','4/m','6/m']:
     1469            gensym += '00s'
     1470        elif SGData['SGPtGrp'] in ['4/mmm','6/mmm']:
     1471            gensym += '0000s'
     1472        else:
     1473            gensym += '000s'
     1474    return modsym+gensym
     1475           
    15211476def splitSSsym(SSymbol):
    15221477    '''
  • trunk/GSASIIstrMath.py

    r3245 r3254  
    41684168            if dlg:
    41694169                dlg.Update(Histogram['Residuals']['wR'],newmsg='Hessian for histogram %d\nAll data Rw=%8.3f%s'%(hId,Histogram['Residuals']['wR'],'%'))
     4170                dlg.Raise()
    41704171            if len(Hess):
    41714172                Hess += np.inner(dMdvh,dMdvh)
     
    41904191            if dlg:
    41914192                dlg.Update(Histogram['Residuals']['wR'],newmsg='Hessian for histogram %d Rw=%8.3f%s'%(hId,Histogram['Residuals']['wR'],'%'))[0]
     4193                dlg.Raise()
    41924194            if len(Hess):
    41934195                Vec += wtFactor*np.sum(dMdvh*wdf,axis=1)
     
    42704272            if dlg:
    42714273                dlg.Update(Histogram['Residuals']['wR'],newmsg='For histogram %d Rw=%8.3f%s'%(hId,Histogram['Residuals']['wR'],'%'))[0]
     4274                dlg.Raise()
    42724275            M = np.concatenate((M,wdy))
    42734276#end of PWDR processing
     
    44134416            if dlg:
    44144417                dlg.Update(Histogram['Residuals']['wR'],newmsg='For histogram %d Rw=%8.3f%s'%(hId,Histogram['Residuals']['wR'],'%'))[0]
     4418                dlg.Raise()
    44154419            M = np.concatenate((M,wtFactor*df))
    44164420# end of HKLF processing
  • trunk/imports/G2sfact.py

    r3245 r3254  
    210210        first = True
    211211        fp = open(filename,'r')
     212        m1 = 0
    212213        for line,S in enumerate(fp):
    213214            self.errors = '  Error reading line '+str(line+1)
     
    229230            if Tw in ['','0']:
    230231                Tw = '1'
    231             if not any([h,k,l]):
     232            if not any([h,k,l,m1]):
    232233                break
    233234            if '-' in Tw:
Note: See TracChangeset for help on using the changeset viewer.