Skip to content

Commit 56ee7e5

Browse files
committed
fix to 3dhkl plot for PWDR data.
lighting fixes for 3DHKL plots
1 parent 1f3f499 commit 56ee7e5

2 files changed

Lines changed: 19 additions & 10 deletions

File tree

GSASII/GSASIIplot.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,12 +1585,12 @@ def FillHKLRC():
15851585
elif Data['Type'] == 'dFsq/sig':
15861586
dFsig = (Fosq-Fcsq)/sig
15871587
if dFsig > 0:
1588-
R.append(dFsig)
1588+
R.append(Fosq)
15891589
dFsig = min(10.,dFsig)
15901590
dw = int(255.*(1.0-(dFsig/10.)))
15911591
color = np.array([dw,255,0])
15921592
else:
1593-
R.append(-dFsig)
1593+
R.append(Fosq)
15941594
dFsig = max(-10.,dFsig)
15951595
dw = int(255.*(1.0+(dFsig/10.)))
15961596
color = np.array([255,dw,0])
@@ -1606,7 +1606,8 @@ def FillHKLRC():
16061606
if len(R):
16071607
R = np.array(R)
16081608
if Data['Type'] == 'dFsq/sig':
1609-
R /= 10.
1609+
# R /= 20.
1610+
R /= np.max(np.array(R))
16101611
else:
16111612
R /= np.max(np.array(R))
16121613
R *= Data['Scale']
@@ -1615,7 +1616,7 @@ def FillHKLRC():
16151616
R = np.where(R<=1.,R,1.)
16161617
C = np.array(C)
16171618
C = (C.T*R).T
1618-
R = np.ones_like(R)*0.05
1619+
R = np.ones_like(R)*0.1
16191620
RF = 100.
16201621
RF2 = 100.
16211622
if sumFo and sumDF:
@@ -1751,12 +1752,14 @@ def SetLights():
17511752
except:
17521753
if GSASIIpath.GetConfigValue('debug'): print('depth test failed')
17531754
return
1754-
# GL.glShadeModel(GL.GL_SMOOTH)
1755+
GL.glShadeModel(GL.GL_FLAT)
17551756
GL.glEnable(GL.GL_LIGHTING)
17561757
GL.glEnable(GL.GL_LIGHT0)
17571758
GL.glLightModeli(GL.GL_LIGHT_MODEL_TWO_SIDE,0)
17581759
GL.glLightfv(GL.GL_LIGHT0,GL.GL_AMBIENT,[1,1,1,1])
17591760
GL.glLightfv(GL.GL_LIGHT0,GL.GL_DIFFUSE,[1,1,1,1])
1761+
GL.glLightfv(GL.GL_LIGHT0,GL.GL_SPECULAR,[1,1,1,1])
1762+
GL.glLightfv(GL.GL_LIGHT0,GL.GL_POSITION,[0,0,1,1])
17601763

17611764
def RenderBox(x,y,z):
17621765
GL.glEnable(GL.GL_COLOR_MATERIAL)

GSASII/GSASIIpwdGUI.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7303,11 +7303,17 @@ def OnPlot3DHKL(event):
73037303
Hmin = np.array([int(np.min(refList.T[0])),int(np.min(refList.T[1])),int(np.min(refList.T[2]))])
73047304
Hmax = np.array([int(np.max(refList.T[0])),int(np.max(refList.T[1])),int(np.max(refList.T[2]))])
73057305
Vpoint = np.array([int(np.mean(refList.T[0])),int(np.mean(refList.T[1])),int(np.mean(refList.T[2]))])
7306-
controls = {'Type':'Fosq','Iscale':False,'HKLmax':Hmax,'HKLmin':Hmin,'Zone':False,'viewKey':'L',
7307-
'microED':{'Nexp':[False,0],'Ztilt':[False,0]},'dType':data[1]['Type'],
7308-
'FoMax' : FoMax,'Scale' : 1.0,'Drawing':{'viewPoint':[Vpoint,[]],'default':Vpoint[:],
7309-
'backColor':[0,0,0],'depthFog':False,'Zclip':10.0,'cameraPos':10.,'Zstep':0.05,'viewUp':[0,1,0],
7310-
'Scale':1.0,'oldxy':[],'viewDir':[0,0,1]},'Super':Super,'SuperVec':SuperVec}
7306+
if len(data) > 1: #single crystal data
7307+
controls = {'Type':'Fosq','Iscale':False,'HKLmax':Hmax,'HKLmin':Hmin,'Zone':False,'viewKey':'L',
7308+
'microED':{'Nexp':[False,0],'Ztilt':[False,0]},'dType':data[1]['Type'],
7309+
'FoMax' : FoMax,'Scale' : 1.0,'Drawing':{'viewPoint':[Vpoint,[]],'default':Vpoint[:],
7310+
'backColor':[0,0,0],'depthFog':False,'Zclip':10.0,'cameraPos':10.,'Zstep':0.05,'viewUp':[0,1,0],
7311+
'Scale':1.0,'oldxy':[],'viewDir':[0,0,1]},'Super':Super,'SuperVec':SuperVec}
7312+
else: #powder data
7313+
controls = {'Type':'Fosq','Iscale':False,'HKLmax':Hmax,'HKLmin':Hmin,'Zone':False,'viewKey':'L',
7314+
'FoMax' : FoMax,'Scale' : 1.0,'Drawing':{'viewPoint':[Vpoint,[]],'default':Vpoint[:],
7315+
'backColor':[0,0,0],'depthFog':False,'Zclip':10.0,'cameraPos':10.,'Zstep':0.05,'viewUp':[0,1,0],
7316+
'Scale':1.0,'oldxy':[],'viewDir':[0,0,1]},'Super':Super,'SuperVec':SuperVec}
73117317
G2plt.Plot3DSngl(G2frame,newPlot=True,Data=controls,hklRef=refList,Title=phaseName)
73127318

73137319
def OnWilsonStat(event):

0 commit comments

Comments
 (0)