Changeset 5362


Ignore:
Timestamp:
Nov 3, 2022 8:16:02 PM (11 months ago)
Author:
toby
Message:

Laue Fringe bug fixes

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIdataGUI.py

    r5342 r5362  
    65446544            'Make new phase from selected unit cell')
    65456545        self.ExportCells = self.IndexEdit.Append(G2G.wxID_EXPORTCELLS,'Export cell list','Export cell list to csv file')
     6546        G2G.Define_wxId('wxID_SHOWGENHKLS')
     6547        self.IndexEdit.Append(G2G.wxID_SHOWGENHKLS,'Show reflections','Show generated reflection positions on console')
    65466548        self.PostfillDataMenu()
    65476549        self.LoadCell.Enable(False)
  • trunk/GSASIIpwd.py

    r5361 r5362  
    21272127def getHeaderInfo(dataType):
    21282128    '''Provide parameter name, label name and formatting information for the
    2129     contents of the peak table and where used in DoPeakFit
     2129    contents of the Peak Table and where used in DoPeakFit
    21302130    '''
    21312131    names = ['pos','int']
    21322132    lnames = ['position','intensity']
    21332133    if 'LF' in dataType:
    2134         names = ['int','sig','gam','damp','asym','l']
    2135         lnames = ['intensity','sigma','gamma','satellite\ndamping','satellite\nasym','00l']
    2136         fmt = ["%10.2f","%10.3f","%10.3f","%10.3f","%10.3f","%4d"]
     2134        names = ['int','sig','gam','damp','asym','l','ttheta']
     2135        lnames = ['intensity','sigma','gamma','satellite\ndamping',
     2136                      'satellite\nasym','00l',
     2137                      #'2theta    '
     2138                      '2\u03B8'
     2139                      ]
     2140        fmt = ["%10.2f","%10.3f","%10.3f","%10.3f","%10.3f","%4d","%7.3f"]
    21372141    elif 'C' in dataType:
    21382142        names += ['sig','gam']
     
    23462350        peakVary = []
    23472351        names,_,_ = getHeaderInfo(dataType)
    2348         off = 0
    2349         if 'LF' in dataType: off = 2
     2352        if 'LF' in dataType:
     2353            off = 2
     2354            names = names[:-1] # drop 2nd 2theta value
     2355        else:
     2356            off = 0
    23502357        for i,peak in enumerate(Peaks):
    23512358            if type(peak) is dict:
     
    23632370        the parmDict array
    23642371        '''
     2372        names,_,_ = getHeaderInfo(Inst['Type'][0])
    23652373        off = 0
    23662374        if 'LF' in Inst['Type'][0]:
     
    23682376            if 'clat' in varyList:
    23692377                Peaks[-1]['clat'] = parmDict['clat']
    2370         names,_,_ = getHeaderInfo(Inst['Type'][0])
     2378            names = names[:-1] # drop 2nd 2theta value
    23712379        for i,peak in enumerate(Peaks):
    23722380            if type(peak) is dict:
     
    23782386            if 'pos'+str(i) not in parmDict: continue
    23792387            pos = parmDict['pos'+str(i)]
    2380             if 'LF' in Inst['Type'][0]: peak[0] = pos
     2388            if 'LF' in Inst['Type'][0]:
     2389                peak[0] = pos
     2390                peak[-1] = pos
    23812391            if 'difC' in Inst:
    23822392                dsp = pos/Inst['difC'][1]
     
    24142424        head = 13*' '
    24152425        for name in names:
    2416             if name in ['alp','bet']:
     2426            if name == 'l':
     2427                head += name.center(3)+'    '
     2428            elif name == 'ttheta':
     2429                continue
     2430            elif name in ['alp','bet']:
    24172431                head += name.center(8)+'esd'.center(8)
    24182432            else:
     
    24282442                name = names[j]
    24292443                parName = name+str(i)
     2444                if parName not in parmDict: continue
    24302445                ptstr += ptfmt[name] % (parmDict[parName])
    24312446                if parName in varyList:
     
    53235338        w[len(w)//2:] = w2[len(w)//2:]
    53245339        weqdiv = w * np.sin(Qs * ncell * co2)**2 / (np.sin(Qs * co2)**2)
     5340        weqdiv[:np.searchsorted(Qs,posQ - np.pi/self.param_dicts[me]['clat'])] = 0  # isolate central peak, if needed
     5341        weqdiv[np.searchsorted(Qs,posQ + np.pi/self.param_dicts[me]['clat']):] = 0
    53255342        conv = FP.best_rfft(weqdiv)
    53265343        conv[1::2] *= -1 #flip center
  • trunk/GSASIIpwdGUI.py

    r5360 r5362  
    11221122            for i in range(len(data['LFpeaks'])):
    11231123                data['peaks'][i][2:] = data['LFpeaks'][i]
     1124            wx.CallAfter(UpdatePeakGrid,G2frame,data)
    11241125        if data['peaks']:
    11251126            OnPeakFit(noFit=True)
     
    11311132        state = G2frame.dataWindow.setPeakMode.IsChecked()
    11321133        G2pwd.setPeakInstPrmMode(state)
     1134
     1135    def ShiftLFc(event):
     1136        '''Shift the Laue Fringe lattice parameter
     1137        '''
     1138        Obj = event.GetEventObject()
     1139        move = Obj.GetValue()
     1140        Obj.SetValue(0)
     1141        data['LaueFringe']['clat'] *= 1. + move/2000.
     1142        wx.CallAfter(RefreshPeakGrid,None)
    11331143
    11341144    #======================================================================
     
    11661176    PatternId = G2frame.PatternId
    11671177    Inst = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,PatternId, 'Instrument Parameters'))[0]
     1178    # Create the header on the Peak Table
    11681179    for i in range(len(data['peaks'])): rowLabels.append(str(i+1))
    11691180    colLabels = []
     
    11711182    for _,f,l in zip(*G2pwd.getHeaderInfo(Inst['Type'][0])):
    11721183        colLabels.append(l)
    1173         if "d" in f:
     1184        if l.startswith('2'):
     1185            Types.append(wg.GRID_VALUE_FLOAT + ':7,3')
     1186        elif "d" in f:
    11741187            Types.append(wg.GRID_VALUE_NUMBER)
    11751188        else:
     
    12101223                    data['peaks'][i][0] = 360 * np.arcsin(0.5 * lam / (data['LaueFringe']['clat']/l)) / np.pi
    12111224                data['peaks'][i] += [0., False, 0., False, l, None]
    1212             data['LFpeaks'].append(data['peaks'][i][2:])
     1225            peakline = copy.deepcopy(data['peaks'][i][2:])
     1226            peakline[-1] = data['peaks'][i][0]
     1227            data['LFpeaks'].append(peakline)
    12131228        G2frame.PeakTable = G2G.Table(data['LFpeaks'],rowLabels=rowLabels,colLabels=colLabels,types=Types)
    12141229    else:
     
    12411256        data['LaueFringe']['Show'] =  data['LaueFringe'].get('Show',0)
    12421257        cVal = G2G.ValidatedTxtCtrl(G2frame.dataWindow,data['LaueFringe'],'clat',
    1243                                     typeHint=float,nDig=(10,4),
     1258                                    typeHint=float,nDig=(10,4),size=(80,-1),
    12441259                                    OnLeave=lambda *arg,**kw:RefreshPeakGrid(None))
    12451260        topSizer.Add(cVal,0,WACV)
     1261        cellSpin = wx.SpinButton(G2frame.dataWindow,style=wx.SP_VERTICAL,size=wx.Size(20,20))
     1262        cellSpin.SetValue(0)
     1263        cellSpin.SetRange(-1,1)
     1264        cellSpin.Bind(wx.EVT_SPIN, ShiftLFc)
     1265        topSizer.Add(cellSpin,0,WACV)
    12461266        cRef = G2G.G2CheckBox(G2frame.dataWindow,'ref',data['LaueFringe'],'clat-ref')
    12471267        topSizer.Add(cRef,0,WACV)
     
    36393659        finally:
    36403660            dlg.Destroy()
    3641        
     3661
     3662    def OnShowGenRefls(event):
     3663        '''Generate the reflections from the unit cell and
     3664        display them in the console window
     3665        '''
     3666        OnHklShow(None)
     3667        for r in G2frame.HKL:
     3668            print("{0:.0f},{1:.0f},{2:.0f}   2\u03B8={4:7.3f} d={3:8.4f}".format(*r))
     3669   
    36423670    def OnCellChange(invalid,value,tc):
    36433671        if invalid:
     
    46024630    G2frame.Bind(wx.EVT_MENU, MakeNewPhase, id=G2G.wxID_MAKENEWPHASE)
    46034631    G2frame.Bind(wx.EVT_MENU, OnExportCells, id=G2G.wxID_EXPORTCELLS)
     4632    G2frame.Bind(wx.EVT_MENU, OnShowGenRefls, id=G2G.wxID_SHOWGENHKLS)
    46044633       
    46054634    if len(data) < 6:
  • trunk/docs/source/packages.rst

    r5360 r5362  
    141141
    142142  **DIFFaX**
    143     Simulate layered structures with faulting
    144    
    145   **CifFile**
    146     A software library used to read data and structures from CIF
     143    Simulate layered structures with faulting. https://www.public.asu.edu/~mtreacy/DIFFaX.html
     144   
     145  **PyCifRW**
     146    A software library used to read data and structures from
     147    CIF. https://bitbucket.org/jamesrhester/pycifrw
     148   
    147149   
    148150  **Shapes**
    149     Model small angle scattering with shaped particles
     151    Model small angle scattering with shaped particles.
    150152   
    151153  **NIST FPA**
Note: See TracChangeset for help on using the changeset viewer.