Changeset 5624


Ignore:
Timestamp:
Jul 5, 2023 3:06:01 PM (5 months ago)
Author:
toby
Message:

add interpolation to PDF background subtraction when # of points dont agree

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • Tutorials/CWCombined/Combined refinement.htm

    r4457 r5624  
    20052005the extension). The refinement will finish with Rwp~18% for the neutron data
    20062006and Rwp~41% for the X-ray pattern. Now look closely at the fit. The plot should
    2007 be in q and with just one pattern selected (use ‘<b style='mso-bidi-font-weight:
     2007be in Q and with just one pattern selected (use ‘<b style='mso-bidi-font-weight:
    20082008normal'><span style='font-family:"Calibri",sans-serif;mso-ascii-theme-font:
    20092009minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-theme-font:minor-latin'>q</span></b>’
     
    20212021src="Combined%20refinement_files/image026.png" v:shapes="Picture_x0020_20"><![endif]></span></p>
    20222022
    2023 <p class=MsoNormal><span class=GramE>but</span> are shifted to lower q in the
     2023<p class=MsoNormal><span class=GramE>but</span> are shifted to lower Q in the
    20242024neutron pattern.</p>
    20252025
     
    20362036<h2>Step 5. Select some parameters and 2<sup>nd</sup> Rietveld refinement</h2>
    20372037
    2038 <p class=MsoNormal>To improve the refinement you should first select the <b
     2038<p class=MsoNormal>To improve the refinement you should first select
     2039the checkbox to <b
    20392040style='mso-bidi-font-weight:normal'><span style='font-family:"Calibri",sans-serif;
    20402041mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-theme-font:
  • Tutorials/CWNeutron/Neutron CW Powder Data.htm

    r4457 r5624  
    20802080style='mso-bidi-font-weight:normal'><span style='font-family:"Calibri",sans-serif;
    20812081mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:minor-latin'>Refine?</span></b>
    2082 flags. Next go to <b style='mso-bidi-font-weight:normal'><span
     2082flags (these are the checkboxes next to GSAS-II parameters). Next go to <b style='mso-bidi-font-weight:normal'><span
    20832083style='font-family:"Calibri",sans-serif;mso-ascii-theme-font:minor-latin;
    20842084mso-hansi-theme-font:minor-latin'>Sample Parameters</span></b>.</p>
  • Tutorials/LabData/Laboratory X.htm

    r4457 r5624  
    18211821focusing circle. <b style='mso-bidi-font-weight:normal'>Important</b>: this is
    18221822the most likely reason for peaks displacement errors in laboratory data, not
    1823 the zero point. The lattice parameter flag is on the <b style='mso-bidi-font-weight:
     1823the zero point. The lattice parameter flag (this is the checkbox next to the
     1824lattice parameters determines if the lattice parameters will be
     1825refined and is called the refinement flag) is on the <b style='mso-bidi-font-weight:
    18241826normal'><span style='font-family:"Calibri",sans-serif;mso-ascii-theme-font:
    18251827minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-theme-font:minor-latin'>General</span></b>
     
    18391841mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-theme-font:
    18401842minor-latin'>GSAS-II data tree</span></b>. Go to both places and set those
    1841 flags; make sure that the <b style='mso-bidi-font-weight:normal'><span
     1843flags (checkboxes); make sure that the <b style='mso-bidi-font-weight:normal'><span
    18421844style='font-family:"Calibri",sans-serif;mso-ascii-theme-font:minor-latin;
    18431845mso-hansi-theme-font:minor-latin'>Diffractometer type</span></b> is <b
  • Tutorials/TOF-CW Joint Refinement/TOF combined XN Rietveld refinement in GSAS.htm

    r4457 r5624  
    15851585style='font-family:"Calibri",sans-serif;mso-ascii-theme-font:minor-latin;
    15861586mso-hansi-theme-font:minor-latin'>Phase fraction</span></b> check box so it
    1587 will be refined. We want these values and refinement flags to be used for the
     1587will be refined. We want these values and refinement flags (checkboxes
     1588used to determine the parameters that will be varied) to be used for the
    15881589two neutron TOF patterns as well. Do <b style='mso-bidi-font-weight:normal'><span
    15891590style='font-family:"Calibri",sans-serif;mso-ascii-theme-font:minor-latin;
  • trunk/GSASIIpwd.py

    r5612 r5624  
    313313    IofQ[1] = np.array([I[Ibeg:Ifin] for I in IofQ[1]])
    314314    if data['Sample Bkg.']['Name']:
    315         IofQ[1][1] += xydata['Sample Bkg.'][1][1][Ibeg:Ifin]*data['Sample Bkg.']['Mult']
     315        try:   # fails if background differs in number of points
     316            IofQ[1][1] += xydata['Sample Bkg.'][1][1][Ibeg:Ifin]*data['Sample Bkg.']['Mult']
     317        except ValueError:
     318            print("Interpolating Sample background since points don't match")
     319            interpF = si.interp1d(xydata['Sample Bkg.'][1][0],xydata['Sample Bkg.'][1][1],
     320                                  fill_value='extrapolate')
     321            IofQ[1][1] += interpF(IofQ[1][0]) * data['Sample Bkg.']['Mult']
    316322    if data['Container']['Name']:
    317323        xycontainer = xydata['Container'][1][1]*data['Container']['Mult']
    318324        if data['Container Bkg.']['Name']:
    319             xycontainer += xydata['Container Bkg.'][1][1][Ibeg:Ifin]*data['Container Bkg.']['Mult']
    320         IofQ[1][1] += xycontainer[Ibeg:Ifin]
     325            try:
     326                xycontainer += xydata['Container Bkg.'][1][1][Ibeg:Ifin]*data['Container Bkg.']['Mult']
     327            except ValueError:
     328                print('Number of points do not agree between Container and Container Bkg.')
     329                return
     330        try:   # fails if background differs in number of points
     331            IofQ[1][1] += xycontainer[Ibeg:Ifin]
     332        except ValueError:
     333            print("Interpolating Container background since points don't match")
     334            interpF = si.interp1d(xydata['Container'][1][0],xycontainer,fill_value='extrapolate')
     335            IofQ[1][1] += interpF(IofQ[1][0])
     336       
    321337    data['IofQmin'] = IofQ[1][1][-1]
    322338    IofQ[1][1] -= data.get('Flat Bkg',0.)
  • trunk/GSASIIpwdGUI.py

    r5623 r5624  
    76977697    inst = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,powId,'Instrument Parameters'))[0]
    76987698    auxPlot = G2pwd.CalcPDF(data,inst,Xlimits,xydata)
    7699     data['I(Q)'] = xydata['IofQ']
    7700     data['S(Q)'] = xydata['SofQ']
    7701     data['F(Q)'] = xydata['FofQ']
    7702     data['G(R)'] = xydata['GofR']
    7703     data['g(r)'] = xydata['gofr']
    7704     return auxPlot
     7699    try:
     7700        data['I(Q)'] = xydata['IofQ']
     7701        data['S(Q)'] = xydata['SofQ']
     7702        data['F(Q)'] = xydata['FofQ']
     7703        data['G(R)'] = xydata['GofR']
     7704        data['g(r)'] = xydata['gofr']
     7705        return auxPlot
     7706    except:   # PDF Calc aborted
     7707        pass
    77057708
    77067709def OptimizePDF(G2frame,data,showFit=True,maxCycles=5):
Note: See TracChangeset for help on using the changeset viewer.