Changeset 1644
 Timestamp:
 Feb 10, 2015 1:24:18 PM (8 years ago)
 Location:
 trunk
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIIimage.py
r1489 r1644 154 154 155 155 def ellipseCalcD(B,xyd,varyList,parmDict): 156 156 157 x,y,dsp = xyd 157 wave = parmDict['wave'] 158 if 'dep' in varyList: 159 dist,x0,y0,tilt,chi,dep = B[:6] 160 else: 161 dist,x0,y0,tilt,chi = B[:5] 162 dep = parmDict['dep'] 163 if 'wave' in varyList: 164 wave = B[1] 165 phi = chi90. #get rotation of major axis from tilt axis 166 tth = 2.0*npasind(wave/(2.*dsp)) 167 phi0 = npatan2d(yy0,xx0) 168 dxy = peneCorr(tth,dep,tilt,phi0) 158 varyDict = dict(zip(varyList,B)) 159 parms = {} 160 for parm in parmDict: 161 if parm in varyList: 162 parms[parm] = varyDict[parm] 163 else: 164 parms[parm] = parmDict[parm] 165 phi = parms['phi']90. #get rotation of major axis from tilt axis 166 tth = 2.0*npasind(parms['wave']/(2.*dsp)) 167 phi0 = npatan2d(yparms['detY'],xparms['detX']) 168 dxy = peneCorr(tth,parms['dep'],parms['tilt'],phi0) 169 169 ttth = nptand(tth) 170 170 stth = npsind(tth) 171 cosb = npcosd( tilt)172 tanb = nptand( tilt)173 tbm = nptand((tth tilt)/2.)174 tbp = nptand((tth+ tilt)/2.)175 sinb = npsind( tilt)176 d = dist+dxy171 cosb = npcosd(parms['tilt']) 172 tanb = nptand(parms['tilt']) 173 tbm = nptand((tthparms['tilt'])/2.) 174 tbp = nptand((tth+parms['tilt'])/2.) 175 sinb = npsind(parms['tilt']) 176 d = parms['dist']+dxy 177 177 fplus = d*tanb*stth/(cosb+stth) 178 178 fminus = d*tanb*stth/(cosbstth) … … 182 182 R1 = (vplus+vminus)/2. #major axis 183 183 zdis = (fplusfminus)/2. 184 Robs = np.sqrt((x x0)**2+(yy0)**2)184 Robs = np.sqrt((xparms['detX'])**2+(yparms['detY'])**2) 185 185 rsqplus = R0**2+R1**2 186 186 rsqminus = R0**2R1**2 … … 201 201 sig = list(np.sqrt(chisq*np.diag(result[1]))) 202 202 sigList = np.zeros(7) 203 for i,name in enumerate(names): 204 if name in varyList: 205 sigList[i] = sig[varyList.index(name)] 206 ValSig = zip(names,fmt,vals,sig) 203 for i,name in enumerate(varyList): 204 sigList[i] = sig[varyList.index(name)] 205 ValSig = zip(varyList,fmt,vals,sig) 207 206 if Print: 208 207 CalibPrint(ValSig,chisq,rings.shape[0]) … … 517 516 HKL += hkl 518 517 HKL = G2lat.sortHKLd(HKL,True,False) 519 varyList = [ 'dist','detX','detY','tilt','phi']518 varyList = [item for item in data['varyList'] if data['varyList'][item]] 520 519 parmDict = {'dist':data['distance'],'detX':data['center'][0],'detY':data['center'][1], 521 520 'tilt':data['tilt'],'phi':data['rotation'],'wave':data['wavelength'],'dep':data['DetDepth']} … … 547 546 # break 548 547 rings = np.concatenate((data['rings']),axis=0) 549 if data['DetDepthRef']:550 varyList.append('dep')551 548 chisq = FitDetector(rings,varyList,parmDict) 552 549 data['distance'] = parmDict['dist'] … … 667 664 Ringp = makeRing(dsp,ellipsep,3,cutoff,scalex,scaley,self.ImageZ) 668 665 parmDict = {'dist':dist,'detX':centp[0],'detY':centp[1], 669 'tilt':tilt,'phi':phi,'wave':wave,'dep':0.0} 670 varyList = [ 'dist','detX','detY','tilt','phi']666 'tilt':tilt,'phi':phi,'wave':wave,'dep':0.0} 667 varyList = [item for item in data['varyList'] if data['varyList'][item]] 671 668 if len(Ringp) > 10: 672 669 chip = FitDetector(np.array(Ring0+Ringp),varyList,parmDict,True) … … 706 703 parmDict = {'dist':data['distance'],'detX':data['center'][0],'detY':data['center'][1], 707 704 'tilt':data['tilt'],'phi':data['rotation'],'wave':data['wavelength'],'dep':data['DetDepth']} 708 varyList = ['dist','detX','detY','tilt','phi'] 709 if data['DetDepthRef']: 710 varyList.append('dep') 705 varyList = [item for item in data['varyList'] if data['varyList'][item]] 711 706 data['rings'] = [] 712 707 data['ellipses'] = [] 
trunk/GSASIIimgGUI.py
r1619 r1644 99 99 if 'DetDepth' not in data: 100 100 data['DetDepth'] = 0. 101 data['DetDepthRef'] = False102 101 if 'SampleAbs' not in data: 103 102 data['SampleShape'] = 'Cylinder' … … 108 107 elif 'SASD' in data['type']: 109 108 data['binType'] = 'log(q)' 109 if 'varyList' not in data: 110 data['varyList'] = {'dist':True,'detX':True,'detY':True,'tilt':True,'phi':True,'dep':False,'wave':False} 110 111 #end patch 111 112 … … 480 481 481 482 def OnDetDepthRef(event): 482 data[' DetDepthRef'] = penSel.GetValue()483 data['varyList']['dep'] = penSel.GetValue() 483 484 484 485 def OnDetDepth(event): … … 505 506 calibSizer.Add(waveSel,0,WACV) 506 507 calibSizer.Add(wx.StaticText(parent=G2frame.dataDisplay,label=' Distance'),0,WACV) 507 # dist = wx.CheckBox(G2frame.dataDisplay,label=' Distance') #possible future mod. to allow fix of calib. parms.?508 # distVary = wx.CheckBox(G2frame.dataDisplay,label=' Distance') 508 509 distSel = wx.TextCtrl(parent=G2frame.dataDisplay,value=("%8.2f"%(data['distance'])),style=wx.TE_READONLY) 509 510 distSel.SetBackgroundColour(VERY_LIGHT_GREY) … … 521 522 calibSizer.Add(penSel,0,WACV) 522 523 penSel.Bind(wx.EVT_CHECKBOX, OnDetDepthRef) 523 penSel.SetValue(data[' DetDepthRef'])524 penSel.SetValue(data['varyList']['dep']) 524 525 penVal = wx.TextCtrl(parent=G2frame.dataDisplay,value=("%6.5f" % (data['DetDepth'])), 525 526 style=wx.TE_PROCESS_ENTER)
Note: See TracChangeset
for help on using the changeset viewer.