Changeset 245 for trunk/GSASIIimage.py
 Timestamp:
 Feb 13, 2011 4:57:10 PM (11 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIIimage.py
r239 r245 120 120 def FitDetector(rings,p0,wave): 121 121 from scipy.optimize import leastsq 122 def ellipseCalc(B,xyd,wave): 122 123 def ellipseCalcD(B,xyd,wave): 123 124 x = xyd[0] 124 125 y = xyd[1] … … 138 139 YR = X*npsind(phi)+Y*npcosd(phi) 139 140 return (XR/R0)**2+(YR/R1)**21 140 result = leastsq(ellipseCalc,p0,args=(rings.T,wave)) 141 return result[0] 141 def ellipseCalcW(C,xyd): 142 dist,x0,y0,phi,tilt,wave = C 143 B = dist,x0,y0,phi,tilt 144 return ellipseCalcD(B,xyd,wave) 145 result = leastsq(ellipseCalcD,p0,args=(rings.T,wave)) 146 if len(rings) > 1: 147 p0 = result[0] 148 p0 = np.append(p0,wave) 149 resultW = leastsq(ellipseCalcW,p0,args=(rings.T,)) 150 return result[0],resultW[0][1] 151 else: 152 return result[0],wave 142 153 143 154 def ImageLocalMax(image,w,Xpix,Ypix): … … 173 184 Y /= scaley 174 185 ring.append([X,Y,dsp]) 175 if len(ring) < 20: #want more than 1/4 of a circle186 if len(ring) < 10: #want more than 20deg 176 187 return [] 177 188 return ring … … 460 471 rings = np.concatenate((data['rings']),axis=0) 461 472 p0 = [dist,cent[0],cent[1],phi,tilt] 462 result = FitDetector(rings,p0,wave) 473 result,newWave = FitDetector(rings,p0,wave) 474 print 'Suggested new wavelength = ',('%.5f')%(newWave),' (not reliable if distance > 2m)' 463 475 data['distance'] = result[0] 464 476 data['center'] = result[1:3] … … 537 549 H0 = np.zeros(shape=(numAzms,numChans),order='F',dtype=np.float32) 538 550 imageN = len(image) 539 nBlks = (imageN1)/1024+1 540 dlg = wx.ProgressDialog("Elapsed time","2D image integration",nBlks*nBlks*3+3, 551 Nx,Ny = data['size'] 552 nXBlks = (Nx1)/1024+1 553 nYBlks = (Ny1)/1024+1 554 print Nx,Ny,nXBlks,nYBlks 555 dlg = wx.ProgressDialog("Elapsed time","2D image integration",nXBlks*nYBlks*3+3, 541 556 style = wx.PD_ELAPSED_TIMEwx.PD_AUTO_HIDE) 542 557 try: … … 544 559 Nup = 0 545 560 dlg.Update(Nup) 546 for iBlk in range(n Blks):561 for iBlk in range(nYBlks): 547 562 iBeg = iBlk*1024 548 iFin = min(iBeg+1024, imageN)549 for jBlk in range(n Blks):563 iFin = min(iBeg+1024,Ny) 564 for jBlk in range(nXBlks): 550 565 jBeg = jBlk*1024 551 jFin = min(jBeg+1024, imageN)566 jFin = min(jBeg+1024,Nx) 552 567 print 'Process map block',iBlk,jBlk,iBeg,iFin,jBeg,jFin 553 568 TA,tam = Make2ThetaAzimuthMap(data,masks,(iBeg,iFin),(jBeg,jFin)) #2theta & azimuth arrays & create position mask
Note: See TracChangeset
for help on using the changeset viewer.