Changeset 2212
- Timestamp:
- Apr 14, 2016 3:44:39 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIgrid.py
r2211 r2212 342 342 self.Trans = np.eye(3) 343 343 self.Vec = np.zeros(3) 344 self.SpGrp = phase['General']['SGData']['SpGrp'] 344 self.oldSpGrp = phase['General']['SGData']['SpGrp'] 345 self.oldSGdata = phase['General']['SGData'] 346 self.newSpGrp = self.Phase['General']['SGData']['SpGrp'] 345 347 self.oldCell = phase['General']['Cell'][1:8] 346 self.newCell = copy.copy(self.oldCell)348 self.newCell = self.Phase['General']['Cell'][1:8] 347 349 self.Common = 'abc' 348 350 self.Draw() … … 365 367 Obj = event.GetEventObject() 366 368 self.Common = Obj.GetValue() 367 self.Trans = commonTrans[self.Common] 369 if '*' in self.Common: 370 A,B = G2lat.cell2AB(self.oldCell[:6]) 371 self.newCell[2:5] = [A[2,2],90.,90.] 372 a,b = G2lat.cell2AB(self.newCell[:6]) 373 self.Trans = np.inner(a.T,B) #correct! 374 self.newSpGrp = 'P 1' 375 SGErr,SGData = G2spc.SpcGroup(self.newSpGrp) 376 self.Phase['General']['SGData'] = SGData 377 else: 378 self.Trans = commonTrans[self.Common] 368 379 OnTest(event) 369 380 … … 373 384 for fld in Flds: fld = fld.strip() 374 385 SpcGp = ' '.join(Flds) 375 if SpcGp == self. SpGrp: #didn't change it!386 if SpcGp == self.newSpGrp: #didn't change it! 376 387 return 377 388 # try a lookup on the user-supplied name … … 383 394 if SGErr: 384 395 text = [G2spc.SGErrors(SGErr)+'\nSpace Group set to previous'] 385 SGTxt.SetValue(self. SpGrp)396 SGTxt.SetValue(self.newSpGrp) 386 397 msg = 'Space Group Error' 387 398 Style = wx.ICON_EXCLAMATION … … 391 402 text,table = G2spc.SGPrint(SGData) 392 403 self.Phase['General']['SGData'] = SGData 393 self. SpGrp = SpcGp404 self.newSpGrp = SpcGp 394 405 SGTxt.SetValue(self.Phase['General']['SGData']['SpGrp']) 395 406 msg = 'Space Group Information' … … 454 465 sgSizer = wx.BoxSizer(wx.HORIZONTAL) 455 466 sgSizer.Add(wx.StaticText(self.panel,label=' Space group: '),0,WACV) 456 SGTxt = wx.TextCtrl(self.panel,value=self. SpGrp,style=wx.TE_PROCESS_ENTER)467 SGTxt = wx.TextCtrl(self.panel,value=self.newSpGrp,style=wx.TE_PROCESS_ENTER) 457 468 SGTxt.Bind(wx.EVT_TEXT_ENTER,OnSpaceGroup) 458 469 SGTxt.Bind(wx.EVT_KILL_FOCUS,OnSpaceGroup) -
trunk/GSASIIimgGUI.py
r2192 r2212 22 22 import math 23 23 import time 24 import copy25 24 import sys 26 25 import wx … … 173 172 G2plt.PlotExposedImage(G2frame,event=event) 174 173 174 def ResetThresholds(): 175 Imin = max(0.,np.min(G2frame.ImageZ)) 176 Imax = np.max(G2frame.ImageZ) 177 data['range'] = [(Imin,Imax),[Imin,Imax]] 178 masks['Thresholds'] = [(Imin,Imax),[Imin,Imax]] 179 MaxSizer.GetChildren()[2].Window.SetValue(str(int(Imax))) #tricky 180 MaxSizer.GetChildren()[5].Window.SetValue(str(int(Imin))) #tricky 181 175 182 def OnIntegrate(event): 176 183 '''Integrate image in response to a menu event or from the AutoIntegrate … … 358 365 finally: 359 366 dlg.Destroy() 367 G2frame.ImageZ = GetImageZ(G2frame,data) 368 ResetThresholds() 360 369 G2plt.PlotExposedImage(G2frame,event=event) 361 370 wx.CallLater(100,UpdateImageControls,G2frame,data,masks) … … 814 823 def BackSizer(): 815 824 816 def ResetThresholds():817 Imin = max(0.,np.min(G2frame.ImageZ))818 Imax = np.max(G2frame.ImageZ)819 data['range'] = [(Imin,Imax),[Imin,Imax]]820 masks['Thresholds'] = [(Imin,Imax),[Imin,Imax]]821 MaxSizer.GetChildren()[2].Window.SetValue(str(int(Imax))) #tricky822 MaxSizer.GetChildren()[5].Window.SetValue(str(int(Imin))) #tricky823 824 825 def OnBackImage(event): 825 826 data['background image'][0] = backImage.GetValue() -
trunk/GSASIIlattice.py
r2154 r2212 31 31 ########### SVN repository information ################### 32 32 import math 33 import copy 34 import sys 35 import random as ran 33 36 import numpy as np 34 37 import numpy.linalg as nl … … 225 228 Uij = np.inner(Trans,np.inner(U6toUij(U6),Trans)) 226 229 return UijtoU6(Uij) 227 230 231 def TransformPhase(oldPhase,newPhase,Trans,Vec): 232 '''Transform atoms from oldPhase to newPhase by Trans & Vec 233 234 :param oldPhase: dict G2 phase info for old phase 235 :param newPhase: dict G2 phase info for new phase; with new cell & space group 236 atoms are from oldPhase & will be transformed 237 :param Trans: array transformation matrix 238 :param Vec: array transformation vector 239 ''' 240 241 cx,ct,cs,cia = oldPhase['General']['AtomPtrs'] 242 SGData = newPhase['General']['SGData'] 243 invTrans = nl.inv(Trans) 244 newAtoms = FillUnitCell(oldPhase) 245 for atom in newAtoms: 246 atom[cx:cx+3] = TransformXYZ(atom[cx:cx+3],invTrans.T,Vec) 247 if atom[cia] == 'A': 248 atom[cia+2:cia+8] = TransformU6(atom[cia+2:cia+8],invTrans) 249 atom[cs:cs+2] = G2spc.SytSym(atom[cx:cx+3],SGData) 250 atom[cia+8] = ran.randint(0,sys.maxint) 251 newPhase['Atoms'] = newAtoms 252 # GetUnique(newPhase) 253 return newPhase 254 255 256 def FillUnitCell(Phase): 257 atomData = copy.deepcopy(Phase['Atoms']) 258 nAtoms = len(atomData) 259 SGData = Phase['General']['SGData'] 260 cx,ct,cs,cia = Phase['General']['AtomPtrs'] 261 for atom in atomData[:nAtoms]: 262 XYZ = np.array(atom[cx:cx+3]) 263 if atom[cia] == 'A': 264 Uij = atom[cia+2:cia+8] 265 result = G2spc.GenAtom(XYZ,SGData,False,Uij,True) 266 for item in result: 267 atom[cx:cx+3] = item[0] 268 atom[cia+2:cia+8] = item[1] 269 atomData.append(atom[:cia+9]) #not SS stuff 270 else: 271 result = G2spc.GenAtom(XYZ,SGData,False,Move=True) 272 for item in result: 273 atom[cx:cx+3] = item[0] 274 atomData.append(atom[:cia+9]) #not SS stuff 275 return atomData 276 277 def GetUnique(Phase): 278 pass 279 # def noDuplicate(xyz,peaks,Amat): 280 # if True in [np.allclose(np.inner(Amat,xyz),np.inner(Amat,peak),atol=0.5) for peak in peaks]: 281 # return False 282 # return True 283 # 284 # generalData = data['General'] 285 # cell = generalData['Cell'][1:7] 286 # Amat,Bmat = G2lat.cell2AB(generalData['Cell'][1:7]) 287 # A = G2lat.cell2A(cell) 288 # SGData = generalData['SGData'] 289 # mapPeaks = data['Map Peaks'] 290 # Indx = {} 291 # XYZ = {} 292 # for ind in Ind: 293 # XYZ[ind] = np.array(mapPeaks[ind][1:4]) 294 # Indx[ind] = True 295 # for ind in Ind: 296 # if Indx[ind]: 297 # xyz = XYZ[ind] 298 # for jnd in Ind: 299 # if ind != jnd and Indx[jnd]: 300 # Equiv = G2spc.GenAtom(XYZ[jnd],SGData,Move=True) 301 # xyzs = np.array([equiv[0] for equiv in Equiv]) 302 # Indx[jnd] = noDuplicate(xyz,xyzs,Amat) 303 # Ind = [] 304 # for ind in Indx: 305 # if Indx[ind]: 306 # Ind.append(ind) 307 # return Ind 308 309 310 228 311 def calc_rVsq(A): 229 312 """Compute the square of the reciprocal lattice volume (1/V**2) from A' -
trunk/GSASIIphsGUI.py
r2211 r2212 1227 1227 dlg.Destroy() 1228 1228 phaseName = newPhase['General']['Name'] 1229 print phaseName1229 newPhase = G2lat.TransformPhase(data,newPhase,Trans,Vec) 1230 1230 sub = G2frame.PatternTree.AppendItem(parent= 1231 1231 G2gd.GetPatternTreeItemId(G2frame,G2frame.root,'Phases'),text=phaseName) -
trunk/GSASIIplot.py
r2211 r2212 126 126 attribs = (wx.glcanvas.WX_GL_DOUBLEBUFFER,) 127 127 self.canvas = wx.glcanvas.GLCanvas(self,-1,attribList=attribs,**kwargs) 128 # create GL context for wx > 2.8128 # create GL context 129 129 i,j= wx.__version__.split('.')[0:2] 130 130 if int(i)+int(j)/10. > 2.8: … … 1113 1113 RenderDots(HKL,RC) 1114 1114 time0 = time.time() 1115 if Page.context: Page.canvas.SetCurrent(Page.context) # wx 2.9 fix1115 if Page.context: Page.canvas.SetCurrent(Page.context) 1116 1116 Page.canvas.SwapBuffers() 1117 1117 … … 5656 5656 RenderBackbone(Backbone,BackboneColor,bondR) 5657 5657 # print time.time()-time0 5658 if Page.context: Page.canvas.SetCurrent(Page.context) # wx 2.9 fix5658 if Page.context: Page.canvas.SetCurrent(Page.context) 5659 5659 Page.canvas.SwapBuffers() 5660 5660 … … 5963 5963 RenderBonds(x,y,z,Bonds[iat],0.05,color) 5964 5964 RenderLabel(x,y,z,' '+atNames[iat],matRot) 5965 if Page.context: Page.canvas.SetCurrent(Page.context) # wx 2.9 fix5965 if Page.context: Page.canvas.SetCurrent(Page.context) 5966 5966 Page.canvas.SwapBuffers() 5967 5967 … … 6349 6349 if Page.labels: 6350 6350 RenderLabel(x,y,z,' '+AtNames[iat],matRot) 6351 if Page.context: Page.canvas.SetCurrent(Page.context) # wx 2.9 fix6351 if Page.context: Page.canvas.SetCurrent(Page.context) 6352 6352 Page.canvas.SwapBuffers() 6353 6353
Note: See TracChangeset
for help on using the changeset viewer.