Skip to content

Commit bac5b7a

Browse files
committed
fix frame/polygon problem - didn't work before
1 parent 9e27d78 commit bac5b7a

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

GSASII/GSASIIimage.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,10 +1239,9 @@ def polymask(data,Poly,Spots=[]):
12391239
ax0 = figure.add_subplot()
12401240
ax0.axis("off")
12411241
figure.subplots_adjust(bottom=0.,top=1.,left=0.,right=1.,wspace=0.,hspace=0.)
1242-
for poly in Poly:
1243-
px = np.array(poly).T[0]/scalex
1244-
py = np.array(poly).T[1]/scaley
1245-
ax0.fill(px,py,inmask)
1242+
px = np.array(Poly).T[0]/scalex
1243+
py = np.array(Poly).T[1]/scaley
1244+
ax0.fill(px,py,inmask)
12461245
for spot in Spots:
12471246
px = np.array(spot).T[0]/scalex
12481247
py = np.array(spot).T[1]/scaley
@@ -1271,21 +1270,14 @@ def MakeMaskMap(data,masks,iLim,jLim):
12711270
pixelSize = data['pixelSize']
12721271
scalex = pixelSize[0]/1000.
12731272
scaley = pixelSize[1]/1000.
1274-
frame = []
1275-
poly = []
1273+
frame = np.zeros(data['size'],dtype='uint8')
1274+
poly = np.zeros(data['size'],dtype='uint8')
12761275
if iLim[0] == jLim[0] == 0:
12771276
if masks['Frames']:
12781277
frame = np.abs(polymask(data,masks['Frames'])-255) #turn inner to outer mask
12791278
if masks['Polygons'] or masks['Points']:
12801279
poly = polymask(data,masks['Polygons'],masks['Points'])
1281-
if len(frame):
1282-
masks['Pmask'] = frame
1283-
if len(poly):
1284-
masks['Pmask'] = masks['Pmask']+poly
1285-
if len(poly):
1286-
masks['Pmask'] = poly
1287-
else:
1288-
masks['Pmask'] = []
1280+
masks['Pmask'] = frame+poly
12891281
tay,tax = np.mgrid[iLim[0]+0.5:iLim[1]+.5,jLim[0]+.5:jLim[1]+.5] #bin centers not corners
12901282
tax = np.asarray(tax*scalex,dtype=np.float32).flatten()
12911283
tay = np.asarray(tay*scaley,dtype=np.float32).flatten()

GSASII/GSASIIimgGUI.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1854,7 +1854,7 @@ def CleanupMasks(data):
18541854
and before saving them or after reading them in. This should also probably be done
18551855
before they are used for integration.
18561856
'''
1857-
for key in ['Points','Rings','Arcs','Polygons',]:
1857+
for key in ['Points','Rings','Arcs','Polygons','Frames',]:
18581858
data[key] = data.get(key,[])
18591859
l1 = len(data[key])
18601860
data[key] = [i for i in data[key] if len(i)]

0 commit comments

Comments
 (0)