Skip to content

Commit 778d8ca

Browse files
committed
Merge updates in master into develop branch
2 parents 9bbeb6e + cdf2ad7 commit 778d8ca

File tree

11 files changed

+65
-27
lines changed

11 files changed

+65
-27
lines changed

.readthedocs.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,7 @@ conda:
1515
formats:
1616
- epub
1717
- pdf
18+
19+
sphinx:
20+
# Path to Sphinx configuration file.
21+
configuration: docs/source/conf.py

GSASII/GSASIIfiles.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ def readMasks(filename,masks,ignoreThreshold):
10971097
S = File.readline()
10981098
continue
10991099
[key,val] = S.strip().split(':',1)
1100-
if key in ['Points','Rings','Arcs','Polygons','Frames','Thresholds']:
1100+
if key in ['Points','Rings','Arcs','Polygons','Frames','Thresholds','Xlines','Ylines']:
11011101
if ignoreThreshold and key == 'Thresholds':
11021102
S = File.readline()
11031103
continue

GSASII/GSASIIimgGUI.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def GetImageZ(G2frame,data,newRange=False):
7474
Npix,imagefile,imagetag = G2IO.GetCheckImageFile(G2frame,G2frame.Image)
7575
if imagefile is None: return []
7676
formatName = data.get('formatName','')
77-
sumImg = np.array(G2fil.GetImageData(G2frame,imagefile,True,ImageTag=imagetag,FormatName=formatName),dtype='float32')
77+
sumImg = np.array(G2fil.GetImageData(G2frame,imagefile,True,ImageTag=imagetag,FormatName=formatName),dtype=np.float32)
7878
if sumImg is None:
7979
return []
8080
darkImg = False
@@ -87,9 +87,9 @@ def GetImageZ(G2frame,data,newRange=False):
8787
dformatName = Ddata.get('formatName','')
8888
Npix,darkfile,imagetag = G2IO.GetCheckImageFile(G2frame,Did)
8989
# darkImage = G2fil.GetImageData(G2frame,darkfile,True,ImageTag=imagetag,FormatName=dformatName)
90-
darkImage = np.array(G2fil.GetImageData(G2frame,darkfile,True,ImageTag=imagetag,FormatName=dformatName),dtype='float32')
91-
if darkImg is not None:
92-
sumImg += np.array(darkImage*darkScale,dtype='float32')
90+
darkImage = np.array(G2fil.GetImageData(G2frame,darkfile,True,ImageTag=imagetag,FormatName=dformatName),dtype=np.float32)
91+
if darkImg is not None:
92+
sumImg += np.array(darkImage*darkScale,dtype=np.float32)
9393
else:
9494
print('Warning: resetting dark image (not found: {})'.format(
9595
darkImg))
@@ -102,11 +102,11 @@ def GetImageZ(G2frame,data,newRange=False):
102102
Npix,backfile,imagetag = G2IO.GetCheckImageFile(G2frame,Bid)
103103
Bdata = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,Bid,'Image Controls'))
104104
bformatName = Bdata.get('formatName','')
105-
backImage = np.array(G2fil.GetImageData(G2frame,backfile,True,ImageTag=imagetag,FormatName=bformatName),dtype='float32')
105+
backImage = np.array(G2fil.GetImageData(G2frame,backfile,True,ImageTag=imagetag,FormatName=bformatName),dtype=np.float32)
106106
if darkImg and backImage is not None:
107-
backImage += np.array(darkImage*darkScale/backScale,dtype='float32')
107+
backImage += np.array(darkImage*darkScale/backScale,dtype=np.float32)
108108
if backImage is not None:
109-
sumImg += np.array(backImage*backScale,dtype='float32')
109+
sumImg += np.array(backImage*backScale,dtype=np.float32)
110110
if 'Gain map' in data:
111111
gainMap = data['Gain map']
112112
if gainMap:
@@ -122,7 +122,8 @@ def GetImageZ(G2frame,data,newRange=False):
122122
Imin = np.min(sumImg)
123123
if 'range' not in data or newRange:
124124
data['range'] = [(Imin,Imax),[Imin,Imax]]
125-
return np.asarray(np.rint(sumImg),dtype='int32')
125+
#return np.asarray(np.rint(sumImg),dtype=np.int32)
126+
return np.array(np.array(np.rint(sumImg),dtype=int),dtype=np.int32) # double-cast removes warning. Why?
126127

127128
def UpdateImageData(G2frame,data):
128129

@@ -1789,7 +1790,7 @@ def newReplot(*args,**kwargs):
17891790
def onDeleteMask(event):
17901791
Obj = event.GetEventObject()
17911792
typ = Obj.locationcode.split('+')[0]
1792-
num = int(Obj.locationcode.split('+')[1])
1793+
num = int(Obj.locationcode.split('+')[1])-1 #off by one?
17931794
del(data[typ][num])
17941795
wx.CallAfter(UpdateMasks,G2frame,data)
17951796
G2plt.PlotExposedImage(G2frame,event=event)
@@ -2013,7 +2014,6 @@ def OnNewRingMask(event):
20132014

20142015
def OnNewXlineMask(event):
20152016
'Start a new x-line mask'
2016-
print('x')
20172017
G2frame.MaskKey = 'x'
20182018
G2plt.OnStartMask(G2frame)
20192019

@@ -2194,7 +2194,7 @@ def OnDelPixMask(event):
21942194
def OnAzimuthPlot(event):
21952195
GkTheta = chr(0x03f4)
21962196
Obj = event.GetEventObject()
2197-
ringId = int(Obj.locationcode.split('+')[1])
2197+
ringId = int(Obj.locationcode.split('+')[1])-1
21982198
Controls = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,G2frame.Image,'Image Controls'))
21992199
image = GetImageZ(G2frame,Controls)
22002200
RingInt = G2img.AzimuthIntegrate(image,Controls,data,ringId)

GSASII/GSASIIindex.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,8 @@ def IndexPeaks(peaks,HKL):
344344
if peak[2]:
345345
if peak[-1] > 0.:
346346
peak[3] = True
347+
if len(peaks) < 7:
348+
return False,peaks #nothing indexed!
347349
if np.any(peaks[4])*np.any(peaks[5])*np.any(peaks[6]):
348350
return True,peaks
349351
else:

GSASII/GSASIImath.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4655,7 +4655,7 @@ def peakHess(parms,rX,rY,rZ,rho,res,SGLaue):
46554655
res = mapData['GridStep']*2.
46564656
incre = np.array(rho.shape,dtype=float)
46574657
step = max(1.0,1./res)+1
4658-
steps = np.array((3*[step,]),dtype='int32')
4658+
steps = np.array((3*[step,]),dtype=np.int32)
46594659
except KeyError:
46604660
G2fil.G2Print ('**** ERROR - Fourier map not defined')
46614661
return peaks,mags

GSASII/GSASIIpwdGUI.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9586,7 +9586,7 @@ def OnNoRing(event):
95869586
sqBox.Add((1,1),1,wx.EXPAND,1)
95879587
sqBox.Add(wx.StaticText(G2frame.dataWindow,label='Rmin: '),0,WACV)
95889588
rmin = G2G.ValidatedTxtCtrl(G2frame.dataWindow,data,'Rmin',nDig=(5,1),
9589-
typeHint=float,size=wx.Size(50,20))
9589+
xmin=0.01,typeHint=float,size=wx.Size(50,20))
95909590
sqBox.Add(rmin,0,WACV)
95919591
sfgSizer.Add(sqBox,0,wx.EXPAND)
95929592

GSASII/GSASIIscriptable.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ def _getCorrImage(ImageReaderlist,proj,imageRef):
684684
sumImg = G2fil.RereadImageData(ImageReaderlist,imagefile,ImageTag=ImageTag,FormatName=formatName)
685685
if sumImg is None:
686686
return []
687-
sumImg = np.array(sumImg,dtype='int32')
687+
sumImg = np.array(sumImg,dtype=np.int32)
688688
darkImg = False
689689
if 'dark image' in Controls:
690690
darkImg,darkScale = Controls['dark image']
@@ -697,7 +697,7 @@ def _getCorrImage(ImageReaderlist,proj,imageRef):
697697
darkImage = G2fil.RereadImageData(ImageReaderlist,imagefile,ImageTag=ImageTag,FormatName=formatName)
698698
if darkImg is None:
699699
raise Exception('Error reading dark image {}'.format(imagefile))
700-
sumImg += np.array(darkImage*darkScale,dtype='int32')
700+
sumImg += np.array(darkImage*darkScale,dtype=np.int32)
701701
if 'background image' in Controls:
702702
backImg,backScale = Controls['background image']
703703
if backImg: #ignores any transmission effect in the background image
@@ -709,9 +709,9 @@ def _getCorrImage(ImageReaderlist,proj,imageRef):
709709
if backImage is None:
710710
raise Exception('Error reading background image {}'.format(imagefile))
711711
if darkImg:
712-
backImage += np.array(darkImage*darkScale/backScale,dtype='int32')
712+
backImage += np.array(darkImage*darkScale/backScale,dtype=np.int32)
713713
else:
714-
sumImg += np.array(backImage*backScale,dtype='int32')
714+
sumImg += np.array(backImage*backScale,dtype=np.int32)
715715
if 'Gain map' in Controls:
716716
gainMap = Controls['Gain map']
717717
if gainMap:
@@ -726,7 +726,7 @@ def _getCorrImage(ImageReaderlist,proj,imageRef):
726726
sumImg -= int(Controls.get('Flat Bkg',0))
727727
Imax = np.max(sumImg)
728728
Controls['range'] = [(0,Imax),[0,Imax]]
729-
return np.asarray(sumImg,dtype='int32')
729+
return np.asarray(sumImg,dtype=np.int32)
730730

731731
def _constr_type(var):
732732
'''returns the constraint type based on phase/histogram use

GSASII/GSASIItestplot.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
'''
55
import wx
66
import wx.aui
7-
import matplotlib as mpl
87
import matplotlib.figure as mplfig
98
try:
109
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas

GSASII/fprime.py

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,20 @@ def OnChoice2(event):
208208
else:
209209
self.FFxaxis = 'T'
210210
self.UpDateFPlot(self.Wave,rePlot=False)
211-
211+
212+
def OnChoice3(event):
213+
self.Norm = not self.Norm
214+
self.UpDateFPlot(self.Wave,rePlot=False)
215+
212216
self.choice2 = wx.ComboBox(id=wxID_FPRIMECHOICE2, value=' sin('+Gktheta+')/'+Gklambda,
213217
choices=[' sin('+Gktheta+')/'+Gklambda,' 2'+Gktheta,' Q'],
214218
parent=panel, style=wx.CB_READONLY|wx.CB_DROPDOWN)
215219
choiceSizer.Add(self.choice2,0)
216220
self.choice2.Bind(wx.EVT_COMBOBOX, OnChoice2, id=wxID_FPRIMECHOICE2)
221+
self.choice3 = wx.CheckBox(panel,label='Normalize ff by Z')
222+
self.choice3.Bind(wx.EVT_CHECKBOX,OnChoice3)
223+
choiceSizer.Add((10,10),0)
224+
choiceSizer.Add(self.choice3,0)
217225
mainSizer.Add(choiceSizer,0)
218226
mainSizer.Add((10,10),0)
219227
panel.SetSizer(mainSizer)
@@ -224,7 +232,8 @@ def __init__(self, parent):
224232
self.Lines = []
225233
self.Elems = []
226234
self.linePicked = None
227-
235+
self.Norm = False
236+
228237
def OnFPRIMEExitMenu(self, event):
229238
self.parent.G2plotNB.Delete('Fprime')
230239
self.Close()
@@ -379,7 +388,10 @@ def UpDateFPlot(self,Wave,rePlot=True):
379388
self.ax.legend(loc='best')
380389
self.Page.figure.subplots_adjust(hspace=0.25)
381390
if self.ifWave:
382-
self.bx.set_title('%s%s%6.4f%s'%('Form factors (',r'$\lambda=$',self.Wave,r'$\AA)$'),x=0,ha='left')
391+
if self.Norm:
392+
self.bx.set_title('%s%s%6.4f%s'%('Normalized form factors (',r'$\lambda=$',self.Wave,r'$\AA)$'),x=0,ha='left')
393+
else:
394+
self.bx.set_title('%s%s%6.4f%s'%('Form factors (',r'$\lambda=$',self.Wave,r'$\AA)$'),x=0,ha='left')
383395
else:
384396
self.bx.set_title('%s%6.2f%s'%('Form factors (E =',self.Energy,'keV)'),x=0,ha='left')
385397
if self.FFxaxis == 'S':
@@ -391,7 +403,10 @@ def UpDateFPlot(self,Wave,rePlot=True):
391403
else:
392404
self.bxlabel = 'Q, '+Angstr+Pwrm1
393405
self.bx.set_xlabel(r'$Q, \AA$',fontsize=14)
394-
self.bx.set_ylabel("f+f ', e-",fontsize=14)
406+
if self.Norm:
407+
self.bx.set_ylabel("(f+f ')/Z",fontsize=14)
408+
else:
409+
self.bx.set_ylabel("f+f ', e-",fontsize=14)
395410
E = self.Energy
396411
DE = E*self.Eres #smear by defined source resolution
397412
StlMax = min(2.0,math.sin(80.0*math.pi/180.)/Wave)
@@ -400,7 +415,10 @@ def UpDateFPlot(self,Wave,rePlot=True):
400415
for i,Elem in enumerate(self.Elems):
401416
Els = Elem[0]
402417
Els = Els = Els.ljust(2).lower().capitalize()
403-
Ymax = max(Ymax,Elem[1])
418+
if self.Norm:
419+
Ymax = 0.2
420+
else:
421+
Ymax = max(Ymax,Elem[1])
404422
res1 = G2elem.FPcalc(Elem[3],E+DE)
405423
res2 = G2elem.FPcalc(Elem[3],E-DE)
406424
res = (res1[0]+res2[0])/2.0
@@ -420,6 +438,9 @@ def UpDateFPlot(self,Wave,rePlot=True):
420438
X.append(360.0*math.asin(S*self.Wave)/math.pi)
421439
else:
422440
X.append(4.0*S*math.pi)
441+
if self.Norm:
442+
ff = [f/Elem[1] for f in ff]
443+
ffo = [f/Elem[1] for f in ffo]
423444
Color = colors[i%6]
424445
Xp = np.array(X)
425446
ffop = np.array(ffo)

GSASII/imports/G2img_HDF5.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def Reader(self, filename, ParentFrame=None, **kwarg):
7272
fp.close()
7373
return False
7474
nsel = GSASIIpath.GetConfigValue('HDF5selection',getDefault=True)
75-
self.buffer['selectedImages'] = []
75+
self.buffer['selectedImages'] = list(range(len(self.buffer['imagemap'])))
7676
if ParentFrame and len(self.buffer['imagemap']) > nsel and nsel >= 0:
7777
import wx
7878
from .. import GSASIIctrlGUI as G2G

0 commit comments

Comments
 (0)