|
41 | 41 | npatand = lambda x: 180.*np.arctan(x)/np.pi |
42 | 42 | npatan2d = lambda y,x: 180.*np.arctan2(y,x)/np.pi |
43 | 43 | nxs = np.newaxis |
44 | | -debug = True |
| 44 | +debug = False |
| 45 | + |
45 | 46 |
|
46 | 47 | def peneCorr(tth,dep,dist): |
47 | 48 | ''' Compute empirical position correction due to detector absorption |
@@ -429,9 +430,8 @@ def makeRing(dsp,ellipse,pix,reject,scalex,scaley,image,mul=1): |
429 | 430 | def ellipseC(): |
430 | 431 | 'compute estimate of ellipse circumference' |
431 | 432 | if radii[0] <= 0: #hyperbola |
432 | | - if debug: |
433 | | - theta = npacosd(1./np.sqrt(1.+(radii[0]/radii[1])**2)) |
434 | | - print ('hyperbola:',theta) |
| 433 | + theta = npacosd(1./np.sqrt(1.+(radii[0]/radii[1])**2)) |
| 434 | + print ('hyperbola at 2-theta:',theta) |
435 | 435 | return 720. |
436 | 436 | apb = radii[1]+radii[0] |
437 | 437 | amb = radii[1]-radii[0] |
@@ -1128,7 +1128,7 @@ def ImageCalibrate(G2frame,data): |
1128 | 1128 | data['DetDepth'] /= data['distance'] |
1129 | 1129 | parmDict = {'dist':data['distance'],'det-X':data['center'][0],'det-Y':data['center'][1], |
1130 | 1130 | 'sag':data['sag'],'tilt':data['tilt'],'phi':data['rotation'],'wave':data['wavelength'], |
1131 | | - 'dep':data['DetDepth'],'xyLim':data['xyLim']} |
| 1131 | + 'dep':data['DetDepth'],'xyLim':xyLim} |
1132 | 1132 | varyList = [item for item in varyDict if varyDict[item]] |
1133 | 1133 | data['rings'] = [] |
1134 | 1134 | data['ellipses'] = [] |
@@ -1702,6 +1702,9 @@ def FitStrSta(Image,StrSta,Controls): |
1702 | 1702 | ring['Emat'] = val |
1703 | 1703 | ring['Esig'] = esd |
1704 | 1704 | ellipse = FitEllipse(R['ImxyObs'].T) |
| 1705 | + if any(np.isnan(ellipse[2])): |
| 1706 | + print('hyperbola for d=%.5f not fit, suggest deleting it'%dset) |
| 1707 | + continue |
1705 | 1708 | ringxy = makeRing(ring['Dcalc'],ellipse,0,0.,scalex,scaley,Image) |
1706 | 1709 | ring['ImxyCalc'] = np.array(ringxy).T[:2] |
1707 | 1710 | ringixy = [[int(x*scalex),int(y*scaley)] for y,x in np.array(ringxy)[:,:2]] |
|
0 commit comments