Changeset 282
- Timestamp:
- May 5, 2011 2:19:40 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/GSASIIimage.py ¶
r271 r282 202 202 cphi = cosd(phi) 203 203 sphi = sind(phi) 204 ring = []205 204 if azm: 206 aR = azm[0]-90,azm[1]-90, 1205 aR = azm[0]-90,azm[1]-90,azm[1]-azm[0] 207 206 if azm[1]-azm[0] > 180: 208 aR[2] = 2209 else: 210 aR = 0,362, 2211 for a in range(aR[0],aR[1],aR[2]):212 x = radii[0]*cosd(a-phi)213 y = radii[1]*sind(a-phi)214 X = (cphi*x-sphi*y+cent[0])215 Y = (sphi*x+cphi*y+cent[1])216 ring.append([X,Y])217 return ring218 207 aR[2] /= 2 208 else: 209 aR = 0,362,181 210 211 a = np.linspace(aR[0],aR[1],aR[2]) 212 x = radii[0]*npcosd(a-phi) 213 y = radii[1]*npsind(a-phi) 214 X = (cphi*x-sphi*y+cent[0]) 215 Y = (sphi*x+cphi*y+cent[1]) 216 return zip(X,Y) 217 219 218 def calcDist(radii,tth): 220 219 stth = sind(tth) … … 511 510 scaley = pixelSize[1]/1000. 512 511 513 tay,tax = np.mgrid[iLim[0]+0.5:iLim[1]+.5,jLim[0]+.5:jLim[1]+.5] #bin centers not corners 512 # tay,tax = np.mgrid[iLim[0]+0.5:iLim[1]+.5,jLim[0]+.5:jLim[1]+.5] #bin centers not corners 513 tay,tax = np.mgrid[iLim[0]:iLim[1],jLim[0]:jLim[1]] #bin corners 514 514 tax = np.asfarray(tax*scalex,dtype=np.float32) 515 515 tay = np.asfarray(tay*scaley,dtype=np.float32) … … 519 519 spots = masks['Points'] 520 520 polygons = masks['Polygons'] 521 tam = ma.make_mask_none(( iLim[1]-iLim[0],jLim[1]-jLim[0]))521 tam = ma.make_mask_none((nI,nJ)) 522 522 for polygon in polygons: 523 523 if polygon: 524 524 tamp = ma.make_mask_none((nI*nJ)) 525 tam = ma.mask_or(tam.flatten(),ma.make_mask(pm.polymask(nI*nJ, 526 tax.flatten(),tay.flatten(),len(polygon),polygon,tamp))) 525 tamp = ma.make_mask(pm.polymask(nI*nJ,tax.flatten(), 526 tay.flatten(),len(polygon),polygon,tamp)) 527 tam = ma.mask_or(tam.flatten(),tamp) 527 528 if tam.shape: tam = np.reshape(tam,(nI,nJ)) 528 529 for X,Y,diam in spots: 529 tam = ma.mask_or(tam,ma.getmask(ma.masked_less((tax-X)**2+(tay-Y)**2,(diam/2.)**2))) 530 return np.array(GetTthAzm(tax,tay,data)),tam #2-theta & azimuth arrays & position mask 530 tamp = ma.getmask(ma.masked_less((tax-X)**2+(tay-Y)**2,(diam/2.)**2)) 531 tam = ma.mask_or(tam,tamp) 532 TA = np.array(GetTthAzm(tax,tay,data)) 533 TA[1] = np.where(TA[1]<0,TA[1]+360,TA[1]) 534 return np.array(TA),tam #2-theta & azimuth arrays & position mask 531 535 532 536 def Fill2ThetaAzimuthMap(masks,TA,tam,image): … … 540 544 tam = ma.mask_or(tam.flatten(),ma.getmask(ma.masked_inside(tay.flatten(),max(0.01,tth-thick/2.),tth+thick/2.))) 541 545 for tth,azm,thick in arcs: 542 tam = ma.mask_or(tam.flatten(),ma.getmask(ma.masked_inside(tay.flatten(),max(0.01,tth-thick/2.),tth+thick/2.))* \ 543 ma.getmask(ma.masked_inside(tax.flatten(),azm[0],azm[1]))) 546 tamt = ma.getmask(ma.masked_inside(tay.flatten(),max(0.01,tth-thick/2.),tth+thick/2.)) 547 tama = ma.getmask(ma.masked_inside(tax.flatten(),azm[0],azm[1])) 548 tam = ma.mask_or(tam.flatten(),tamt*tama) 544 549 taz = ma.masked_outside(image.flatten(),int(Zlim[0]),Zlim[1]) 545 550 tam = ma.mask_or(tam.flatten(),ma.getmask(taz)) … … 554 559 print 'Begin image integration' 555 560 LUtth = data['IOtth'] 556 if data['fullIntegrate']: 557 LRazm = [0,360] 558 else: 559 LRazm = data['LRazimuth'] 561 LRazm = data['LRazimuth'] 560 562 numAzms = data['outAzimuths'] 561 563 numChans = data['outChannels'] … … 583 585 print 'Process map block:',iBlk,jBlk,' limits:',iBeg,iFin,jBeg,jFin 584 586 TA,tam = Make2ThetaAzimuthMap(data,masks,(iBeg,iFin),(jBeg,jFin)) #2-theta & azimuth arrays & create position mask 587 585 588 Nup += 1 586 589 dlg.Update(Nup) -
TabularUnified trunk/GSASIIplot.py ¶
r281 r282 1648 1648 x,y = np.hsplit(ring,2) 1649 1649 tth,azm = G2img.GetTthAzm(x,y,Data) 1650 azm = np.where(azm < 0.,azm+360,azm) 1650 1651 Plot.plot(tth,azm,'b,') 1651 1652 if not newPlot: -
TabularUnified trunk/fsource/polymask.for ¶
r100 r282 16 16 REAL*4 X(0:N-1),Y(0:N-1) 17 17 REAL*8 POLY(0:M-1,0:1) 18 LOGICAL*1 MASK( N)18 LOGICAL*1 MASK(0:N-1) 19 19 20 20 INTEGER*4 I,K
Note: See TracChangeset
for help on using the changeset viewer.