Skip to content

Commit 102d031

Browse files
committed
SetValue --> ChangeValue in a few places
Use int32 for gain map & clean up divide by pixels improve export XYZ from drawing atoms
1 parent 9760687 commit 102d031

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

GSASII/GSASIIimgGUI.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def OnPolaCalib(event):
238238
if 'det2theta' not in data:
239239
data['det2theta'] = 0.0
240240
if 'Gain map' not in data:
241-
data['Gain map'] = ''
241+
data['Gain map'] = ' '
242242
#end patch
243243
tthSizer = wx.BoxSizer(wx.HORIZONTAL)
244244
tthSizer.Add(wx.StaticText(G2frame.dataWindow,label=' Detector 2-theta: '),0,WACV)
@@ -263,7 +263,7 @@ def UpdateImageControls(G2frame,data,masks,useTA=None,useMask=None,IntegrateOnly
263263
if 'Flat Bkg' not in data:
264264
data['Flat Bkg'] = 0.0
265265
if 'Gain map' not in data:
266-
data['Gain map'] = ''
266+
data['Gain map'] = ' '
267267
if 'GonioAngles' not in data:
268268
data['GonioAngles'] = [0.,0.,0.]
269269
if 'DetDepth' not in data:
@@ -424,9 +424,10 @@ def OnMultiGainMap(event):
424424
#end of diagnostic block
425425
finally:
426426
dlg.Destroy()
427-
GMsum /= pixels
427+
GMsum = np.where(pixels>0,GMsum/pixels,0)
428428
# GMsum = np.where(GMsum > 2000,0,GMsum)
429429
# GMsum = np.where(GMsum < 500,0,GMsum)
430+
GMsum = np.array(GMsum,dtype=np.int32)
430431
outname = 'GainMap'
431432
dlg = wx.FileDialog(G2frame, 'Choose gain map filename', pth,outname,
432433
'G2img files (*.G2img)|*.G2img',wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT)
@@ -621,8 +622,8 @@ def ResetThresholds():
621622
Imax = np.max(G2frame.ImageZ)
622623
data['range'] = [(0,Imax),[Imin,Imax]]
623624
masks['Thresholds'] = [(0,Imax),[Imin,Imax]]
624-
G2frame.slideSizer.GetChildren()[1].Window.SetValue(Imax) #tricky
625-
G2frame.slideSizer.GetChildren()[4].Window.SetValue(Imin) #tricky
625+
G2frame.slideSizer.GetChildren()[1].Window.ChangeValue(Imax) #tricky
626+
G2frame.slideSizer.GetChildren()[4].Window.ChangeValue(Imin) #tricky
626627

627628
def OnIntegrate(event,useTA=None,useMask=None):
628629
'''Integrate image in response to a menu event or from the AutoIntegrate
@@ -748,7 +749,7 @@ def OnCopySelected(event):
748749
'tilt','rotation','azmthOff','fullIntegrate','LRazimuth','setdist',
749750
'IOtth','outChannels','outAzimuths','invert_x','invert_y','DetDepth',
750751
'calibskip','pixLimit','cutoff','calibdmin','Flat Bkg','varyList','orientation',
751-
'binType','SampleShape','PolaVal','SampleAbs','dark image','background image']
752+
'binType','SampleShape','PolaVal','SampleAbs','dark image','background image','Gain map']
752753
keyList.sort(key=lambda s: s.lower())
753754
keyText = [i+' = '+str(data[i]) for i in keyList]
754755
# sort both lists together, ordered by keyText

GSASII/GSASIIphsGUI.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10436,6 +10436,7 @@ def RowSelect(event):
1043610436
table.append(atom[:colLabels.index('I/A')+1])
1043710437
rowLabels.append(str(i))
1043810438

10439+
G2frame.atomTable = None
1043910440
G2frame.atomTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types)
1044010441
drawAtoms.SetTable(G2frame.atomTable, True)
1044110442
drawAtoms.SetMargins(0,0)
@@ -10573,9 +10574,8 @@ def DrawAtomColor(event):
1057310574
attr.SetBackgroundColour(color)
1057410575
drawAtoms.SetAttr(r,cs+2,attr)
1057510576
data['Drawing']['Atoms'][r][cs+2] = color
10576-
drawAtoms.ClearSelection()
1057710577
dlg.Destroy()
10578-
G2frame.GetStatusBar().SetStatusText('',1)
10578+
drawAtoms.ClearSelection()
1057910579
G2plt.PlotStructure(G2frame,data)
1058010580

1058110581
def ResetAtomColors(event):
@@ -11444,7 +11444,7 @@ def OnCameraPos():
1144411444
#new code
1144511445
# drawingData['Zclip'] = min(drawingData['Zclip'],0.95*drawingData['cameraPos'])
1144611446
Zclip.SetScaledValue(drawingData['Zclip'])
11447-
Zval.SetValue(drawingData['Zclip'])
11447+
Zval.ChangeValue(drawingData['Zclip'])
1144811448
xmin=1.0 #.01*drawingData['Zclip']*drawingData['cameraPos']/100.
1144911449
xmax=2.*drawingData['cameraPos']
1145011450
Zclip.SetScaledRange(xmin,xmax)

GSASII/exports/G2export_PDB.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,11 @@ def getRadius(atom):
298298
Cell = General['Cell'][1:7]
299299
A,B = G2lat.cell2AB(Cell)
300300
fmt = '{:4s}'+4*'{:10.3f}'
301-
line = ' line: ('+3*'{:10.3f}'+') - ('+3*'{:10.3f}'+')'
302-
stick = ' stick: ('+3*'{:10.3f}'+') - ('+3*'{:10.3f}'+') r = '+'{:10.3}'
303-
face = ' face: ('+3*'{:10.3f}'+') - ('+3*'{:10.3f}'+') - ('+3*'{:10.3f}'+')'
304-
self.Write('Atoms: number: {:6d}'.format(len(Atoms)))
305-
self.Write('Atoms list: element, X , Y, Z, radius')
301+
line = ' line '+6*'{:10.3f}'
302+
stick = ' stick '+7*'{:10.3f}'
303+
face = ' tri '+9*'{:10.3f}'
304+
self.Write('XYZ file of drawn %s - Cartesian axes suitable for 3D printing/glass etching'%phasenam)
305+
self.Write('Atoms as balls: element X Y Z radius')
306306
for atom in Atoms:
307307
radius = getRadius(atom)
308308
xyz = np.inner(A,np.array(atom[cx:cx+3]))
@@ -318,7 +318,7 @@ def getRadius(atom):
318318
for edge in uEdges:
319319
xyz = [np.inner(A,edge[0]),np.inner(A,edge[1])]
320320
self.Write(line.format(xyz[0][0],xyz[0][1],xyz[0][2],xyz[1][0],xyz[1][1],xyz[1][2]))
321-
self.Write('bonds:')
321+
self.Write('bonds as ball surface to midpoint: x0 y0 z0 x1 y1 z1 r')
322322
for atom in Atoms:
323323
xyz = np.inner(A,np.array(atom[cx:cx+3]))
324324
radius = getRadius(atom)
@@ -330,7 +330,7 @@ def getRadius(atom):
330330
bxyz = xyz+vec
331331
if 'sticks' in atom[cs]:
332332
self.Write(stick.format(xyz0[0],xyz0[1],xyz0[2],bxyz[0],bxyz[1],bxyz[2],bondR))
333-
self.Write('polygons:')
333+
self.Write('polygon faces as triangles: x0 y0 z0 x1 y1 z1 x2 y2 z2')
334334
for atom in Atoms:
335335
xyz = np.inner(A,np.array(atom[cx:cx+3]))
336336
Faces = atom[-1]

0 commit comments

Comments
 (0)