Skip to content

Commit 5fac707

Browse files
committed
oops, forgot to pull before commits
Merge branch 'main' of github.com:AdvancedPhotonSource/GSAS-II
2 parents 307316c + 2b86391 commit 5fac707

4 files changed

Lines changed: 97 additions & 4 deletions

File tree

GSASII/GSASIIphsGUI2.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ def OnVvec(event):
332332
Obj.SetValue(deformationData[-dId]['V'])
333333
G2G.G2MessageBox(G2frame,'ERROR: V-vector zero or parallel to U','Invalid vector choice')
334334
return
335-
if nl.det(UVmat) < 0.: #ensure right hand
335+
if nl.det(UVmat) < 0.: #insure right hand
336336
UVmat *= -1.
337337
deformationData[-dId]['V'] = Obj.GetValue()
338338
data['Deformations'][-dId]['UVmat'] = UVmat
@@ -343,7 +343,7 @@ def OnAtSel(event):
343343
wx.CallAfter(UpdateDeformation,G2frame,data,dId)
344344

345345
def Kappa(deformation,orbSizer,dId,orb,kname,Indx):
346-
orbSizer.Add(G2G.ValidatedTxtCtrl(deformation,orb[1][kname],0,nDig=(8,3),xmin=0.5,xmax=1.5))
346+
orbSizer.Add(G2G.ValidatedTxtCtrl(deformation,orb[1][kname],0,nDig=(8,3),xmin=0.5,xmax=3.0))
347347
Tcheck = wx.CheckBox(deformation,-1,'Refine?')
348348
Tcheck.SetValue(orb[1][kname][1])
349349
Tcheck.Bind(wx.EVT_CHECKBOX,OnDeformRef)
@@ -618,6 +618,7 @@ def OnAtCol(event):
618618
for i in range(nB): orbSizer.Add((5,5),0)
619619
Dsizer(deformation,orbSizer,Names,dId,orb,Indx)
620620
mainSizer.Add(orbSizer)
621+
G2frame.GetStatusBar().SetStatusText('On plot: RGB = XYZ',1)
621622

622623
G2phsG.SetPhaseWindow(deformation,mainSizer)
623624

GSASII/GSASIIplot.py

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
# Note that documentation for GSASIIplot.py has been moved
66
# to file docs/source/GSASIIplot.rst
77

8-
from __future__ import division, print_function
98
import copy
109
import math
1110
import sys
@@ -6747,6 +6746,34 @@ def RenderRBtriplet(orig,Q,Bmat,symAxis=None):
67476746
GL.glDisable(GL.GL_COLOR_MATERIAL)
67486747
GL.glLightfv(GL.GL_LIGHT0,GL.GL_AMBIENT,[.2,.2,.2,1])
67496748

6749+
def RenderTriplet(orig,Rmat,Bmat):
6750+
'''draw an axes triplet located at the origin of a deformation atom
6751+
and with the x, y & z axes drawn as red, green and blue.
6752+
'''
6753+
GL.glLightfv(GL.GL_LIGHT0,GL.GL_AMBIENT,[.7,.7,.7,1])
6754+
GL.glEnable(GL.GL_COLOR_MATERIAL)
6755+
GL.glLineWidth(3)
6756+
GL.glEnable(GL.GL_BLEND)
6757+
GL.glBlendFunc(GL.GL_SRC_ALPHA,GL.GL_ONE_MINUS_SRC_ALPHA)
6758+
GL.glEnable(GL.GL_LINE_SMOOTH)
6759+
GL.glPushMatrix()
6760+
GL.glTranslate(*orig)
6761+
GL.glBegin(GL.GL_LINES)
6762+
lines = np.inner(np.inner(np.eye(3),Rmat),Bmat)*.75
6763+
colors = [Rd,Gr,Bl]
6764+
# lines along axial directions
6765+
for line,color in zip(lines,colors):
6766+
GL.glColor3ubv(color)
6767+
GL.glVertex3fv(np.zeros(3))
6768+
GL.glVertex3fv(line)
6769+
GL.glEnd()
6770+
GL.glPopMatrix()
6771+
GL.glColor4ubv([0,0,0,0])
6772+
GL.glDisable(GL.GL_LINE_SMOOTH)
6773+
GL.glDisable(GL.GL_BLEND)
6774+
GL.glDisable(GL.GL_COLOR_MATERIAL)
6775+
GL.glLightfv(GL.GL_LIGHT0,GL.GL_AMBIENT,[.2,.2,.2,1])
6776+
67506777
def RenderPlane(plane,color):
67516778
fade = list(color) + [.25,]
67526779
GL.glMaterialfv(GL.GL_FRONT_AND_BACK,GL.GL_AMBIENT_AND_DIFFUSE,fade)
@@ -7351,11 +7378,13 @@ def Draw(caller='',Fade=[],NPkey=False):
73517378
atcolor = atColor*255
73527379
defParms = deformationData[atom[ci]]
73537380
SytSym = G2spc.SytSym(atom[cx:cx+3],SGData)[0]
7354-
SGM = np.array(G2spc.GetOpFromCode(atom[cs-1],SGData)[0])
73557381
SHC = defParms[0][1]
73567382
SHC = {item.replace('D','C'):SHC[item] for item in SHC if item not in ['Ne','kappa']}
7383+
SGM = np.array(G2spc.GetOpFromCode(atom[cs-1],SGData)[0])
73577384
SGC = nl.inv(G2lat.CrysM2CartM(Amat,Bmat,SGM))
73587385
UVMat = np.inner(defCtrls['UVmat'],SGC.T)
7386+
UVMat1 = np.inner(defCtrls['UVmat'].T,SGC.T).T
7387+
RenderTriplet([x,y,z],UVMat1,Bmat)
73597388
Npsi,Ngam = 60,30
73607389
PSI,GAM = np.mgrid[0:Npsi,0:Ngam] #[azm,pol]
73617390
PSI = PSI.flatten()*360./Npsi #azimuth 0-360 incl

GSASII/GSASIIpwdGUI.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7431,6 +7431,9 @@ def MakeReflectionTable(phaseName):
74317431
if 'T' in Inst['Type'][0]:
74327432
colLabels = ['H','K','L','flag','d','Fosq','sig','Fcsq','FoTsq','FcTsq','phase','ExtC','wave','tbar']
74337433
Types += 2*[wg.GRID_VALUE_FLOAT+':10,3',]
7434+
elif 'E' in Inst['Type'][0]:
7435+
colLabels = ['H','K','L','flag','d','Fosq','sig','Fcsq','FoTsq','FcTsq','phase','ExtC','Nexp','Zpos']
7436+
Types += [wg.GRID_VALUE_LONG,wg.GRID_VALUE_FLOAT+':10,3',]
74347437
if Super:
74357438
colLabels.insert(3,'M')
74367439
else:

GSASII/imports/G2sfact.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,66 @@ def Reader(self,filename, ParentFrame=None, **unused):
361361
except:
362362
return False
363363

364+
class SHELX4ED_ReaderClass(G2obj.ImportStructFactor):
365+
'Routines to import F**2, sig(F**2), exp# & Z-pos reflections from a Shelx HKLF 4 microED file'
366+
def __init__(self):
367+
if 'linux' in sys.platform: # wx 3.0.0.0 on gtk does not like Unicode in menus
368+
formatName = 'HKLF 4ed'
369+
longFormatName = 'Shelx HKLF 4ed [hkl, Fo2, sig(Fo2), exp#, Z-pos] Structure factor text file'
370+
else:
371+
formatName = u'Shelx HKLF 4ed F\u00b2'
372+
longFormatName = u'Shelx HKLF 4ed [hkl, Fo\u00b2, sig(Fo\u00b2), exp#, Z-pos] Structure factor text file'
373+
super(self.__class__,self).__init__( # fancy way to self-reference
374+
extensionlist=('.hkl','.HKL'),
375+
strictExtension=False,
376+
formatName=formatName,
377+
longFormatName=longFormatName)
378+
379+
def ContentsValidator(self, filename):
380+
'Make sure file contains the expected columns on numbers'
381+
return True
382+
# return ColumnValidator(self, filepointer)
383+
384+
def Reader(self,filename, ParentFrame=None, **unused):
385+
'Read the file'
386+
try:
387+
fp = open(filename,'r')
388+
for line,S in enumerate(fp):
389+
self.errors = ' Error reading line '+str(line+1)
390+
if S[0] == '#': continue #ignore comments, if any
391+
try: # use a simple split if possible
392+
items = S.split()
393+
if len(items) > 5:
394+
h,k,l,Fo,sigFo,Nexp,Zpos = items[:7]
395+
else:
396+
h,k,l,Fo,sigFo = items[:5]
397+
Nexp = '0'
398+
Zpos = '0.'
399+
h,k,l = [int(h),int(k),int(l)]
400+
except: # but sometimes if no space between k & F
401+
# need to use some fixed formatting
402+
h,k,l = S[:12].split()
403+
h,k,l = [int(h),int(k),int(l)]
404+
Fo,sigFo = S[12:].split()[:2]
405+
if not any([h,k,l]):
406+
break
407+
Fo = float(Fo)
408+
sigFo = float(sigFo)
409+
Nexp = int(Nexp)
410+
Zpos = float(Zpos)
411+
# h,k,l,m,dsp,Fo2,sig,Fc2,Fot2,Fct2,phase,...
412+
self.RefDict['RefList'].append([h,k,l,1,0,Fo,sigFo,0,Fo,0,0,1,Nexp,Zpos])
413+
#self.RefDict['FF'].append({}) # now done in OnImportSfact
414+
fp.close()
415+
self.errors = 'Error after reading reflections (unexpected!)'
416+
self.RefDict['RefList'] = np.array(self.RefDict['RefList'])
417+
self.RefDict['Type'] = 'SEC'
418+
self.RefDict['Super'] = 0
419+
self.UpdateParameters(Type='SEC',Wave=0.02851) # histogram type
420+
return True
421+
except:
422+
return False
423+
364424
class M90_ReaderClass(G2obj.ImportStructFactor):
365425
'Routines to import F**2, sig(F**2) reflections from a JANA M90/M91 file'
366426
def __init__(self):

0 commit comments

Comments
 (0)