- Timestamp:
- Oct 5, 2020 7:10:21 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/GSASIIdataGUI.py ¶
r4578 r4583 8686 8686 elif G2frame.GPXtree.GetItemText(parentID) == 'Phases': 8687 8687 data = G2frame.GPXtree.GetItemPyData(item) 8688 # print('Debug: reload G2phG') 8689 # import imp 8690 # imp.reload(G2phG) 8688 # debug stuff 8689 # if GSASIIpath.GetConfigValue('debug'): 8690 # print('Debug: reloading G2phG') 8691 # import imp 8692 # imp.reload(G2phG) 8693 # end debug stuff 8691 8694 G2phG.UpdatePhaseData(G2frame,item,data) 8692 8695 elif G2frame.GPXtree.GetItemText(parentID) == 'Restraints': … … 8815 8818 G2frame.GPXtree.SetItemPyData(item,data) 8816 8819 #end patch 8820 # debug stuff 8821 #if GSASIIpath.GetConfigValue('debug'): 8822 # import imp 8823 # imp.reload(G2pdG) # for testing changes 8824 # print('debug: reloaded',G2pdG) 8825 # end debug stuff 8817 8826 G2pdG.UpdateUnitCellsGrid(G2frame,data) 8818 8827 if 'PKS' in G2frame.GPXtree.GetItemText(G2frame.PatternId): -
TabularUnified trunk/GSASIImath.py ¶
r4578 r4583 983 983 no translation applied. To be used for numerical derivatives 984 984 985 :param type name: description 986 987 :returns: type name: description 988 989 ''' 990 ''' returns crystal coordinates for atoms described by RBObj 985 :param array Bmat: Orthogonalization matrix, see :func:`GSASIIlattice.cell2AB` 986 :param array Cart: 2D array of coordinates 987 :param array Q: quaternion as an np.array 988 989 :returns: 2D array of fractional coordinates, without translation to origin 991 990 ''' 992 991 XYZ = np.zeros_like(Cart) -
TabularUnified trunk/GSASIIphsGUI.py ¶
r4573 r4583 52 52 import GSASIIddataGUI as G2ddG 53 53 import GSASIIplot as G2plt 54 # if GSASIIpath.GetConfigValue('debug'): 55 # print('Debug reloading',G2plt) 56 # import imp 57 # imp.reload(G2plt) 54 58 import GSASIIdataGUI as G2gd 55 59 import GSASIIIO as G2IO … … 616 620 title = 'Magnetic atom selection' 617 621 wx.Dialog.__init__(self,parent,wx.ID_ANY,title, 618 pos=wx.DefaultPosition,style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER) 622 pos=wx.DefaultPosition,size=(450,275), 623 style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER) 619 624 self.panel = wxscroll.ScrolledPanel(self) #just a dummy - gets destroyed in Draw! 620 625 # self.panel = wx.Panel(self) #just a dummy - gets destroyed in Draw! … … 1331 1336 1332 1337 def FindCoordination(ind,data,neighborArray,coordsArray,cmx=0,targets=None): 1333 'Find atoms coordinating atom ind, speed-up version' 1338 '''Find atoms coordinating atom ind, speed-up version. 1339 This only searches to atoms already added to the Draw Array, though we might want 1340 to search to all atoms in the asymmetric unity (which would mean searching against 1341 atomsAll, but would also require a reformat of atom entry to match difference in 1342 format between atoms and drawatoms. 1343 ''' 1334 1344 generalData = data['General'] 1335 1345 Amat,Bmat = G2lat.cell2AB(generalData['Cell'][1:7]) … … 1337 1347 atomData = data['Drawing']['Atoms'] 1338 1348 cx,ct,cs,ci = data['Drawing']['atomPtrs'] 1349 #atomsAll = data['Atoms'] 1350 #cxa,cta,csa,cia = generalData['AtomPtrs'] 1339 1351 SGData = generalData['SGData'] 1340 1352 cellArray = G2lat.CellBlock(1) … … 1549 1561 for key in defaultDrawing: 1550 1562 if key not in drawingData: drawingData[key] = defaultDrawing[key] 1563 1564 def updateAddRBorientText(G2frame,testRBObj,Bmat): 1565 '''Update all orientation text on the Add RB panel 1566 ''' 1567 for i,sizer in enumerate(G2frame.testRBObjSizers['Osizers']): 1568 sizer.SetLabel('%8.5f'%(testRBObj['rbObj']['Orient'][0][i])) 1569 A,V = G2mth.Q2AVdeg(testRBObj['rbObj']['Orient'][0]) 1570 testRBObj['rbObj']['OrientVec'][0] = A 1571 testRBObj['rbObj']['OrientVec'][1:] = np.inner(Bmat,V) 1572 for i,val in enumerate(testRBObj['rbObj']['OrientVec']): 1573 G2frame.testRBObjSizers['OrientVecSiz'][i].SetValue(val) 1574 G2frame.testRBObjSizers['OrientVecSiz'][4].SetValue( 1575 int(10*testRBObj['rbObj']['OrientVec'][0])) 1551 1576 1552 1577 def UpdatePhaseData(G2frame,Item,data): … … 5653 5678 RMCPdict = data['RMC']['fullrmc'] 5654 5679 # debug stuff 5655 if GSASIIpath.GetConfigValue('debug'):5656 print('reloading',G2pwd)5657 import imp5658 imp.reload(G2pwd)5680 #if GSASIIpath.GetConfigValue('debug'): 5681 # print('reloading',G2pwd) 5682 # import imp 5683 # imp.reload(G2pwd) 5659 5684 # end debug stuff 5660 5685 rname = G2pwd.MakefullrmcRun(pName,data,RMCPdict) … … 10380 10405 return matchTable 10381 10406 10407 def OnAzSlide(event): 10408 '''respond to the azimuth slider moving. 10409 Save & put value into azimuth edit widget; show Q & 10410 update the plot and table 10411 ''' 10412 Obj = event.GetEventObject() 10413 rbObj['OrientVec'][0] = float(Obj.GetValue())/10. 10414 for i in range(4): 10415 val = rbObj['OrientVec'][i] 10416 G2frame.testRBObjSizers['OrientVecSiz'][i].SetValue(val) 10417 Q = G2mth.AVdeg2Q(rbObj['OrientVec'][0], 10418 np.inner(Amat,rbObj['OrientVec'][1:])) 10419 rbObj['Orient'][0] = Q 10420 A,V = G2mth.Q2AVdeg(Q) 10421 rbObj['OrientVec'][1:] = np.inner(Bmat,V) 10422 for i,sizer in enumerate(G2frame.testRBObjSizers['Osizers']): 10423 sizer.SetLabel('%8.5f'%(rbObj['Orient'][0][i])) 10424 G2plt.PlotStructure(G2frame,data,False,UpdateTable) 10425 UpdateTable() 10426 10427 def UpdateOrientation(*args,**kwargs): 10428 '''Respond to a change in the azimuth or vector via 10429 the edit widget; update Q display & azimuth slider 10430 ''' 10431 Q = G2mth.AVdeg2Q(rbObj['OrientVec'][0], 10432 np.inner(Amat,rbObj['OrientVec'][1:])) 10433 rbObj['Orient'][0] = Q 10434 for i,sizer in enumerate(G2frame.testRBObjSizers['Osizers']): 10435 sizer.SetLabel('%8.5f'%(rbObj['Orient'][0][i])) 10436 G2frame.testRBObjSizers['OrientVecSiz'][4].SetValue( 10437 int(10*rbObj['OrientVec'][0])) 10438 G2plt.PlotStructure(G2frame,data,False,UpdateTable) 10439 UpdateTable() 10440 10382 10441 def UpdateTablePlot(*args,**kwargs): 10383 10442 '''update displayed table and plot … … 10473 10532 out = so.leastsq(objectiveDeltaPos,vals,(selDict,data,rbObj)) 10474 10533 data['testRBObj']['rbObj']['Orient'][0][:] = G2mth.normQ(out[0]) 10475 for i,item in enumerate(Osizers): 10476 item.SetLabel('%10.4f'%(data['testRBObj']['rbObj']['Orient'][0][i])) 10534 updateAddRBorientText(G2frame,data['testRBObj'],Bmat) 10477 10535 UpdateTablePlot() 10478 10536 … … 10494 10552 for i,item in enumerate(Xsizers): 10495 10553 item.SetValue(data['testRBObj']['rbObj']['Orig'][0][i]) 10496 for i,item in enumerate(Osizers): 10497 item.SetLabel('%10.4f'%(data['testRBObj']['rbObj']['Orient'][0][i])) 10554 updateAddRBorientText(G2frame,data['testRBObj'],Bmat) 10498 10555 UpdateTablePlot() 10499 10556 … … 10602 10659 Osizers.append(orien) 10603 10660 G2frame.testRBObjSizers.update({'Osizers':Osizers}) 10661 mainSizer.Add(OriSizer) 10662 mainSizer.Add((5,5),0) 10663 OriSizer = wx.BoxSizer(wx.HORIZONTAL) 10664 if 'OrientVec' not in rbObj: rbObj['OrientVec'] = [0.,0.,0.,0.] 10665 rbObj['OrientVec'][0],V = G2mth.Q2AVdeg(rbObj['Orient'][0]) 10666 rbObj['OrientVec'][1:] = np.inner(Bmat,V) 10667 OriSizer.Add(wx.StaticText(RigidBodies,wx.ID_ANY,'Orientation azimuth: '),0,WACV) 10668 OrientVecSiz = [] 10669 OrientVecSiz.append(G2G.ValidatedTxtCtrl(RigidBodies,rbObj['OrientVec'],0,nDig=(10,2), 10670 xmin=0.,xmax=360.,typeHint=float, 10671 OnLeave=UpdateOrientation)) 10672 OriSizer.Add(OrientVecSiz[-1],0,WACV) 10673 azSlide = wx.Slider(RigidBodies,style=wx.SL_HORIZONTAL) 10674 azSlide.SetRange(0,3600) 10675 azSlide.SetValue(int(rbObj['OrientVec'][0]*10.)) 10676 azSlide.Bind(wx.EVT_SLIDER, OnAzSlide) 10677 OriSizer.Add(azSlide,1) 10678 mainSizer.Add(OriSizer) 10679 OriSizer = wx.BoxSizer(wx.HORIZONTAL) 10680 OriSizer.Add(wx.StaticText(RigidBodies,wx.ID_ANY,'Orientation vector'),0,WACV) 10681 for ix,lbl in enumerate('xyz'): 10682 OriSizer.Add(wx.StaticText(RigidBodies,wx.ID_ANY,' '+lbl+': '),0,WACV) 10683 OrientVecSiz.append(G2G.ValidatedTxtCtrl(RigidBodies,rbObj['OrientVec'],ix+1,nDig=(10,4), 10684 xmin=-1.,xmax=1.,typeHint=float, 10685 OnLeave=UpdateOrientation)) 10686 OriSizer.Add(OrientVecSiz[-1],0,WACV) 10687 OrientVecSiz.append(azSlide) 10688 OriSizer.Add(wx.StaticText(RigidBodies,wx.ID_ANY,' (frac coords)'),0,WACV) 10689 G2frame.testRBObjSizers.update({'OrientVecSiz':OrientVecSiz}) 10604 10690 mainSizer.Add(OriSizer) 10605 10691 mainSizer.Add((5,5),0) -
TabularUnified trunk/GSASIIplot.py ¶
r4578 r4583 8389 8389 8390 8390 def SetRBOrigText(): 8391 '''Called w/Locate & Insert Rigid Body to update text in DataWindow 8392 when the RB origin is moved via a mouse drag 8393 ''' 8391 8394 page = getSelection() 8392 8395 if page: … … 8401 8404 8402 8405 def SetRBOrienText(): 8406 '''Called w/Locate & Insert Rigid Body to update text in DataWindow 8407 when the RB orientation is changed via a mouse drag 8408 ''' 8403 8409 page = getSelection() 8404 8410 if page: 8405 8411 if G2frame.phaseDisplay.GetPageText(page) == 'RB Models': 8406 for i,sizer in enumerate(G2frame.testRBObjSizers['Osizers']): 8407 sizer.SetLabel('%8.5f'%(testRBObj['rbObj']['Orient'][0][i])) 8412 G2phG.updateAddRBorientText(G2frame,testRBObj,Bmat) 8408 8413 if pageCallback: 8409 8414 try: … … 8708 8713 GL.glDisable(GL.GL_COLOR_MATERIAL) 8709 8714 GL.glLightfv(GL.GL_LIGHT0,GL.GL_AMBIENT,[.2,.2,.2,1]) 8715 8716 def RenderRBtriplet(orig,Q,Bmat): 8717 '''draw an axes triplet located at the origin of a rigid body 8718 and with the x, y & z axes drawn as red, green and blue. 8719 ''' 8720 GL.glLightfv(GL.GL_LIGHT0,GL.GL_AMBIENT,[.7,.7,.7,1]) 8721 GL.glEnable(GL.GL_COLOR_MATERIAL) 8722 GL.glLineWidth(3) 8723 GL.glEnable(GL.GL_BLEND) 8724 GL.glBlendFunc(GL.GL_SRC_ALPHA,GL.GL_ONE_MINUS_SRC_ALPHA) 8725 GL.glEnable(GL.GL_LINE_SMOOTH) 8726 GL.glPushMatrix() 8727 GL.glTranslate(*orig) 8728 GL.glBegin(GL.GL_LINES) 8729 lines = G2mth.RotateRBXYZ(Bmat,np.eye(3),Q) 8730 colors = [Rd,Gr,Bl] 8731 # lines along axial directions 8732 for line,color in zip(lines,colors): 8733 GL.glColor3ubv(color) 8734 GL.glVertex3fv(np.zeros(3)) 8735 GL.glVertex3fv(line) 8736 # arrows on line ends, colored by planes 8737 for i in range(3): 8738 for j in (1,-1): 8739 GL.glColor3ubv(colors[(i+1)%3]) 8740 GL.glVertex3fv(lines[i]) 8741 GL.glVertex3fv(0.7*lines[i]+ j*0.2*lines[(i+1)%3]) 8742 GL.glColor3ubv(colors[(i+2)%3]) 8743 GL.glVertex3fv(lines[i]) 8744 GL.glVertex3fv(0.7*lines[i]+ j*0.2*lines[(i+2)%3]) 8745 # draw vector part of Q in white 8746 A,V = G2mth.Q2AVdeg(Q) 8747 Vfrac = np.inner(Bmat,V) 8748 GL.glColor3ubv([255,255,255]) 8749 GL.glVertex3fv(np.zeros(3)) 8750 GL.glVertex3fv(1.5*Vfrac) 8751 GL.glEnd() 8752 GL.glPopMatrix() 8753 GL.glColor4ubv([0,0,0,0]) 8754 GL.glDisable(GL.GL_LINE_SMOOTH) 8755 GL.glDisable(GL.GL_BLEND) 8756 GL.glDisable(GL.GL_COLOR_MATERIAL) 8757 GL.glLightfv(GL.GL_LIGHT0,GL.GL_AMBIENT,[.2,.2,.2,1]) 8758 8710 8759 8711 8760 def RenderPlane(plane,color): … … 9299 9348 RenderBonds(x,y,z,rbBonds[ind],0.03,Gr) 9300 9349 RenderLabel(x,y,z,name,0.2,wxOrange,matRot) 9350 RenderRBtriplet(testRBObj['rbObj']['Orig'][0], 9351 testRBObj['rbObj']['Orient'][0], 9352 Bmat) 9301 9353 if len(mcsaModels) > 1 and pageName == 'MC/SA': #skip the default MD entry 9302 9354 for ind,[x,y,z] in enumerate(mcsaXYZ):
Note: See TracChangeset
for help on using the changeset viewer.