Changeset 4194


Ignore:
Timestamp:
Nov 26, 2019 3:18:38 AM (22 months ago)
Author:
vondreele
Message:

fix bug in absorption calc for TOF
fix bug if Cancel from default iparm selection

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r4193 r4194  
    43944394
    43954395################################################################################
    4396 #### fullrmc Data page
     4396#### RMC Data page
    43974397################################################################################
    43984398
     
    45414541            dlg = wx.FileDialog(G2frame, 'Choose fullrmc python file to execute',
    45424542                wildcard='fullrmc python file (*.py)|*.py',style=wx.FD_CHANGE_DIR)
     4543           
    45434544        else:
    45444545            wx.MessageBox(''' For use of RMCProfile, please cite:
  • trunk/GSASIIpwd.py

    r4193 r4194  
    189189    if 'Cylinder' in Geometry:      #Lobanov & Alte da Veiga for 2-theta = 0; beam fully illuminates sample
    190190        if 'array' in str(type(MuR)):
    191             MuRSTh2 = np.concatenate((MuR,Sth2))
     191            MuRSTh2 = np.vstack((MuR,Sth2))
    192192            AbsCr = np.where(MuRSTh2[0]<=3.0,muRunder3(MuRSTh2[0],MuRSTh2[1]),muRover3(MuRSTh2[0],MuRSTh2[1]))
    193193            return AbsCr
     
    298298    '''
    299299    auxPlot = []
    300     qLimits = data['QScaleLim']
    301     Ibeg = np.searchsorted(xydata['Sample'][1][0],limits[0])
    302     Ifin = np.searchsorted(xydata['Sample'][1][0],limits[1])+1
     300    if 'T' in inst['Type'][0]:
     301        Ibeg = 0
     302        Ifin = len(xydata['Sample'][1][0])
     303    else:
     304        Ibeg = np.searchsorted(xydata['Sample'][1][0],limits[0])
     305        Ifin = np.searchsorted(xydata['Sample'][1][0],limits[1])+1
    303306    #subtract backgrounds - if any & use PWDR limits
    304307    IofQ = copy.deepcopy(xydata['Sample'])
     
    315318    #get element data & absorption coeff.
    316319    ElList = data['ElList']
    317     Abs = G2lat.CellAbsorption(ElList,data['Form Vol'])
    318     #Apply angle dependent corrections
    319     Tth = IofQ[1][0]
    320     MuR = Abs*data['Diam']/20.0
    321     IofQ[1][1] /= Absorb(data['Geometry'],MuR,Tth)
     320    Tth = IofQ[1][0]    #2-theta or TOF!
    322321    if 'X' in inst['Type'][0]:
     322        Abs = G2lat.CellAbsorption(ElList,data['Form Vol'])
     323        #Apply angle dependent corrections
     324        MuR = Abs*data['Diam']/20.0
     325        IofQ[1][1] /= Absorb(data['Geometry'],MuR,Tth)
    323326        IofQ[1][1] /= Polarization(inst['Polariz.'][1],Tth,Azm=inst['Azimuth'][1])[0]
    324     if data['DetType'] == 'Image plate':
    325         IofQ[1][1] *= Oblique(data['ObliqCoeff'],Tth)
     327        if data['DetType'] == 'Image plate':
     328            IofQ[1][1] *= Oblique(data['ObliqCoeff'],Tth)
     329    elif 'T' in inst['Type'][0]:    #neutron TOF normalized data - needs wavelength dependent absorption
     330        wave = 2.*G2lat.TOF2dsp(inst,IofQ[1][0])*npsind(inst['2-theta'][1]/2.)
     331        Els = ElList.keys()
     332        Isotope = {El:'Nat. abund.' for El in Els}
     333        GD = {'AtomTypes':ElList,'Isotope':Isotope}
     334        BLtables = G2elem.GetBLtable(GD)
     335        FP,FPP = G2elem.BlenResTOF(Els,BLtables,wave)
     336        Abs = np.zeros(len(wave))
     337        for iel,El in enumerate(Els):
     338            BL = BLtables[El][1]
     339            SA = BL['SA']*wave/1.798197+4.0*np.pi*FPP[iel]**2 #+BL['SL'][1]?
     340            SA *= ElList[El]['FormulaNo']/data['Form Vol']
     341            Abs += SA
     342        MuR = Abs*data['Diam']/2.
     343        IofQ[1][1] /= Absorb(data['Geometry'],MuR,inst['2-theta'][1]*np.ones(len(wave)))       
    326344    XY = IofQ[1]   
    327345    #convert to Q
     
    346364    Qdata -= np.min(Qdata)*data['BackRatio']
    347365   
     366    qLimits = data['QScaleLim']
    348367    maxQ = np.searchsorted(Qpoints,min(Qpoints[-1],qLimits[1]))+1
    349368    minQ = np.searchsorted(Qpoints,min(qLimits[0],0.90*Qpoints[-1]))
  • trunk/GSASIIpwdGUI.py

    r4193 r4194  
    19511951                rd = G2obj.ImportPowderData('Dummy')
    19521952                rd.Sample = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId,'Sample Parameters'))
    1953                 data = GetDefaultParms(rd)[0]
     1953                try:
     1954                    data = GetDefaultParms(rd)[0]
     1955                except TypeError:   #Cancel - got None
     1956                    pass
    19541957                UpdateInstrumentGrid(G2frame,data)
    19551958            G2plt.PlotPeakWidths(G2frame)
Note: See TracChangeset for help on using the changeset viewer.