Ignore:
Timestamp:
May 29, 2014 9:52:18 AM (8 years ago)
Author:
vondreele
Message:

add Dsp2pos & Pos2dsp for conversions to G2lattice
remove wave from DoIndexPeaks? - wasn't needed
use Pos2dsp & Dsp2pos in various places in G2pwdGUI
set sort order for TOF peaks - makes indexing work!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIlattice.py

    r1075 r1367  
    413413#for these: H = [h,k,l]; A is as used in calc_rDsq; G - inv metric tensor, g - metric tensor;
    414414#           cell - a,b,c,alp,bet,gam in A & deg
     415   
     416def Pos2dsp(Inst,pos):
     417    ''' convert powder pattern position (2-theta or TOF, musec) to d-spacing
     418    ignores secondary effects (e.g. difA in TOF)
     419    '''
     420    if 'C' in Inst['Type'][0]:
     421        wave = G2mth.getWave(Inst)
     422        dsp = wave/(2.0*sind((pos-Inst['Zero'][1])/2.0))
     423    else:   #'T'OF - ignore difA
     424        dsp = (pos-Inst['Zero'][1])/difC
     425    return dsp
     426   
     427def Dsp2pos(Inst,dsp):
     428    ''' convert d-spacing to powder pattern position (2-theta or TOF, musec)
     429    ignores secondary effects (e.g. difA in TOF) - maybe later?
     430    '''
     431    if 'C' in Inst['Type'][0]:
     432        wave = G2mth.getWave(Inst)
     433        pos = 2.0*asind(wave/(2.*dsp))+Inst['Zero'][1]             
     434    else:   #'T'OF - ignore difA
     435        pos = Inst['difC'][1]*dsp+Inst['Zero'][1]
     436    return pos             
    415437   
    416438def calc_rDsq(H,A):
Note: See TracChangeset for help on using the changeset viewer.