Changeset 81
- Timestamp:
- Jun 3, 2010 1:52:07 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/GSASII.py ¶
r78 r81 14 14 import GSASIIpath 15 15 import GSASIIIO as G2IO 16 import GSASIIcomp as G2cmp17 16 import GSASIIgrid as G2gd 18 17 import GSASIIplot as G2plt -
TabularUnified trunk/GSASIIcomp.py ¶
r80 r81 283 283 return True,smin,Rwp,runtime,GoOn 284 284 285 #GSASII image calculations: ellipse fitting & image integration286 287 def makeMat(Angle,Axis):288 #Make rotation matrix from Angle in degrees,Axis =0 for rotation about x, =1 for about y, etc.289 cs = cosd(Angle)290 ss = sind(Angle)291 M = np.array(([1.,0.,0.],[0.,cs,-ss],[0.,ss,cs]),dtype=np.float32)292 return np.roll(np.roll(M,Axis,axis=0),Axis,axis=1)293 294 def FitRing(ring):295 Err,parms = FitCircle(ring)296 Err /= len(ring)297 # print 'circle error:','%8f'%(Err)298 if Err > 20000.:299 eparms = FitEllipse(ring)300 if eparms:301 parms = eparms302 return parms303 304 def FitCircle(ring):305 import numpy.linalg as nl306 307 def makeParmsCircle(B):308 cent = [-B[0]/2,-B[1]/2]309 phi = 0.310 sr1 = sr2 = math.sqrt(cent[0]**2+cent[1]**2-B[2])311 return cent,phi,[sr1,sr2]312 313 ring = np.array(ring)314 x = np.asarray(ring.T[0])315 y = np.asarray(ring.T[1])316 317 M = np.array((x,y,np.ones_like(x)))318 B = np.array(-(x**2+y**2))319 result = nl.lstsq(M.T,B)320 return result[1],makeParmsCircle(result[0])321 322 def FitEllipse(ring):323 import numpy.linalg as nl324 325 def makeParmsEllipse(B):326 det = 4.*(1.-B[0]**2)-B[1]**2327 if det < 0.:328 print 'hyperbola!'329 return 0330 elif det == 0.:331 print 'parabola!'332 return 0333 cent = [(B[1]*B[3]-2.*(1.-B[0])*B[2])/det, \334 (B[1]*B[2]-2.*(1.+B[0])*B[3])/det]335 phi = 0.5*atand(0.5*B[1]/B[0])336 337 a = (1.+B[0])/cosd(2*phi)338 b = 2.-a339 f = (1.+B[0])*cent[0]**2+(1.-B[0])*cent[1]**2+B[1]*cent[0]*cent[1]-B[4]340 if f/a < 0 or f/b < 0:341 return 0342 sr1 = math.sqrt(f/a)343 sr2 = math.sqrt(f/b)344 if sr1 > sr2:345 sr1,sr2 = sr2,sr1346 phi -= 90.347 if phi < -90.:348 phi += 180.349 return cent,phi,[sr1,sr2]350 351 ring = np.array(ring)352 x = np.asarray(ring.T[0])353 y = np.asarray(ring.T[1])354 M = np.array((x**2-y**2,x*y,x,y,np.ones_like(x)))355 B = np.array(-(x**2+y**2))356 result = nl.lstsq(M.T,B)357 return makeParmsEllipse(result[0])358 359 def FitDetector(rings,p0,wave):360 from scipy.optimize import leastsq361 def ellipseCalc(B,xyd,wave):362 x = xyd[0]363 y = xyd[1]364 dsp = xyd[2]365 dist,x0,y0,phi,tilt = B366 tth = 2.0*npasind(wave/(2.*dsp))367 ttth = nptand(tth)368 radius = dist*ttth369 stth = npsind(tth)370 cosb = npcosd(tilt)371 R1 = dist*stth*npcosd(tth)*cosb/(cosb**2-stth**2)372 R0 = np.sqrt(R1*radius*cosb)373 zdis = R1*ttth*nptand(tilt)374 X = x-x0+zdis*npsind(phi)375 Y = y-y0-zdis*npcosd(phi)376 XR = X*npcosd(phi)-Y*npsind(phi)377 YR = X*npsind(phi)+Y*npcosd(phi)378 return (XR/R0)**2+(YR/R1)**2-1379 result = leastsq(ellipseCalc,p0,args=(rings.T,wave))380 return result[0]381 382 def ImageLocalMax(image,w,Xpix,Ypix):383 w2 = w*2384 size = len(image)385 xpix = int(Xpix) #get reference corner of pixel chosen386 ypix = int(Ypix)387 if (w < xpix < size-w) and (w < ypix < size-w) and image[ypix,xpix]:388 Z = image[ypix-w:ypix+w,xpix-w:xpix+w]389 Zmax = np.argmax(Z)390 Zmin = np.argmin(Z)391 xpix += Zmax%w2-w392 ypix += Zmax/w2-w393 return xpix,ypix,np.ravel(Z)[Zmax],np.ravel(Z)[Zmin]394 else:395 return 0,0,0,0396 397 def makeRing(dsp,ellipse,pix,reject,scalex,scaley,image):398 cent,phi,radii = ellipse399 cphi = cosd(phi)400 sphi = sind(phi)401 ring = []402 for a in range(-180,180,2):403 x = radii[0]*cosd(a)404 y = radii[1]*sind(a)405 X = (cphi*x-sphi*y+cent[0])*scalex #convert mm to pixels406 Y = (sphi*x+cphi*y+cent[1])*scaley407 X,Y,I,J = ImageLocalMax(image,pix,X,Y)408 if I and J and I/J > reject:409 X += .5 #set to center of pixel410 Y += .5411 X /= scalex #convert to mm412 Y /= scaley413 ring.append([X,Y,dsp])414 if len(ring) < 45: #want more than 1/4 of a circle415 return []416 return ring417 418 def makeIdealRing(ellipse):419 cent,phi,radii = ellipse420 cphi = cosd(phi)421 sphi = sind(phi)422 ring = []423 for a in range(0,360,2):424 x = radii[0]*cosd(a)425 y = radii[1]*sind(a)426 X = (cphi*x-sphi*y+cent[0])427 Y = (sphi*x+cphi*y+cent[1])428 ring.append([X,Y])429 return ring430 431 def calcDist(radii,tth):432 stth = sind(tth)433 ctth = cosd(tth)434 ttth = tand(tth)435 return math.sqrt(radii[0]**4/(ttth**2*((radii[0]*ctth)**2+(radii[1]*stth)**2)))436 437 def calcZdisCosB(radius,tth,radii):438 cosB = sinb = radii[0]**2/(radius*radii[1])439 if cosB > 1.:440 return 0.,1.441 else:442 cosb = math.sqrt(1.-sinb**2)443 ttth = tand(tth)444 zdis = radii[1]*ttth*cosb/sinb445 return zdis,cosB446 447 def GetEllipse(dsp,data):448 dist = data['distance']449 cent = data['center']450 tilt = data['tilt']451 phi = data['rotation']452 radii = [0,0]453 tth = 2.0*asind(data['wavelength']/(2.*dsp))454 ttth = tand(tth)455 stth = sind(tth)456 ctth = cosd(tth)457 cosb = cosd(tilt)458 radius = dist*ttth459 radii[1] = dist*stth*ctth*cosb/(cosb**2-stth**2)460 if radii[1] > 0:461 radii[0] = math.sqrt(radii[1]*radius*cosb)462 zdis = radii[1]*ttth*tand(tilt)463 elcent = [cent[0]-zdis*sind(phi),cent[1]+zdis*cosd(phi)]464 return elcent,phi,radii465 else:466 return False467 468 def GetDetectorXY(dsp,azm,data):469 from scipy.optimize import fsolve470 def func(xy,*args):471 azm,phi,R0,R1,A,B = args472 cp = cosd(phi)473 sp = sind(phi)474 x,y = xy475 out = []476 out.append(y-x*tand(azm))477 out.append(R0**2*((x+A)*sp-(y+B)*cp)**2+R1**2*((x+A)*cp+(y+B)*sp)**2-(R0*R1)**2)478 return out479 elcent,phi,radii = GetEllipse(dsp,data)480 cent = data['center']481 tilt = data['tilt']482 phi = data['rotation']483 wave = data['wavelength']484 dist = data['distance']485 tth = 2.0*asind(wave/(2.*dsp))486 ttth = tand(tth)487 radius = dist*ttth488 stth = sind(tth)489 cosb = cosd(tilt)490 R1 = dist*stth*cosd(tth)*cosb/(cosb**2-stth**2)491 R0 = math.sqrt(R1*radius*cosb)492 zdis = R1*ttth*tand(tilt)493 A = zdis*sind(phi)494 B = -zdis*cosd(phi)495 xy0 = [radius*cosd(azm),radius*sind(azm)]496 xy = fsolve(func,xy0,args=(azm,phi,R0,R1,A,B))+cent497 return xy498 499 def GetTthAzmDsp(x,y,data):500 wave = data['wavelength']501 dist = data['distance']502 cent = data['center']503 tilt = data['tilt']504 phi = data['rotation']505 dx = np.array(x-cent[0],dtype=np.float32)506 dy = np.array(y-cent[1],dtype=np.float32)507 X = np.array(([dx,dy,np.zeros_like(dx)]),dtype=np.float32).T508 X = np.dot(X,makeMat(phi,2))509 Z = np.dot(X,makeMat(tilt,0)).T[2]510 tth = npatand(np.sqrt(dx**2+dy**2-Z**2)/(dist-Z))511 dsp = wave/(2.*npsind(tth/2.))512 azm = npatan2d(dy,dx)513 return tth,azm,dsp514 515 def GetTth(x,y,data):516 return GetTthAzmDsp(x,y,data)[0]517 518 def GetTthAzm(x,y,data):519 return GetTthAzmDsp(x,y,data)[0:2]520 521 def GetDsp(x,y,data):522 return GetTthAzmDsp(x,y,data)[2]523 524 def ImageCompress(image,scale):525 if scale == 1:526 return image527 else:528 return image[::scale,::scale]529 530 def ImageCalibrate(self,data):531 import copy532 import ImageCalibrants as calFile533 print 'image calibrate'534 ring = data['ring']535 pixelSize = data['pixelSize']536 scalex = 1000./pixelSize[0]537 scaley = 1000./pixelSize[1]538 cutoff = data['cutoff']539 if len(ring) < 5:540 print 'not enough inner ring points for ellipse'541 return False542 543 #fit start points on inner ring544 data['ellipses'] = []545 outE = FitRing(ring)546 if outE:547 print 'start ellipse:',outE548 ellipse = outE549 else:550 return False551 552 #setup 180 points on that ring for "good" fit553 Ring = makeRing(1.0,ellipse,20,cutoff,scalex,scaley,self.ImageZ)554 if Ring:555 ellipse = FitRing(Ring)556 Ring = makeRing(1.0,ellipse,20,cutoff,scalex,scaley,self.ImageZ) #do again557 ellipse = FitRing(Ring)558 else:559 print '1st ring not sufficiently complete to proceed'560 return False561 print 'inner ring:',ellipse562 data['center'] = copy.copy(ellipse[0]) #not right!! (but useful for now)563 data['ellipses'].append(ellipse[:]+('r',))564 G2plt.PlotImage(self)565 566 #setup for calibration567 data['rings'] = []568 data['ellipses'] = []569 if not data['calibrant']:570 print 'no calibration material selected'571 return True572 573 Bravais,cell = calFile.Calibrants[data['calibrant']]574 A = G2lat.cell2A(cell)575 wave = data['wavelength']576 cent = data['center']577 pixLimit = data['pixLimit']578 elcent,phi,radii = ellipse579 HKL = G2lat.GenHBravais(0.5,Bravais,A)580 dsp = HKL[0][3]581 tth = 2.0*asind(wave/(2.*dsp))582 ttth = tand(tth)583 data['distance'] = dist = calcDist(radii,tth)584 radius = dist*tand(tth)585 zdis,cosB = calcZdisCosB(radius,tth,radii)586 cent1 = []587 cent2 = []588 xSum = 0589 ySum = 0590 zxSum = 0591 zySum = 0592 phiSum = 0593 tiltSum = 0594 distSum = 0595 Zsum = 0596 for i,H in enumerate(HKL):597 dsp = H[3]598 tth = 2.0*asind(0.5*wave/dsp)599 stth = sind(tth)600 ctth = cosd(tth)601 ttth = tand(tth)602 radius = dist*ttth603 elcent,phi,radii = ellipse604 radii[1] = dist*stth*ctth*cosB/(cosB**2-stth**2)605 radii[0] = math.sqrt(radii[1]*radius*cosB)606 zdis,cosB = calcZdisCosB(radius,tth,radii)607 zsinp = zdis*sind(phi)608 zcosp = zdis*cosd(phi)609 cent = data['center']610 elcent = [cent[0]+zsinp,cent[1]-zcosp]611 ratio = radii[1]/radii[0]612 Ring = makeRing(dsp,ellipse,pixLimit,cutoff,scalex,scaley,self.ImageZ)613 if Ring:614 numZ = len(Ring)615 data['rings'].append(np.array(Ring))616 ellipse = FitRing(Ring)617 elcent,phi,radii = ellipse618 if abs(phi) > 45. and phi < 0.:619 phi += 180.620 dist = calcDist(radii,tth)621 distR = 1.-dist/data['distance']622 if distR > 0.001:623 print 'Wavelength too large?'624 elif distR < -0.001:625 print 'Wavelength too small?'626 else:627 if abs((radii[1]/radii[0]-ratio)/ratio) > 0.01:628 print 'Bad fit for ring # %i. Try reducing Pixel search range'%(i)629 return False630 zdis,cosB = calcZdisCosB(radius,tth,radii)631 Tilt = acosd(cosB) # 0 <= tilt <= 90632 zsinp = zdis*sind(ellipse[1])633 zcosp = zdis*cosd(ellipse[1])634 cent1.append(np.array([elcent[0]+zsinp,elcent[1]-zcosp]))635 cent2.append(np.array([elcent[0]-zsinp,elcent[1]+zcosp]))636 if i:637 d1 = cent1[-1]-cent1[-2] #get shift of 2 possible center solutions638 d2 = cent2[-1]-cent2[-2]639 if np.dot(d2,d2) > np.dot(d1,d1): #right solution is the larger shift640 data['center'] = cent1[-1]641 else:642 data['center'] = cent2[-1]643 Zsum += numZ644 phiSum += numZ*phi645 distSum += numZ*dist646 xSum += numZ*data['center'][0]647 ySum += numZ*data['center'][1]648 tiltSum += numZ*abs(Tilt)649 cent = data['center']650 print ('for ring # %2i dist %.3f rotate %6.2f tilt %6.2f Xcent %.3f Ycent %.3f Npts %d'651 %(i,dist,phi,Tilt,cent[0],cent[1],numZ))652 data['ellipses'].append(copy.deepcopy(ellipse+('r',)))653 G2plt.PlotImage(self)654 else:655 break656 fullSize = len(self.ImageZ)/scalex657 if 2*radii[1] < .9*fullSize:658 print 'Are all usable rings (>25% visible) used? Try reducing Min ring I/Ib'659 if not Zsum:660 print 'Only one ring fitted. Check your wavelength.'661 return False662 cent = data['center'] = [xSum/Zsum,ySum/Zsum]663 wave = data['wavelength']664 dist = data['distance'] = distSum/Zsum665 666 #possible error if no. of rings < 3! Might need trap here667 d1 = cent1[-1]-cent1[1] #compare last ring to 2nd ring668 d2 = cent2[-1]-cent2[1]669 Zsign = 1670 len1 = math.sqrt(np.dot(d1,d1))671 len2 = math.sqrt(np.dot(d2,d2))672 t1 = d1/len1673 t2 = d2/len2674 if len2 > len1:675 if -135. < atan2d(t2[1],t2[0]) < 45.:676 Zsign = -1677 else:678 if -135. < atan2d(t1[1],t1[0]) < 45.:679 Zsign = -1680 681 tilt = data['tilt'] = Zsign*tiltSum/Zsum682 phi = data['rotation'] = phiSum/Zsum683 rings = np.concatenate((data['rings']),axis=0)684 p0 = [dist,cent[0],cent[1],phi,tilt]685 result = FitDetector(rings,p0,wave)686 data['distance'] = result[0]687 data['center'] = result[1:3]688 data['rotation'] = np.mod(result[3],360.0)689 data['tilt'] = result[4]690 N = len(data['ellipses'])691 data['ellipses'] = [] #clear away individual ellipse fits692 for H in HKL[:N]:693 ellipse = GetEllipse(H[3],data)694 data['ellipses'].append(copy.deepcopy(ellipse+('b',)))695 G2plt.PlotImage(self)696 return True697 698 def Make2ThetaAzimuthMap(data,imageN):699 #transforms 2D image from x,y space to 2-theta,azimuth space based on detector orientation700 pixelSize = data['pixelSize']701 scalex = pixelSize[0]/1000.702 scaley = pixelSize[1]/1000.703 tax,tay = np.mgrid[0.5:imageN+.5,0.5:imageN+.5] #bin centers not corners704 tax = np.asfarray(tax*scalex,dtype=np.float32)705 tay = np.asfarray(tay*scaley,dtype=np.float32)706 return GetTthAzm(tay,tax,data) #2-theta & azimuth arrays707 708 def Fill2ThetaAzimuthMap(data,TA,image):709 import numpy.ma as ma710 LUtth = data['IOtth']711 if data['fullIntegrate']:712 LRazm = [-180,180]713 else:714 LRazm = data['LRazimuth']715 imageN = len(image)716 TA = np.reshape(TA,(2,imageN,imageN))717 TA = np.dstack((ma.getdata(TA[1]),ma.getdata(TA[0]))) #azimuth, 2-theta718 tax,tay = np.dsplit(TA,2) #azimuth, 2-theta719 tax = ma.masked_outside(tax.flatten(),LRazm[0],LRazm[1])720 tay = ma.masked_outside(tay.flatten(),LUtth[0],LUtth[1])721 tam = ma.getmask(tax)+ma.getmask(tay)722 taz = ma.masked_where(tam,image.flatten())723 return tax,tay,taz,tam724 725 def Bin2ThetaAzimuthMap(data,tax,tay,taz):726 import numpy.ma as ma727 LUtth = data['IOtth']728 if data['fullIntegrate']:729 LRazm = [-180,180]730 else:731 LRazm = data['LRazimuth']732 numAzms = data['outAzimuths']733 numChans = data['outChannels']734 NST = np.histogram2d(tax,tay,normed=False,bins=(numAzms,numChans),range=[LRazm,LUtth])735 HST = np.histogram2d(tax,tay,normed=False,bins=(numAzms,numChans),range=[LRazm,LUtth],weights=taz)736 return NST,HST737 738 def ImageIntegrate(self,data):739 dlg = wx.ProgressDialog("Elapsed time","2D image integration",5,740 style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE)741 try:742 print 'Begin image integration'743 print 'Create 2-theta,azimuth map'744 t0 = time.time()745 dlg.Update(0)746 imageN = len(self.ImageZ)747 TA = Make2ThetaAzimuthMap(data,imageN) #2-theta & azimuth arrays748 dlg.Update(1)749 print 'Fill map with 2-theta/azimuth values'750 tax,tay,taz,tam = Fill2ThetaAzimuthMap(data,TA,self.ImageZ)751 del TA752 dlg.Update(2)753 print 'Bin image by 2-theta/azimuth intervals'754 NST,HST = Bin2ThetaAzimuthMap(data,tax,tay,taz)755 del tax,tay,taz756 dlg.Update(3)757 print 'Form normalized 1D pattern(s)'758 self.Integrate = [HST[0]/NST[0],HST[1],HST[2]]759 del NST,HST760 dlg.Update(4)761 t1 = time.time()762 print 'Integration complete'763 print "Elapsed time:","%8.3f"%(t1-t0), "s"764 finally:765 dlg.Destroy()766 285 767 286 -
TabularUnified trunk/GSASIIgrid.py ¶
r79 r81 10 10 import GSASIIlattice as G2lat 11 11 import GSASIIindex as G2indx 12 import GSASIIimage as G2img 12 13 import GSASIIspc as G2spc 13 14 import GSASIIElem as G2elem … … 1307 1308 self.ifGetRing = False 1308 1309 1309 if G2 cmp.ImageCalibrate(self,data):1310 if G2img.ImageCalibrate(self,data): 1310 1311 Status.SetStatusText('Calibration successful') 1311 1312 cent = data['center'] … … 1319 1320 1320 1321 def OnIntegrate(event): 1321 G2 cmp.ImageIntegrate(self,data)1322 G2img.ImageIntegrate(self,data) 1322 1323 G2plt.PlotIntegration(self,newPlot=True) 1323 1324 self.dataFrame.ImageEdit.Enable(id=wxID_SAVEINTG,enable=True) … … 1350 1351 Id = GetPatternTreeItemId(self,id, 'Image Controls') 1351 1352 Data = self.PatternTree.GetItemPyData(Id) 1352 G2 cmp.ImageIntegrate(self,Data)1353 G2img.ImageIntegrate(self,Data) 1353 1354 G2plt.PlotIntegration(self,newPlot=True) 1354 1355 self.dataFrame.ImageEdit.Enable(id=wxID_SAVEINTG,enable=True) -
TabularUnified trunk/GSASIIplot.py ¶
r77 r81 8 8 import GSASIIpath 9 9 import GSASIIgrid as G2gd 10 import GSASII comp as G2cmp10 import GSASIIimage as G2img 11 11 import GSASIIIO as G2IO 12 12 from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas … … 585 585 Page.canvas.SetToolTipString('%6d deg'%(ang)) 586 586 elif 'line1' in str(item) or 'line2' in str(item): 587 tth = G2 cmp.GetTth(event.xdata,event.ydata,Data)587 tth = G2img.GetTth(event.xdata,event.ydata,Data) 588 588 Page.canvas.SetToolTipString('%8.3fdeg'%(tth)) 589 589 else: … … 594 594 if (0 <= xpix <= size) and (0 <= ypix <= size): 595 595 Page.canvas.SetToolTipString('%6d'%(self.ImageZ[ypix][xpix])) 596 tth,azm,dsp = G2 cmp.GetTthAzmDsp(xpos,ypos,Data)596 tth,azm,dsp = G2img.GetTthAzmDsp(xpos,ypos,Data) 597 597 Q = 2.*math.pi/dsp 598 598 self.G2plotNB.status.SetFields(\ … … 635 635 Xpix = Xpos*scalex 636 636 Ypix = Ypos*scaley 637 xpos,ypos,I,J = G2 cmp.ImageLocalMax(self.ImageZ,20,Xpix,Ypix)637 xpos,ypos,I,J = G2img.ImageLocalMax(self.ImageZ,20,Xpix,Ypix) 638 638 if I and J: 639 639 xpos += .5 #shift to pixel center … … 655 655 rings.remove(ring) 656 656 else: 657 tth,azm,dsp = G2 cmp.GetTthAzmDsp(xpos,ypos,Data)657 tth,azm,dsp = G2img.GetTthAzmDsp(xpos,ypos,Data) 658 658 if 'Line2D' in str(self.itemPicked): 659 659 if 'line1' in str(self.itemPicked): … … 669 669 Data['LRazimuth'][1] += 360 670 670 if Data['IOtth'][0] > Data['IOtth'][1]: 671 Data['IOtth'] = G2cmp.SwapXY(Data['IOtth'][0],Data['IOtth'][1])671 Data['IOtth'][0],Data['IOtth'][1] = Data['IOtth'][1],Data['IOtth'][0] 672 672 673 673 self.InnerTth.SetValue("%8.2f" % (Data['IOtth'][0])) … … 726 726 Plot.set_ylabel('Image y-axis, mm',fontsize=12) 727 727 #need "applyMask" routine here 728 A = G2 cmp.ImageCompress(self.ImageZ,imScale)728 A = G2img.ImageCompress(self.ImageZ,imScale) 729 729 Img = Plot.imshow(A,aspect='equal',cmap=acolor, 730 730 interpolation='nearest',vmin=Imin,vmax=Imax,extent=[0,Xmax,Xmax,0]) … … 736 736 wave = Data['wavelength'] 737 737 dspI = wave/(2.0*sind(IOtth[0]/2.0)) 738 ellI = G2 cmp.GetEllipse(dspI,Data) #=False if dsp didn't yield an ellipse (ugh! a parabola or a hyperbola)738 ellI = G2img.GetEllipse(dspI,Data) #=False if dsp didn't yield an ellipse (ugh! a parabola or a hyperbola) 739 739 dspO = wave/(2.0*sind(IOtth[1]/2.0)) 740 ellO = G2 cmp.GetEllipse(dspO,Data) #Ditto & more likely for outer ellipse740 ellO = G2img.GetEllipse(dspO,Data) #Ditto & more likely for outer ellipse 741 741 if Data['fullIntegrate']: 742 742 Azm = np.array(range(0,361)) … … 746 746 xyI = [] 747 747 for azm in Azm: 748 xyI.append(G2 cmp.GetDetectorXY(dspI,azm,Data))748 xyI.append(G2img.GetDetectorXY(dspI,azm,Data)) 749 749 xyI = np.array(xyI) 750 750 arcxI,arcyI = xyI.T … … 753 753 xyO = [] 754 754 for azm in Azm: 755 xyO.append(G2 cmp.GetDetectorXY(dspO,azm,Data))755 xyO.append(G2img.GetDetectorXY(dspO,azm,Data)) 756 756 xyO = np.array(xyO) 757 757 arcxO,arcyO = xyO.T … … 828 828 rings = np.concatenate((Data['rings']),axis=0) 829 829 for xring,yring,dsp in rings: 830 x,y = G2 cmp.GetTthAzm(xring,yring,Data)830 x,y = G2img.GetTthAzm(xring,yring,Data) 831 831 Plot.plot(x,y,'r+') 832 832 if Data['ellipses']: 833 833 for ellipse in Data['ellipses']: 834 ring = np.array(G2 cmp.makeIdealRing(ellipse[:3])) #skip color834 ring = np.array(G2img.makeIdealRing(ellipse[:3])) #skip color 835 835 x,y = np.hsplit(ring,2) 836 tth,azm = G2 cmp.GetTthAzm(x,y,Data)836 tth,azm = G2img.GetTthAzm(x,y,Data) 837 837 Plot.plot(tth,azm,'b,') 838 838 if not newPlot: … … 901 901 rings = np.concatenate((Data['rings']),axis=0) 902 902 for xring,yring,dsp in rings: 903 x,y = G2 cmp.GetTthAzm(xring,yring,Data)903 x,y = G2img.GetTthAzm(xring,yring,Data) 904 904 Plot.plot(y,x,'r+') 905 905 if Data['ellipses']: 906 906 for ellipse in Data['ellipses']: 907 ring = np.array(G2 cmp.makeIdealRing(ellipse[:3])) #skip color907 ring = np.array(G2img.makeIdealRing(ellipse[:3])) #skip color 908 908 x,y = np.hsplit(ring,2) 909 tth,azm = G2 cmp.GetTthAzm(x,y,Data)909 tth,azm = G2img.GetTthAzm(x,y,Data) 910 910 Plot.plot(azm,tth,'b,') 911 911 if not newPlot:
Note: See TracChangeset
for help on using the changeset viewer.