Changeset 3231


Ignore:
Timestamp:
Jan 18, 2018 11:08:54 AM (4 years ago)
Author:
vondreele
Message:

fix bug in IndexPeaks? display
fix import pypowder issue in G2math
fix ssSpaceGroup call in G2obj
add a dmax to Pawley controls; eliminate reflections with d>dmax (useful for TOF)
change reflist to be sorted as found in tree; used for Fourier, Charge flip & MCSA controls
add a buttonHandler to PlotXYZ to retrieve cursor position on generic 2D plots
use buttonHandler to get 2D modulation vector from plot & try it for indexing
fix a TOF modulation bug in getPowderProfile

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIindex.py

    r3227 r3231  
    305305    values = []
    306306    ranges = []
    307     dT = 0.005       #seems to be a good choice
     307    dT = 0.01       #seems to be a good choice
    308308    for v,r in zip(ssopt['ModVec'],Vref):
    309309        if r:
     
    390390            hkl = HKL[pos]                                 # put in hkl
    391391            if hkl[-1] >= 0:                                 # peak already assigned - test if this one better
    392                 opeak = Peaks[hkl[-1]]
     392                opeak = Peaks[int(hkl[-1])]
    393393                dold = abs(opeak[-2]-hkl[4])
    394394                dnew = min(dm,dp)
     
    581581    result = so.leastsq(errFitZSS,values,Dfun=dervFitZSS,full_output=True,ftol=1.e-6,
    582582        args=(ibrav,Peaks[8],Peaks[4:8],Peaks[0],wave,V,Vref,Z,Zref))
     583    print(result)
    583584    A = Values2A(ibrav,result[0])
    584585    Vec = Values2Vec(ibrav,V,Vref,result[0])
     
    675676    if Zref:
    676677        values.append(Z)
     678    print(values)
    677679    result = so.leastsq(errFitTSS,values,Dfun=dervFitTSS,full_output=True,ftol=0.0001,
    678680        args=(ibrav,Peaks[8],Peaks[4:8],Peaks[0],difC,V,Vref,Z,Zref))
     681    print(result)
    679682    A = Values2A(ibrav,result[0])
    680683    Vec = Values2Vec(ibrav,V,Vref,result[0])
  • trunk/GSASIImath.py

    r3219 r3231  
    3232import scipy.optimize as so
    3333try:
    34     import pypowder as pyd
     34    import pypowder as pwd
    3535except ImportError:
    3636    print ('pypowder is not available - profile calcs. not allowed')
  • trunk/GSASIIobj.py

    r3187 r3231  
    10951095    if Super and Super.get('Use',False):
    10961096        phaseData['General'].update({'Modulated':True,'Super':True,'SuperSg':Super['ssSymb']})
    1097         phaseData['General']['SSGData'] = G2spc.SSpcGroup(SGData,Super['ssSymb'])
     1097        phaseData['General']['SSGData'] = G2spc.SSpcGroup(SGData,Super['ssSymb'])[1]
    10981098        phaseData['General']['SuperVec'] = [Super['ModVec'],False,Super['maxH']]
    10991099
  • trunk/GSASIIphsGUI.py

    r3222 r3231  
    11431143        if 'Pawley dmin' not in generalData:
    11441144            generalData['Pawley dmin'] = 1.0
     1145        if 'Pawley dmax' not in generalData:
     1146            generalData['Pawley dmax'] = 100.0
    11451147        if 'Pawley neg wt' not in generalData:
    11461148            generalData['Pawley neg wt'] = 0.0
     
    19131915            pawleySizer.Add(pawlRef,0,WACV)
    19141916            pawleySizer.Add(wx.StaticText(General,label=' Pawley dmin: '),0,WACV)
    1915             pawlVal = G2G.ValidatedTxtCtrl(General,generalData,'Pawley dmin',
     1917            pawlMin = G2G.ValidatedTxtCtrl(General,generalData,'Pawley dmin',size=(65,25),
    19161918                min=0.25,max=20.,nDig=(10,5))
    1917             pawleySizer.Add(pawlVal,0,WACV)
     1919            pawleySizer.Add(pawlMin,0,WACV)
     1920            pawleySizer.Add(wx.StaticText(General,label=' Pawley dmax: '),0,WACV)
     1921            pawlMax = G2G.ValidatedTxtCtrl(General,generalData,'Pawley dmax',size=(65,25),
     1922                min=2.0,max=100.,nDig=(10,5))
     1923            pawleySizer.Add(pawlMax,0,WACV)
    19181924            pawleySizer.Add(wx.StaticText(General,label=' Pawley neg. wt.: '),0,WACV)
    1919             pawlNegWt = G2G.ValidatedTxtCtrl(General,generalData,'Pawley neg wt',
     1925            pawlNegWt = G2G.ValidatedTxtCtrl(General,generalData,'Pawley neg wt',size=(65,25),
    19201926                min=0.,max=1.,nDig=(10,4))
    19211927            pawleySizer.Add(pawlNegWt,0,WACV)
     
    19501956                Map['cutOff'] = 100.0
    19511957            mapTypes = ['Fobs','Fcalc','delt-F','2*Fo-Fc','Omit','2Fo-Fc Omit','Patterson']
    1952             refsList = list(data['Histograms'].keys())
     1958            refsList = [item for item in G2gd.GetGPXtreeDataNames(G2frame,['HKLF','PWDR']) if item in data['Histograms'].keys()]
    19531959            if not generalData['AtomTypes']:
    19541960                 mapTypes = ['Patterson',]
     
    20192025                Obj.SetValue('%3d %3d %3d'%(HKL[0],HKL[1],HKL[2]))
    20202026
    2021             refsList = list(data['Histograms'].keys())
     2027            refsList = [item for item in G2gd.GetGPXtreeDataNames(G2frame,['HKLF','PWDR']) if item in data['Histograms'].keys()]
    20222028            flipSizer = wx.BoxSizer(wx.VERTICAL)
    20232029            lineSizer = wx.BoxSizer(wx.HORIZONTAL)
     
    21122118            refList = []
    21132119            if len(data['Pawley ref']):
    2114                 refList = ['Pawley reflections']
    2115             for item in data['Histograms'].keys():
    2116                 if 'HKLF' in item or 'PWDR' in item:
    2117                     refList.append(item)
     2120                refList = ['Pawley reflections',]
     2121            refList += [item for item in G2gd.GetGPXtreeDataNames(G2frame,['HKLF','PWDR']) if item in data['Histograms'].keys()]
    21182122            mcsaSizer = wx.BoxSizer(wx.VERTICAL)
    21192123            lineSizer = wx.BoxSizer(wx.HORIZONTAL)
     
    22012205            mainSizer.Add(ElemSizer())
    22022206        G2G.HorizontalLine(mainSizer,General)
    2203        
     2207#patches       
     2208        if 'Pawley dmax' not in generalData:
     2209            generalData['Pawley dmax'] = 100.0
    22042210        if 'SGFixed' not in generalData['SGData']:
    22052211            generalData['SGData']['SGFixed'] = False
    22062212        if 'SGGray' not in generalData['SGData']:
    22072213            generalData['SGData']['SGGray'] = False
    2208        
     2214#end patches       
    22092215        if generalData['Type'] == 'magnetic':
    22102216            if not generalData['SGData']['SGFixed']:
     
    81728178        SGData = generalData['SGData']
    81738179        dmin = generalData['Pawley dmin']
     8180        dmax = generalData['Pawley dmax']
    81748181        for hist in histograms:
    81758182            if 'PWDR' in hist[:4]:
     
    81928199                HKLd = G2lat.GenSSHLaue(dmin,SGData,SSGData,Vec,maxH,A)
    81938200                for h,k,l,m,d in HKLd:
     8201                    if d > dmax:
     8202                        continue
    81948203                    ext,mul = G2spc.GenHKLf([h,k,l],SGData)[:2]
    81958204                    if m or not ext:
     
    82038212            try:
    82048213                for h,k,l,d in HKLd:
     8214                    if d > dmax:
     8215                        continue
    82058216                    ext,mul = G2spc.GenHKLf([h,k,l],SGData)[:2]
    82068217                    if not ext:
  • trunk/GSASIIplot.py

    r3219 r3231  
    31023102################################################################################
    31033103           
    3104 def PlotXYZ(G2frame,XY,Z,labelX='X',labelY='Y',newPlot=False,Title='',zrange=None,color=None):
     3104def PlotXYZ(G2frame,XY,Z,labelX='X',labelY='Y',newPlot=False,Title='',zrange=None,color=None,buttonHandler=None):
    31053105    '''simple contour plot of xyz data
    31063106   
     
    31653165                    G2frame.G2plotNB.status.SetStatusText('Select '+Title+' pattern first',1)
    31663166                   
     3167    def OnPress(event):
     3168        if Page.toolbar._active:    # prevent ops. if a toolbar zoom button pressed
     3169            return
     3170        xpos,ypos = event.xdata,event.ydata
     3171        if xpos and buttonHandler:
     3172            buttonHandler(xpos,ypos)
     3173                   
    31673174    new,plotNum,Page,Plot,lim = G2frame.G2plotNB.FindPlotTab(Title,'mpl')
    31683175    if not new:
     
    31733180        Page.canvas.mpl_connect('motion_notify_event', OnMotion)
    31743181        Page.canvas.mpl_connect('key_press_event', OnKeyPress)
     3182        Page.canvas.mpl_connect('button_press_event',OnPress)
    31753183   
    31763184    Page.Choice = (' key press','d: lower contour max','u: raise contour max','o: reset contour max',
  • trunk/GSASIIpwd.py

    r3164 r3231  
    10571057                    if G2spc.checkSSextc(HKLM,SSGData):
    10581058                        HKLs.append([h,k,l,dH,d,G2lat.Dsp2pos(Inst,d),-1])   
    1059 #    GSASIIpath.IPyBreak()
    10601059    return G2lat.sortHKLd(HKLs,True,True,True)
    10611060
  • trunk/GSASIIpwdGUI.py

    r3228 r3231  
    27782778        OnHklShow(event)
    27792779       
     2780    def OnButton(xpos,ypos):
     2781        modSym = ssopt['ssSymb'].split(')')[0]+')'
     2782        if modSym in ['(a0g)','(a1/2g)']:
     2783            ssopt['ModVec'][0] = xpos
     2784            ssopt['ModVec'][2] = ypos
     2785        elif modSym in ['(0bg)','(1/2bg)']:
     2786            ssopt['ModVec'][1] = xpos
     2787            ssopt['ModVec'][2] = ypos
     2788        elif modSym in ['(ab0)','(ab1/2)']:
     2789            ssopt['ModVec'][0] = xpos
     2790            ssopt['ModVec'][1] = ypos
     2791        vec = ssopt['ModVec']
     2792        print(' Trying: %s %s modulation vector = %.3f %.3f %.3f'%(controls[13],ssopt['ssSymb'],vec[0],vec[1],vec[2]))
     2793        OnHklShow(None)
     2794        wx.CallAfter(UpdateUnitCellsGrid,G2frame,data)
     2795       
    27802796    def OnFindOneMV(event):
    27812797        Peaks = np.copy(peaks[0])
     
    27872803            if len(result[0]) == 2:
    27882804                G2plt.PlotXYZ(G2frame,result[2],1./result[3],labelX='a',labelY='g',
    2789                     newPlot=True,Title='Modulation vector search')
     2805                    newPlot=True,Title='Modulation vector search',buttonHandler=OnButton)
    27902806        finally:
    27912807            dlg.Destroy()
     
    33263342        SGData = G2spc.SpcGroup(SpSg)[1]
    33273343        laue = SGData['SGLaue']
    3328         if laue in ['2/m','mmm']:
     3344        if laue in ['mmm']:
    33293345            SSChoice = []
    33303346            for ax in laueSS[laue]:
  • trunk/GSASIIstrMath.py

    r3224 r3231  
    32053205        elif 'T' in calcControls[hfx+'histType']:
    32063206            for iref,refl in enumerate(refDict['RefList']):
    3207                 h,k,l = refl[:3]
     3207                if im:
     3208                    h,k,l,m = refl[:4]
     3209                else:
     3210                    h,k,l = refl[:3]
    32083211                Uniq = np.inner(refl[:3],SGMT)
    32093212                refl[5+im] = GetReflPos(refl,im,0.0,A,pfx,hfx,calcControls,parmDict)         #corrected reflection position - #TODO - what about tabluated offset?
Note: See TracChangeset for help on using the changeset viewer.