Changeset 2740 for trunk/GSASIIpwdGUI.py


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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.