Changeset 2740


Ignore:
Timestamp:
Mar 4, 2017 5:22:27 PM (5 years ago)
Author:
vondreele
Message:

fix issue with optimizing PDFs without Sample Bkg.
Finish implementing diff PDFs

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIplot.py

    r2739 r2740  
    25622562    PDFdata = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId, 'PDF Controls'))
    25632563    numbDen = G2pwd.GetNumDensity(PDFdata['ElList'],PDFdata['Form Vol'])
    2564     name = G2frame.PatternTree.GetItemText(PatternId)[4:]
    25652564    if G2frame.SinglePlot:
    25662565        if 'G(R)' not in data:
    25672566            return
    25682567        PlotList = [data[plotType],]
     2568        name = PlotList[0][2]
    25692569    else:
    25702570        PlotList = []
  • trunk/GSASIIpwd.py

    r2717 r2740  
    368368    nR = len(xydata['GofR'][1][1])
    369369    mul = int(round(2.*np.pi*nR/(data.get('Rmax',100.)*qLimits[1])))
    370     xydata['GofR'][1][0] = 2.*np.pi*np.linspace(0,nR,nR)/(mul*qLimits[1])
     370    xydata['GofR'][1][0] = 2.*np.pi*np.linspace(0,nR,nR,endpoint=True)/(mul*qLimits[1])
    371371    xydata['GofR'][1][1] = -dq*np.imag(ft.fft(xydata['FofQ'][1][1],mul*nR)[:nR])
    372372    if data.get('noRing',True):
  • trunk/GSASIIpwdGUI.py

    r2739 r2740  
    46304630        rms = Min(xstart)
    46314631        print('  Optimizing corrections to improve G(r) at low r')
    4632         if data['Sample Bkg.']['Refine']:
     4632        if data['Sample Bkg.'].get('Refine',False):
    46334633#            data['Flat Bkg'] = 0.
    46344634            print('  start: Ruland={:.3f}, Sample Bkg mult={:.3f} (RMS:{:.4f})'.format(
     
    46374637            print('  start: Flat Bkg={:.1f}, BackRatio={:.3f}, Ruland={:.3f} (RMS:{:.4f})'.format(
    46384638                data['Flat Bkg'],data['BackRatio'],data['Ruland'],rms))
    4639     if data['Sample Bkg.']['Refine']:
     4639    if data['Sample Bkg.'].get('Refine',False):
    46404640        res = opt.minimize(Min,xstart,bounds=([0.01,1],[1.2*bakMul,0.8*bakMul]),
    46414641                    method='L-BFGS-B',options={'maxiter':maxCycles},tol=0.001)
     
    46494649        else:
    46504650            msg = 'Not Converged'
    4651         if data['Sample Bkg.']['Refine']:
     4651        if data['Sample Bkg.'].get('Refine',False):
    46524652            print('  end:   Ruland={:.3f}, Sample Bkg mult={:.3f} (RMS:{:.4f}) *** {} ***\n'.format(
    46534653                data['Ruland'],data['Sample Bkg.']['Mult'],res['fun'],msg))
     
    46784678        the min & max values are between 0 and 1.
    46794679        '''
    4680         if Data['Sample Bkg.']['Refine']:
     4680        if Data['Sample Bkg.'].get('Refine',False):
    46814681            R,S = arg
    46824682            Data['Sample Bkg.']['Mult'] = S
     
    46964696        '''Get the current ['Flat Bkg','BackRatio','Ruland'] with scaling
    46974697        '''
    4698         if data['Sample Bkg.']['Refine']:
    4699             return [max(10*data['Ruland'],.05),data['Sample']['Mult']]           
     4698        if data['Sample Bkg.'].get('Refine',False):
     4699                return [max(10*data['Ruland'],.05),data['Sample']['Mult']]
    47004700        try:
    47014701            F = data['Flat Bkg']/BkgMax
     
    47074707        scaled, refined values and plot corrected region of G(r)
    47084708        '''
    4709         if data['Sample Bkg.']['Refine']:
     4709        if data['Sample Bkg.'].get('Refine',False):
    47104710            R,S = arg
    47114711            data['Sample Bkg.']['Mult'] = S
     
    50835083            data['diffGRname'] = grName.GetValue()
    50845084            if data['diffGRname']:
     5085                data['delt-G(R)'] = copy.deepcopy(data['G(R)'])
    50855086                id = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,data['diffGRname'])
    50865087                pId = G2gd.GetPatternTreeItemId(G2frame,id,'PDF Controls')
    5087                 subData = G2frame.PatternTree.GetItemPyData(pId)['G(R)'][1]
    5088                 if subData[0].shape != data['G(R)'][1][0].shape:
     5088                subData = G2frame.PatternTree.GetItemPyData(pId)['G(R)']
     5089                if subData[1][0].shape != data['G(R)'][1][0].shape:
    50895090                    print 'Error - G(R) not same length'
    5090                 data['delt-G(R)'] = [subData[0],data['G(R)'][1][0]-subData[1]]
     5091                data['delt-G(R)'][1] = np.array([subData[1][0],data['G(R)'][1][1]-subData[1][1]])
     5092                data['delt-G(R)'][2] += ('-\n'+subData[2])
    50915093                G2plt.PlotISFG(G2frame,data,newPlot=True,plotType='delt-G(R)')
    50925094       
Note: See TracChangeset for help on using the changeset viewer.