Skip to content

Commit 08dd208

Browse files
committed
remove broken stride check from fmask; replace deprecated numpy routines
1 parent 856fd90 commit 08dd208

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

GSASII/GSASIIimage.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -786,8 +786,8 @@ def EdgeFinder(image,data):
786786
scalex = pixelSize[0]/1000.
787787
scaley = pixelSize[1]/1000.
788788
tay,tax = np.mgrid[0:Nx,0:Ny]
789-
tax = np.asfarray(tax*scalex,dtype=np.float32)
790-
tay = np.asfarray(tay*scaley,dtype=np.float32)
789+
tax = np.asarray(tax*scalex,dtype=np.float32)
790+
tay = np.asarray(tay*scaley,dtype=np.float32)
791791
tam = ma.getmask(ma.masked_less(image.flatten(),edgemin))
792792
tax = ma.compressed(ma.array(tax.flatten(),mask=tam))
793793
tay = ma.compressed(ma.array(tay.flatten(),mask=tam))
@@ -1238,8 +1238,8 @@ def Make2ThetaAzimuthMap(data,iLim,jLim): #most expensive part of integration!
12381238
scalex = pixelSize[0]/1000.
12391239
scaley = pixelSize[1]/1000.
12401240
tay,tax = np.mgrid[iLim[0]+0.5:iLim[1]+.5,jLim[0]+.5:jLim[1]+.5] #bin centers not corners
1241-
tax = np.asfarray(tax*scalex,dtype=np.float32).flatten()
1242-
tay = np.asfarray(tay*scaley,dtype=np.float32).flatten()
1241+
tax = np.asarray(tax*scalex,dtype=np.float32).flatten()
1242+
tay = np.asarray(tay*scaley,dtype=np.float32).flatten()
12431243
nI = iLim[1]-iLim[0]
12441244
nJ = jLim[1]-jLim[0]
12451245
TA = np.empty((4,nI,nJ))
@@ -1325,8 +1325,8 @@ def MakeMaskMap(data,masks,iLim,jLim):
13251325
else:
13261326
masks['Pmask'] = []
13271327
tay,tax = np.mgrid[iLim[0]+0.5:iLim[1]+.5,jLim[0]+.5:jLim[1]+.5] #bin centers not corners
1328-
tax = np.asfarray(tax*scalex,dtype=np.float32).flatten()
1329-
tay = np.asfarray(tay*scaley,dtype=np.float32).flatten()
1328+
tax = np.asarray(tax*scalex,dtype=np.float32).flatten()
1329+
tay = np.asarray(tay*scaley,dtype=np.float32).flatten()
13301330
nI = iLim[1]-iLim[0]
13311331
nJ = jLim[1]-jLim[0]
13321332
#make position masks here

sources/fmask.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,23 +132,18 @@ static PyObject *fmask_func(PyObject *self, PyObject *args) {
132132

133133
/* Sanity checks on function arguments */
134134
if (PyArray_DESCR(frame)->type_num != NPY_BOOL ||
135-
PyArray_STRIDE(frame, 0) != PyArray_ITEMSIZE(frame) ||
136135
PyArray_NDIM(frame) != 1)
137136
return makeTypeException("Arg 1 (frame): expected 1-dimensional array of type bool w/stride 1.");
138137
if (PyArray_DESCR(TA)->type_num != NPY_DOUBLE ||
139-
PyArray_STRIDE(TA, 0) != PyArray_ITEMSIZE(TA) ||
140138
PyArray_NDIM(TA) != 1)
141139
return makeTypeException("Arg 2 (TA): expected 1-dimensional array of type np.float64 w/stride 1.");
142140
if (PyArray_DESCR(image)->type_num != NPY_INT32 ||
143-
PyArray_STRIDE(image, 0) != PyArray_ITEMSIZE(image) ||
144141
PyArray_NDIM(image) != 1)
145142
return makeTypeException("Arg 3 (image): expected 1-dimensional array of type np.float64 w/stride 1.");
146143
if (PyArray_DESCR(TThs)->type_num != NPY_DOUBLE ||
147-
PyArray_STRIDE(TThs, 0) != PyArray_ITEMSIZE(TThs) ||
148144
PyArray_NDIM(TThs) != 1)
149145
return makeTypeException("Arg 4 (TThs): expected 1-dimensional array of type np.float64 w/stride 1.");
150146
if (PyArray_DESCR(outMask)->type_num != NPY_BOOL ||
151-
PyArray_STRIDE(outMask, 0) != PyArray_ITEMSIZE(outMask) ||
152147
PyArray_NDIM(outMask) != 1)
153148
return makeTypeException("Arg 3 (outMask): expected 1-dimensional array of type bool w/stride 1.");
154149
// special tests for the output array

0 commit comments

Comments
 (0)