Changeset 2671


Ignore:
Timestamp:
Jan 29, 2017 6:00:26 PM (5 years ago)
Author:
toby
Message:

Set calib d-min as option for xfer angles; fix trig error

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIimage.py

    r2630 r2671  
    360360   
    361361def 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    '''
    363365    dsp = data['wavelength']/(2.0*npsind(Th))   
    364366    return GetDetectorXY(dsp,Azm,data)
    365367                   
    366368def 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 d-space
     373    '''
    368374    wave = data['wavelength']
    369375    cent = data['center']
  • trunk/GSASIIimgGUI.py

    r2670 r2671  
    4747asind = lambda x: 180.*math.asin(x)/math.pi
    4848tth2q = lambda t,w:4.0*math.pi*sind(t/2.0)/w
    49    
     49atand = lambda x: 180.*math.atan(x)/math.pi
     50atan2d = lambda y,x: 180.*math.atan2(y,x)/math.pi
     51
    5052################################################################################
    5153##### Image Data
     
    465467        Names = G2gd.GetPatternTreeDataNames(G2frame,['IMG ',])
    466468        if len(Names) == 1:
    467             G2frame.ErrorDialog('Nothing images to transfer integration angles to','Need more "IMG"s')
     469            G2frame.ErrorDialog('No images to transfer integration angles to','Need more "IMG"s')
    468470            return
    469471        Source = G2frame.PatternTree.GetItemText(G2frame.Image)
    470472        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 d-min", "value_1":False}
     475        dlg = G2G.G2MultiChoiceDialog(G2frame,'Xfer angles',
     476                                      'Transfer integration range from '+Source+' to:',Names,
     477                                      extraOpts=extraopts)
    473478        try:
    474479            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)
    476482                items = dlg.GetSelections()
    477483                G2frame.EnablePlot = False
     
    480486                ttmin0,ttmax0 = data['IOtth']
    481487                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))
    483492                for item in items:
    484493                    name = Names[item]
     
    487496                    dist1 = data['distance']
    488497                    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]))
    490506        finally:
    491507            dlg.Destroy()
Note: See TracChangeset for help on using the changeset viewer.