Changeset 1506 for trunk/GSASIIpwdGUI.py


Ignore:
Timestamp:
Sep 26, 2014 9:41:33 AM (8 years ago)
Author:
vondreele
Message:

break ReadPowderInstprm? into two pieces; OpenPowderInstprm? is new. This will allow using instprm type lines for default instrument parameters instead of old style GSAS ones.
Implement import of superlattice phase and structure factors from JANA2006 files.
Draw superlattice structure factors in 2D & 3D.
Develop GUI for superlattice phase information; atom displacement, Uij, frac & mag waves.
Remove old style mag stuff.
Fix bug in STD powder import .routine for y=0 points
fix bug in getVCov for missing parameter problem.
IsHistogram? InAnyPhase? now returns histogram name instead of True
Single crystal Reflection list now has menu with plot commands

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpwdGUI.py

    r1503 r1506  
    6464            histoList = data['Histograms'].keys()
    6565            if histoName in histoList:
    66                 return True
     66                return G2frame.PatternTree.GetItemText(item)
    6767            item, cookie = G2frame.PatternTree.GetNextChild(phases, cookie)
    6868        return False
     
    25862586    '''respond to selection of PWDR Reflections data tree item.
    25872587    '''
     2588    def OnPlotHKL(event):
     2589        FoMax = np.max(refList.T[8+Super])
     2590        Hmin = np.array([int(np.min(refList.T[0])),int(np.min(refList.T[1])),int(np.min(refList.T[2]))])
     2591        Hmax = np.array([int(np.max(refList.T[0])),int(np.max(refList.T[1])),int(np.max(refList.T[2]))])
     2592        controls = {'Type' : 'Fo','ifFc' : True,'HKLmax' : Hmax,'HKLmin' : Hmin,
     2593            'FoMax' : FoMax,'Zone' : '001','Layer' : 0,'Scale' : 1.0,'Super':Super,'SuperVec':SuperVec}
     2594        G2plt.PlotSngl(G2frame,newPlot=True,Data=controls,hklRef=refList,Title=phaseName)
     2595       
     2596    def OnPlot3DHKL(event):
     2597        FoMax = np.max(refList.T[8+Super])
     2598        Hmin = np.array([int(np.min(refList.T[0])),int(np.min(refList.T[1])),int(np.min(refList.T[2]))])
     2599        Hmax = np.array([int(np.max(refList.T[0])),int(np.max(refList.T[1])),int(np.max(refList.T[2]))])
     2600        Vpoint = [int(np.mean(refList.T[0])),int(np.mean(refList.T[1])),int(np.mean(refList.T[2]))]
     2601        controls = {'Type':'Fosq','Iscale':False,'HKLmax':Hmax,'HKLmin':Hmin,
     2602            'FoMax' : FoMax,'Scale' : 1.0,'Drawing':{'viewPoint':[Vpoint,[]],'default':Vpoint[:],
     2603            'backColor':[0,0,0],'depthFog':False,'Zclip':10.0,'cameraPos':10.,'Zstep':0.05,
     2604            'Scale':1.0,'oldxy':[],'viewDir':[1,0,0]},'Super':Super,'SuperVec':SuperVec}
     2605        G2plt.Plot3DSngl(G2frame,newPlot=True,Data=controls,hklRef=refList,Title=phaseName)
     2606       
     2607    def OnSelectPhase(event):
     2608        dlg = wx.SingleChoiceDialog(G2frame,'Select','Phase',phases)
     2609        try:
     2610            if dlg.ShowModal() == wx.ID_OK:
     2611                sel = dlg.GetSelection()
     2612                G2frame.RefList = phases[sel]
     2613                UpdateReflectionGrid(G2frame,data)
     2614        finally:
     2615            dlg.Destroy()
     2616        G2plt.PlotPatterns(G2frame)
     2617           
    25882618    if not data:
    25892619        print 'No phases, no reflections'
     
    25912621    if HKLF:
    25922622        G2frame.RefList = 1
    2593         phaseName = Name
     2623        phaseName = IsHistogramInAnyPhase(G2frame,Name)
    25942624    else:
    25952625        phaseName = G2frame.RefList
    25962626        phases = data.keys()
    2597    
    2598         def OnSelectPhase(event):
    2599             dlg = wx.SingleChoiceDialog(G2frame,'Select','Phase',phases)
    2600             try:
    2601                 if dlg.ShowModal() == wx.ID_OK:
    2602                     sel = dlg.GetSelection()
    2603                     G2frame.RefList = phases[sel]
    2604                     UpdateReflectionGrid(G2frame,data)
    2605             finally:
    2606                 dlg.Destroy()
    2607             G2plt.PlotPatterns(G2frame)
    2608            
    2609         def OnPlotHKL(event):
    2610             FoMax = np.max(refList.T[8])
    2611             Hmin = np.array([int(np.min(refList.T[0])),int(np.min(refList.T[1])),int(np.min(refList.T[2]))])
    2612             Hmax = np.array([int(np.max(refList.T[0])),int(np.max(refList.T[1])),int(np.max(refList.T[2]))])
    2613             controls = {'Type' : 'Fo','ifFc' : True,'HKLmax' : Hmax,'HKLmin' : Hmin,
    2614                 'FoMax' : FoMax,'Zone' : '001','Layer' : 0,'Scale' : 1.0,}
    2615             G2plt.PlotSngl(G2frame,newPlot=True,Data=controls,hklRef=refList,Title=phaseName)
    2616            
    2617         def OnPlot3DHKL(event):
    2618             FoMax = np.max(refList.T[8])
    2619             Hmin = np.array([int(np.min(refList.T[0])),int(np.min(refList.T[1])),int(np.min(refList.T[2]))])
    2620             Hmax = np.array([int(np.max(refList.T[0])),int(np.max(refList.T[1])),int(np.max(refList.T[2]))])
    2621             Vpoint = [int(np.mean(refList.T[0])),int(np.mean(refList.T[1])),int(np.mean(refList.T[2]))]
    2622             controls = {'Type':'Fosq','Iscale':False,'HKLmax':Hmax,'HKLmin':Hmin,
    2623                 'FoMax' : FoMax,'Scale' : 1.0,'Drawing':{'viewPoint':[Vpoint,[]],'default':Vpoint[:],
    2624                 'backColor':[0,0,0],'depthFog':False,'Zclip':10.0,'cameraPos':10.,'Zstep':0.05,
    2625                 'Scale':1.0,'oldxy':[],'viewDir':[1,0,0]}}
    2626             G2plt.Plot3DSngl(G2frame,newPlot=True,Data=controls,hklRef=refList,Title=phaseName)
    2627        
    26282627    if G2frame.dataDisplay:
    26292628        G2frame.dataFrame.Clear()
    26302629    Inst = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId, 'Instrument Parameters'))[0]
     2630    if phaseName:
     2631        pId = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,'Phases')
     2632        phaseId =  G2gd.GetPatternTreeItemId(G2frame,pId,phaseName)
     2633        General = G2frame.PatternTree.GetItemPyData(phaseId)['General']
     2634        Super = General.get('Super',0)
     2635        SuperVec = General.get('SuperVec',[])
     2636    else:
     2637        Super = 0
     2638        SuperVec = []       
    26312639    rowLabels = []
    26322640    if HKLF:
    26332641        G2gd.SetDataMenuBar(G2frame)
    2634         refs = data[1]['RefList']
    2635         Super = data[1].get('Super',0)
     2642        refList = data[1]['RefList']
     2643        G2gd.SetDataMenuBar(G2frame,G2frame.dataFrame.ReflMenu)
     2644        if not G2frame.dataFrame.GetStatusBar():
     2645            Status = G2frame.dataFrame.CreateStatusBar()   
     2646        G2frame.Bind(wx.EVT_MENU, OnPlotHKL, id=G2gd.wxID_PWDHKLPLOT)
     2647        G2frame.Bind(wx.EVT_MENU, OnPlot3DHKL, id=G2gd.wxID_PWD3DHKLPLOT)
     2648        G2frame.dataFrame.SelectPhase.Enable(False)
     2649        refs = refList
    26362650    else:
    2637         Super = 0   #for now       
    26382651        G2gd.SetDataMenuBar(G2frame,G2frame.dataFrame.ReflMenu)
    26392652        if not G2frame.dataFrame.GetStatusBar():
     
    26472660        try:            #patch for old reflection lists
    26482661            refList = np.array(data[G2frame.RefList]['RefList'])
    2649             I100 = refList.T[8]*refList.T[11]
     2662            I100 = refList.T[8+Super]*refList.T[11+Super]
    26502663        except TypeError:
    2651             refList = np.array([refl[:11] for refl in data[G2frame.RefList]])
    2652             I100 = refList.T[8]*np.array([refl[11] for refl in data[G2frame.RefList]])
     2664            refList = np.array([refl[:11+Super] for refl in data[G2frame.RefList]])
     2665            I100 = refList.T[8+Super]*np.array([refl[11+Super] for refl in data[G2frame.RefList]])
    26532666        Imax = np.max(I100)
    26542667        if Imax:
    26552668            I100 *= 100.0/Imax
    26562669        if 'C' in Inst['Type'][0]:
    2657             refs = np.vstack((refList.T[:15],I100)).T
     2670            refs = np.vstack((refList.T[:15+Super],I100)).T
    26582671        elif 'T' in Inst['Type'][0]:
    2659             refs = np.vstack((refList.T[:18],I100)).T
     2672            refs = np.vstack((refList.T[:18+Super],I100)).T
    26602673           
    26612674    for i in range(len(refs)): rowLabels.append(str(i))
     
    26792692            colLabels = ['H','K','L','mul','d','pos','sig','gam','Fosq','Fcsq','phase','Icorr','alp','bet','wave','Prfo','Abs','Ext','I100']
    26802693            Types += 7*[wg.GRID_VALUE_FLOAT+':10,3',]
     2694        if Super:
     2695            for i in range(Super):
     2696                colLabels.insert(3+i,superLabels[i])
    26812697           
    26822698    G2frame.PeakTable = G2gd.Table(refs,rowLabels=rowLabels,colLabels=colLabels,types=Types)
Note: See TracChangeset for help on using the changeset viewer.