Changeset 2671
 Timestamp:
 Jan 29, 2017 6:00:26 PM (5 years ago)
 Location:
 trunk
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIIimage.py
r2630 r2671 360 360 361 361 def GetDetXYfromThAzm(Th,Azm,data): 362 'Needs a doc string' 362 '''Computes a detector position from a 2theta angle and an azimultal 363 angle (both in degrees) 364 ''' 363 365 dsp = data['wavelength']/(2.0*npsind(Th)) 364 366 return GetDetectorXY(dsp,Azm,data) 365 367 366 368 def GetTthAzmDsp(x,y,data): #expensive 367 'Needs a doc string  checked OK for ellipses & hyperbola' 369 '''Computes a 2theta, etc. from a detector position and calibration constants 370  checked OK for ellipses & hyperbola 371 :returns: np.array(tth,azm,G,dsp) where tth is 2theta, azm is the azimutal angle, 372 G is ? and dsp is the dspace 373 ''' 368 374 wave = data['wavelength'] 369 375 cent = data['center'] 
trunk/GSASIIimgGUI.py
r2670 r2671 47 47 asind = lambda x: 180.*math.asin(x)/math.pi 48 48 tth2q = lambda t,w:4.0*math.pi*sind(t/2.0)/w 49 49 atand = lambda x: 180.*math.atan(x)/math.pi 50 atan2d = lambda y,x: 180.*math.atan2(y,x)/math.pi 51 50 52 ################################################################################ 51 53 ##### Image Data … … 465 467 Names = G2gd.GetPatternTreeDataNames(G2frame,['IMG ',]) 466 468 if len(Names) == 1: 467 G2frame.ErrorDialog('No thingimages to transfer integration angles to','Need more "IMG"s')469 G2frame.ErrorDialog('No images to transfer integration angles to','Need more "IMG"s') 468 470 return 469 471 Source = G2frame.PatternTree.GetItemText(G2frame.Image) 470 472 Names.pop(Names.index(Source)) 471 # select targets & do copy 472 dlg = G2G.G2MultiChoiceDialog(G2frame,'Xfer angles','Transfer integration range from '+Source+' to:',Names) 473 # select targets & do copy 474 extraopts = {"label_1":"Xfer scaled calib dmin", "value_1":False} 475 dlg = G2G.G2MultiChoiceDialog(G2frame,'Xfer angles', 476 'Transfer integration range from '+Source+' to:',Names, 477 extraOpts=extraopts) 473 478 try: 474 479 if dlg.ShowModal() == wx.ID_OK: 475 xferAng = lambda tth,dist1,dist2: asind(dist1 * sind(tth) / dist2) 480 #xferAng = lambda tth,dist1,dist2: asind(dist1 * sind(tth) / dist2) 481 xferAng = lambda tth,dist1,dist2: atand(dist1 * tand(tth) / dist2) 476 482 items = dlg.GetSelections() 477 483 G2frame.EnablePlot = False … … 480 486 ttmin0,ttmax0 = data['IOtth'] 481 487 dist0 = data['distance'] 482 print 'distance =',dist0,' integration range: ',data['IOtth'] 488 wave0 = data['wavelength'] 489 dsp0 = data['calibdmin'] 490 print('distance = {:.2f} integration range: [{:.4f}, {:.4f}], calib dmin {:.3f}' 491 .format(dist0,ttmin0,ttmax0,dsp0)) 483 492 for item in items: 484 493 name = Names[item] … … 487 496 dist1 = data['distance'] 488 497 data['IOtth'] = [xferAng(ttmin0,dist0,dist1),xferAng(ttmax0,dist0,dist1)] 489 print 'distance =',dist1,' integration range: ',data['IOtth'] 498 if extraopts["value_1"]: 499 ang1 = xferAng(2.0*asind(wave0/(2.*dsp0)),dist0,dist1) 500 data['calibdmin'] = data['wavelength']/(2.*sind(ang1/2.)) 501 print('distance = {:.2f} integration range: [{:.4f}, {:.4f}], calib dmin {:.3f}' 502 .format(dist1,data['IOtth'][0],data['IOtth'][1],data['calibdmin'])) 503 else: 504 print('distance = {:.2f} integration range: [{:.4f}, {:.4f}]' 505 .format(dist1,data['IOtth'][0],data['IOtth'][1])) 490 506 finally: 491 507 dlg.Destroy()
Note: See TracChangeset
for help on using the changeset viewer.