Changeset 2610 for trunk/GSASIIpwdGUI.py


Ignore:
Timestamp:
Jan 4, 2017 1:31:26 PM (5 years ago)
Author:
toby
Message:

fix bug on change in PDF files; save location when images are moved

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpwdGUI.py

    r2596 r2610  
    45694569#####  PDF controls
    45704570################################################################################           
    4571        
    45724571def UpdatePDFGrid(G2frame,data):
    45734572    '''respond to selection of PWDR PDF data tree item.
    4574     '''
    4575     global inst
    4576     tth2q = lambda t,w:4.0*math.pi*sind(t/2.0)/w
    4577     tof2q = lambda t,C:2.0*math.pi*C/t
    4578     dataFile = G2frame.PatternTree.GetItemText(G2frame.PatternId)
    4579     powName = 'PWDR'+dataFile[4:]
    4580     powId = G2gd.GetPatternTreeItemId(G2frame,G2frame.root, powName)
    4581     fullLimits,limits = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,powId, 'Limits'))[:2]
    4582     inst = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,powId, 'Instrument Parameters'))[0]
    4583     if 'C' in inst['Type'][0]:
    4584         wave = G2mth.getWave(inst)
    4585         keV = 12.397639/wave
    4586         qLimits = [tth2q(fullLimits[0],wave),tth2q(fullLimits[1],wave)]
    4587         polariz = inst['Polariz.'][1]
    4588     else:   #'T'of
    4589         qLimits = [tof2q(fullLimits[1],inst['difC'][1]),tof2q(fullLimits[0],inst['difC'][1])]
    4590         polariz = 1.0
    4591     data['QScaleLim'][1] = min(qLimits[1],data['QScaleLim'][1])
    4592     if data['QScaleLim'][0]:
    4593         data['QScaleLim'][0] = max(qLimits[0],data['QScaleLim'][0])
    4594     else:                                #initial setting at 90% of max Q
    4595         data['QScaleLim'][0] = 0.90*data['QScaleLim'][1]
    4596     itemDict = {}
    4597     #patch
    4598     if 'BackRatio' not in data:
    4599         data['BackRatio'] = 0.
    4600     if 'noRing' not in data:
    4601         data['noRing'] = False
    4602     if 'Rmax' not in data:
    4603         data['Rmax'] = 100.
    4604     if 'Flat Bkg' not in data:
    4605         data['Flat Bkg'] = 0.
    4606     if 'IofQmin' not in data:
    4607         data['IofQmin'] = 1.0
    4608    
     4573    '''   
    46094574    def FillFileSizer(fileSizer,key):
    46104575        #fileSizer is a FlexGridSizer(3,6)
     
    46174582            Obj.SetValue(fmt%(value))
    46184583            data[fileKey][itemKey] = value
    4619             wx.CallAfter(UpdatePDFGrid,G2frame,data)
     4584            wx.CallLater(100,UpdatePDFGrid,G2frame,data)
     4585            wx.CallAfter(OnComputePDF,None)
    46204586           
    46214587        def OnMoveMult(event):
     
    48964862            G2plt.PlotISFG(G2frame,newPlot=True,plotType='G(R)')
    48974863            print ' Done calculating PDFs:'
    4898        
     4864
     4865    # Routine UpdatePDFGrid starts here
     4866    global inst
     4867    tth2q = lambda t,w:4.0*math.pi*sind(t/2.0)/w
     4868    tof2q = lambda t,C:2.0*math.pi*C/t
     4869    dataFile = G2frame.PatternTree.GetItemText(G2frame.PatternId)
     4870    powName = 'PWDR'+dataFile[4:]
     4871    powId = G2gd.GetPatternTreeItemId(G2frame,G2frame.root, powName)
     4872    fullLimits,limits = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,powId, 'Limits'))[:2]
     4873    inst = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,powId, 'Instrument Parameters'))[0]
     4874    if 'C' in inst['Type'][0]:
     4875        wave = G2mth.getWave(inst)
     4876        keV = 12.397639/wave
     4877        qLimits = [tth2q(fullLimits[0],wave),tth2q(fullLimits[1],wave)]
     4878        polariz = inst['Polariz.'][1]
     4879    else:   #'T'of
     4880        qLimits = [tof2q(fullLimits[1],inst['difC'][1]),tof2q(fullLimits[0],inst['difC'][1])]
     4881        polariz = 1.0
     4882    data['QScaleLim'][1] = min(qLimits[1],data['QScaleLim'][1])
     4883    if data['QScaleLim'][0]:
     4884        data['QScaleLim'][0] = max(qLimits[0],data['QScaleLim'][0])
     4885    else:                                #initial setting at 90% of max Q
     4886        data['QScaleLim'][0] = 0.90*data['QScaleLim'][1]
     4887    itemDict = {}
     4888    #patch
     4889    if 'BackRatio' not in data:
     4890        data['BackRatio'] = 0.
     4891    if 'noRing' not in data:
     4892        data['noRing'] = False
     4893    if 'Rmax' not in data:
     4894        data['Rmax'] = 100.
     4895    if 'Flat Bkg' not in data:
     4896        data['Flat Bkg'] = 0.
     4897    if 'IofQmin' not in data:
     4898        data['IofQmin'] = 1.0       
    48994899    if G2frame.dataDisplay:
    49004900        G2frame.dataFrame.Clear()
Note: See TracChangeset for help on using the changeset viewer.