Changeset 2754


Ignore:
Timestamp:
Mar 14, 2017 10:19:59 AM (6 years ago)
Author:
vondreele
Message:

fix "off-by-one" problem in powder profiles; calc missed last point - now fixed.
add import of reflectometry data - same as small angle data
implement plotting of reflectometry data & all the scale options
set up the Model page for reflectometry (Layers is missing)

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r2753 r2754  
    381381        :class:`GSASIIIO.ImportStructFactor`,
    382382        :class:`GSASIIIO.ImportPowderData`,
    383         :class:`GSASIIIO.ImportSmallAngleData` or
     383        :class:`GSASIIIO.ImportSmallAngleData`
     384        :class:`GSASIIIO.ImportReflectometryData` or
    384385        :class:`GSASIIIO.ImportImage`.
    385386        If a specific reader is specified, only that method will be called,
     
    19451946                'Dummy':False,
    19461947                'ranId':ran.randint(0,sys.maxint),
     1948                'Offset':[0.0,0.0],
    19471949                }
    19481950            rd.Sample['ranId'] = valuesdict['ranId'] # this should be removed someday
     
    20592061                'Dummy':False,
    20602062                'ranId':ran.randint(0,sys.maxint),
     2063                'Offset':[0.0,0.0],
    20612064                }
    20622065            rd.Sample['ranId'] = valuesdict['ranId'] # this should be removed someday
     
    25012504        self.undofile = ''
    25022505        self.TreeItemDelete = False
    2503         self.plotStyle = {'qPlot':False,'dPlot':False,'sqrtPlot':False}
     2506        self.plotStyle = {'qPlot':False,'dPlot':False,'sqrtPlot':False,'sqPlot':False}
    25042507        self.Weight = False
    25052508        self.IfPlot = False
     
    25232526        self.logPlot = False
    25242527        self.plusPlot = True
    2525         self.sqPlot = False
    25262528        self.ErrorBars = False
    25272529        self.Contour = False
  • trunk/GSASIIIO.py

    r2721 r2754  
    17501750
    17511751######################################################################
     1752class ImportReflectometryData(ImportBaseclass):
     1753    '''Defines a base class for the reading of files with small angle data.
     1754    See :ref:`Writing a Import Routine<Import_Routines>`
     1755    for an explanation on how to use this class.
     1756    '''
     1757    def __init__(self,formatName,longFormatName=None,extensionlist=[],
     1758        strictExtension=False,):
     1759           
     1760        ImportBaseclass.__init__(self,formatName,longFormatName,extensionlist,
     1761            strictExtension)
     1762        self.ReInitialize()
     1763       
     1764    def ReInitialize(self):
     1765        'Reinitialize the Reader to initial settings'
     1766        ImportBaseclass.ReInitialize(self)
     1767        self.reflectometryentry = ['',None,None] #  (filename,Pos,Bank)
     1768        self.reflectometrydata = [] # SASD dataset
     1769        '''A small angle data set is a list with items [x,y,w,yc,yd]:
     1770                np.array(x), # x-axis values
     1771                np.array(y), # powder pattern intensities
     1772                np.array(w), # 1/sig(intensity)^2 values (weights)
     1773                np.array(yc), # calc. intensities (zero)
     1774                np.array(yd), # obs-calc profiles
     1775                np.array(yb), # preset bkg
     1776        '''                           
     1777        self.comments = []
     1778        self.idstring = ''
     1779        self.Sample = G2pdG.SetDefaultSample()
     1780        self.GSAS = None     # used in TOF
     1781        self.clockWd = None  # used in TOF
     1782        self.numbanks = 1
     1783        self.instdict = {} # place items here that will be transferred to the instrument parameters
     1784
     1785######################################################################
    17521786class ImportImage(ImportBaseclass):
    17531787    '''Defines a base class for the reading of images
  • trunk/GSASIIgrid.py

    r2747 r2754  
    44544454    if G2frame.dataDisplay:
    44554455        G2frame.dataDisplay.Destroy()
    4456     if kind in ['PWDR','SASD']:
     4456    if kind in ['PWDR','SASD','REFD']:
    44574457        SetDataMenuBar(G2frame,G2frame.dataFrame.PWDRMenu)
    44584458        G2frame.dataFrame.Bind(wx.EVT_MENU, OnErrorAnalysis, id=wxID_PWDANALYSIS)
     
    45324532    G2frame.PatternTree.SetItemPyData(item,data)
    45334533    G2frame.PatternId = item
    4534     if kind in ['PWDR','SASD']:
     4534    if kind in ['PWDR','SASD','REFD',]:
    45354535        NewPlot = True
    45364536        if 'xylim' in dir(G2frame):
     
    47444744            if G2frame.EnablePlot:
    47454745                UpdatePWHKPlot(G2frame,'SASD',item)
     4746        elif G2frame.PatternTree.GetItemText(item).startswith('REFD '):
     4747            G2frame.PatternId = item
     4748            #for i in G2frame.ExportPattern: i.Enable(True)
     4749            if G2frame.EnablePlot:
     4750                UpdatePWHKPlot(G2frame,'REFD',item)
    47464751        elif G2frame.PatternTree.GetItemText(item).startswith('HKLF '):
    47474752            G2frame.Sngl = True
     
    48434848        G2frame.PatternId = G2frame.PatternTree.GetItemParent(item)
    48444849        data = G2frame.PatternTree.GetItemPyData(item)
    4845         G2pdG.UpdateModelsGrid(G2frame,data)
    4846         G2plt.PlotPatterns(G2frame,plotType='SASD')
    4847         if len(data['Size']['Distribution']):
     4850        if prfx1 == 'SASD':
     4851            G2pdG.UpdateModelsGrid(G2frame,data)
     4852        elif prfx1 == 'REFD':
     4853            G2pdG.UpdateREFDModelsGrid(G2frame,data)
     4854        G2plt.PlotPatterns(G2frame,plotType=prfx1)
     4855        if prfx1 == 'SASD' and len(data['Size']['Distribution']):
    48484856            G2plt.PlotSASDSizeDist(G2frame)
    48494857    elif G2frame.PatternTree.GetItemText(item) == 'Substances':
  • trunk/GSASIIplot.py

    r2740 r2754  
    12191219#patch
    12201220    data = G2frame.PatternTree.GetItemPyData(G2frame.PatternId)
    1221     if 'Offset' not in data[0] and plotType in ['PWDR','SASD']:     #plot offset data
     1221    if 'Offset' not in data[0] and plotType in ['PWDR','SASD','REFD']:     #plot offset data
    12221222        Ymax = max(data[1][1])
    12231223        data[0].update({'Offset':[0.0,0.0],'delOffset':0.02*Ymax,'refOffset':-0.1*Ymax,
     
    12371237                G2frame.SinglePlot = True
    12381238            newPlot = True
    1239         elif event.key == 'e' and 'SASD' in plottype:
     1239        elif event.key == 'e' and plottype in ['SASD','REFD']:
    12401240            G2frame.ErrorBars = not G2frame.ErrorBars
    12411241        elif event.key == 'b':
     
    13041304                G2frame.plotStyle['qPlot'] = not G2frame.plotStyle['qPlot']
    13051305                G2frame.plotStyle['dPlot'] = False
    1306             elif 'SASD' in plottype:
     1306            elif plottype in ['SASD','REFD']:
    13071307                newPlot = True
    13081308                G2frame.plotStyle['sqPlot'] = not G2frame.plotStyle['sqPlot']
     
    13641364                    except ValueError:      #avoid bad value in asin beyond upper limit
    13651365                        pass
    1366                 elif 'SASD' in plottype:
     1366                elif plottype in ['SASD','REFD']:
    13671367                    q = xpos
    13681368                    dsp = 2.*np.pi/q
     
    13901390                            else:
    13911391                                G2frame.G2plotNB.status.SetStatusText('2-theta =%9.3f d =%9.5f q = %9.5f Intensity =%9.2f'%(xpos,dsp,q,ypos),1)
    1392                         elif 'SASD' in plottype:
     1392                        elif plottype == 'SASD':
    13931393                            G2frame.G2plotNB.status.SetStatusText('q =%12.5g Intensity =%12.5g d =%9.1f'%(q,ypos,dsp),1)
     1394                        elif plottype == 'REFD':
     1395                            G2frame.G2plotNB.status.SetStatusText('q =%12.5g Reflectivity =%12.5g d =%9.1f'%(q,ypos,dsp),1)
    13941396                    else:
    13951397                        if G2frame.plotStyle['sqrtPlot']:
     
    18081810        G2frame.xylim = limits
    18091811    else:
    1810         if plottype == 'SASD':
     1812        if plottype in ['SASD','REFD']:
    18111813            G2frame.logPlot = True
    18121814            G2frame.ErrorBars = True
     
    18551857                        'c: contour on','q: toggle q plot','t: toggle d-spacing plot','f: select data',
    18561858                        'm: toggle multidata plot','w: toggle divide by sig','+: toggle selection')
    1857             elif 'SASD' in plottype:
     1859            elif plottype in ['SASD','REFD']:
    18581860                if G2frame.SinglePlot:
    18591861                    Page.Choice = (' key press','b: toggle subtract background file','n: semilog on',
     
    18751877                        'q: toggle q plot','t: toggle d-spacing plot','m: toggle multidata plot','f: select data',
    18761878                        'w: toggle divide by sig','+: no selection')
    1877             elif 'SASD' in plottype:
     1879            elif plottype in ['SASD','REFD']:
    18781880                if G2frame.SinglePlot:
    18791881                    Page.Choice = (' key press','b: toggle subtract background file','n: loglog on','e: toggle error bars',
     
    19351937        Title = 'log('+Title+')'
    19361938    Plot.set_title(Title)
    1937     if G2frame.plotStyle['qPlot'] or 'SASD' in plottype and not G2frame.Contour:
     1939    if G2frame.plotStyle['qPlot'] or plottype in ['SASD','REFD'] and not G2frame.Contour:
    19381940        Plot.set_xlabel(r'$Q, \AA^{-1}$',fontsize=16)
    19391941    elif G2frame.plotStyle['dPlot'] and 'PWDR' in plottype and not G2frame.Contour:
     
    19501952        if 'PWDR' in plottype:
    19511953            Plot.set_ylabel(r'$\mathsf{I/\sigma(I)}$',fontsize=16)
    1952         elif 'SASD' in plottype:
     1954        elif plottype in ['SASD','REFD']:
    19531955            Plot.set_ylabel(r'$\mathsf{\Delta(I)/\sigma(I)}$',fontsize=16)
    19541956    else:
     
    19591961                else:
    19601962                    Plot.set_ylabel(r'$Intensity$',fontsize=16)
    1961             elif 'SASD' in plottype:
    1962                 if G2frame.sqPlot:
     1963            elif plottype == 'SASD':
     1964                if G2frame.plotStyle['sqPlot']:
    19631965                    Plot.set_ylabel(r'$S(Q)=I*Q^{4}$',fontsize=16)
    19641966                else:
    19651967                    Plot.set_ylabel(r'$Intensity,\ cm^{-1}$',fontsize=16)
    1966         else:
     1968            elif plottype == 'REFD':
     1969                if G2frame.plotStyle['sqPlot']:
     1970                    Plot.set_ylabel(r'$S(Q)=R*Q^{4}$',fontsize=16)
     1971                else:
     1972                    Plot.set_ylabel(r'$Reflectivity$',fontsize=16)               
     1973        else:       #neutron TOF
    19671974            if G2frame.plotStyle['sqrtPlot']:
    19681975                Plot.set_ylabel(r'$\sqrt{Normalized\ intensity}$',fontsize=16)
     
    20022009            else:
    20032010                Y = xye[1]+offsetY*N*Ymax/100.0
    2004         elif 'SASD' in plottype:
     2011        elif plottype in ['SASD','REFD']:
    20052012            B = xye[5]
    2006             if G2frame.sqPlot:
     2013            if G2frame.plotStyle['sqPlot']:
    20072014                Y = xye[1]*Sample['Scale'][0]*(1.05)**(offsetY*N)*X**4
    20082015            else:
     
    20362043            else:
    20372044                pP = ''
    2038             if 'SASD' in plottype and G2frame.logPlot:
     2045            if plottype in ['SASD','REFD'] and G2frame.logPlot:
    20392046                X *= (1.01)**(offsetX*N)
    20402047            else:
     
    20592066                        W = xye[4]+offsetY*N*Ymax/100.0
    20602067                        D = xye[5]-Pattern[0]['delOffset']  #powder background
    2061                 elif 'SASD' in plottype:
    2062                     if G2frame.sqPlot:
     2068                elif plottype in ['SASD','REFD']:
     2069                    if G2frame.plotStyle['sqPlot']:
    20632070                        W = xye[4]*X**4
    20642071                        Z = xye[3]*X**4
     
    20832090                        Plot.plot(X,Z,colors[(N+1)%6],picker=False)
    20842091                        Plot.plot(X,W,colors[(N+2)%6],picker=False)     #background
    2085                     elif 'SASD' in plottype:
     2092                    elif plottype in ['SASD','REFD']:
    20862093                        Plot.set_xscale("log",nonposx='mask')
    20872094                        Ibeg = np.searchsorted(X,limits[1][0])
     
    20962103                            Plot.set_yscale("log",nonposy='mask')
    20972104                            if G2frame.ErrorBars:
    2098                                 if G2frame.sqPlot:
     2105                                if G2frame.plotStyle['sqPlot']:
    20992106                                    Plot.errorbar(X,YB,yerr=X**4*Sample['Scale'][0]*np.sqrt(1./(Pattern[0]['wtFactor']*xye[2])),
    21002107                                        ecolor=colors[N%6],picker=3.,clip_on=Clip_on)
     
    21662173                    if 'PWDR' in plottype:
    21672174                        Plot.semilogy(X,Y,colors[N%6],picker=False,nonposy='mask')
    2168                     elif 'SASD' in plottype:
     2175                    elif plottype in ['SASD','REFD']:
    21692176                        Plot.semilogy(X,Y,colors[N%6],picker=False,nonposy='mask')
    21702177                else:
    21712178                    if 'PWDR' in plottype:
    21722179                        Plot.plot(X,Y,colors[N%6],picker=False)
    2173                     elif 'SASD' in plottype:
     2180                    elif plottype in ['SASD','REFD']:
    21742181                        Plot.loglog(X,Y,colors[N%6],picker=False,nonposy='mask')
    21752182                        Plot.set_ylim(bottom=np.min(np.trim_zeros(Y))/2.,top=np.max(Y)*2.)
  • trunk/GSASIIpwd.py

    r2740 r2754  
    337337    qLimits = data['QScaleLim']
    338338    minQ = np.searchsorted(Qpoints,qLimits[0])
    339     maxQ = np.searchsorted(Qpoints,qLimits[1])
     339    maxQ = np.searchsorted(Qpoints,qLimits[1])+1
    340340    newdata = []
    341341    if len(IofQ) < 3:
     
    427427    newpeaks = copy.copy(peaks)
    428428    iBeg = np.searchsorted(data[1][0],newpeaks['Limits'][0])
    429     iFin = np.searchsorted(data[1][0],newpeaks['Limits'][1])
     429    iFin = np.searchsorted(data[1][0],newpeaks['Limits'][1])+1
    430430    X = data[1][0][iBeg:iFin]
    431431    Y = data[1][1][iBeg:iFin]
     
    477477    nR = len(Qdata)
    478478    R = 0.5*np.pi*np.linspace(0,nR,nR)/(4.*maxQ)
    479     iFin = np.searchsorted(R,RDFcontrols['maxR'])
     479    iFin = np.searchsorted(R,RDFcontrols['maxR'])+1
    480480    bBut,aBut = signal.butter(4,0.01)
    481481    Qsmooth = signal.filtfilt(bBut,aBut,Qdata)
     
    17731773    cw = x[1:]-x[:-1]
    17741774    xBeg = np.searchsorted(x,Limits[0])
    1775     xFin = np.searchsorted(x,Limits[1])
     1775    xFin = np.searchsorted(x,Limits[1])+1
    17761776    bakType,bakDict,bakVary = SetBackgroundParms(Background)
    17771777    dataType,insDict,insVary = SetInstParms(Inst)
     
    19801980        x0 = profile[0]
    19811981        iBeg = np.searchsorted(x0,limits[0])
    1982         iFin = np.searchsorted(x0,limits[1])
     1982        iFin = np.searchsorted(x0,limits[1])+1
    19831983        if iFin-iBeg > 20000:
    19841984            iFin = iBeg+20000
     
    21172117    x0 = profile[0]
    21182118    iBeg = np.searchsorted(x0,limits[0])
    2119     iFin = np.searchsorted(x0,limits[1])
     2119    iFin = np.searchsorted(x0,limits[1])+1
    21202120    if iFin-iBeg > 20000:
    21212121        iFin = iBeg+20000
     
    22432243    profile[5] = np.zeros(len(profile[0]))
    22442244    iBeg = np.searchsorted(x0,limits[0])
    2245     iFin = np.searchsorted(x0,limits[1])
     2245    iFin = np.searchsorted(x0,limits[1])+1
    22462246    if iFin-iBeg > 20000:
    22472247        iFin = iBeg+20000
  • trunk/GSASIIpwdGUI.py

    r2753 r2754  
    4444VERY_LIGHT_GREY = wx.Colour(235,235,235)
    4545WACV = wx.ALIGN_CENTER_VERTICAL
     46GkDelta = unichr(0x0394)
    4647Pwr10 = unichr(0x0b9)+unichr(0x0b0)
    4748Pwr20 = unichr(0x0b2)+unichr(0x0b0)
     
    209210       
    210211def SetDefaultREFDModel():
    211     'Fills in default items for the SASD Models dictionary'   
    212     return {'Back':[0.0,False],'Layers':[{'Thickness':[1000.,False],'Name':'vacuum'},],'BackFile':'',}
     212    '''Fills in default items for the REFD Models dictionary
     213    Defined as follows for each layer:
     214        Name: name of substance
     215        Thick: thickness of layer in Angstroms
     216        Rough: upper surface roughness for layer
     217        Penetration: mixing of layer substance into layer above
     218        DenMul: multiplier for layer scattering density (default = 1.0)
     219    Top layer defaults to vacuum (or air/any gas); can be substituted for some other substance
     220    Bottom layer default: infinitely thisck Silicon; can be substituted for some other substance
     221    '''
     222    return {'Layers':[{'Name':'vacuum','DenMul':[1.0,False],},
     223        {'Name':'vacuum','Thick':[1.e6,False],'Rough':[0.,False],'Penetration':[0.,False],'DenMul':[1.0,False]},],
     224        'Zero':'Top','DualFitFile':'','FltBack':[0.0,False],'DualFltBack':[0.0,False],
     225        'Scale':[1.0,False],'DualScale':[1.0,False],'Minimizer':'LMLS','Resolution':[0.,'Const dq/q'],'Recomb':0.5,'Toler':0.001}
    213226       
    214227def SetDefaultSubstances():
     
    13751388       
    13761389def UpdateInstrumentGrid(G2frame,data):
    1377     '''respond to selection of PWDR/SASD Instrument Parameters
     1390    '''respond to selection of PWDR/SASD/REFD Instrument Parameters
    13781391    data tree item.
    13791392    '''
     
    19121925            else:                                   #time of flight (neutrons)
    19131926                pass                                #for now
    1914         elif 'L' in insVal['Type']:
     1927        elif insVal['Type'][0] in ['L','R',]:
    19151928            if 'C' in insVal['Type']:       
    19161929                instSizer.Add(wx.StaticText(G2frame.dataDisplay,-1,u' Lam (\xc5): (%10.6f)'%(insDef['Lam'])),
     
    24522465    mainSizer.Add(parmSizer,1,wx.EXPAND)
    24532466    mainSizer.Add((0,5),0)   
    2454     if 'SASD' in histName:
     2467    if histName[:4] in ['SASD',]:
    24552468        rho = [0.,0.]
    24562469        anomrho = [0.,0.]
     
    36043617   
    36053618################################################################################
    3606 #####  SASD Substances
     3619#####  SASD/REFD Substances
    36073620################################################################################
    36083621           
    36093622def UpdateSubstanceGrid(G2frame,data):
    3610     '''respond to selection of SASD Substance data tree item.
     3623    '''respond to selection of SASD/REFD Substance data tree item.
    36113624    '''
    36123625    import Substances as substFile
     
    46054618   
    46064619################################################################################
     4620#####  REFD Models
     4621################################################################################           
     4622       
     4623def UpdateREFDModelsGrid(G2frame,data):
     4624    '''respond to selection of REFD Models data tree item.
     4625    '''
     4626   
     4627    def ControlSizer():
     4628       
     4629        def OnRefPos(event):
     4630            data['Zero'] = refpos.GetValue()
     4631           
     4632        def OnMinSel(event):
     4633            data['Minimizer'] = minSel.GetValue()
     4634           
     4635        controlSizer = wx.BoxSizer(wx.VERTICAL)
     4636        resol = wx.BoxSizer(wx.HORIZONTAL)
     4637        resol.Add(wx.StaticText(G2frame.dataDisplay,label=' Instrument resolution (%'+GkDelta+'Q/Q): '),0,WACV)
     4638        resol.Add(G2G.ValidatedTxtCtrl(G2frame.dataDisplay,data['Resolution'],0,nDig=(10,2),typeHint=float),0,WACV)
     4639        resol.Add(wx.StaticText(G2frame.dataDisplay,label=' Zero position location: '),0,WACV)
     4640        poslist = ['Top','Bottom']
     4641        refpos = wx.ComboBox(G2frame.dataDisplay,value=data['Zero'],choices=poslist,
     4642            style=wx.CB_READONLY|wx.CB_DROPDOWN)
     4643        refpos.Bind(wx.EVT_COMBOBOX, OnRefPos)
     4644        resol.Add(refpos,0,WACV)
     4645        controlSizer.Add(resol,0,WACV)
     4646        minimiz = wx.BoxSizer(wx.HORIZONTAL)
     4647        minimiz.Add(wx.StaticText(G2frame.dataDisplay,label=' Minimizer: '),0,WACV)
     4648        minlist = ['LMLS','Global','BFGS',]
     4649        minSel = wx.ComboBox(G2frame.dataDisplay,value=data['Minimizer'],choices=minlist,
     4650            style=wx.CB_READONLY|wx.CB_DROPDOWN)
     4651        minSel.Bind(wx.EVT_COMBOBOX, OnMinSel)
     4652        minimiz.Add(minSel,0,WACV)
     4653        minimiz.Add(wx.StaticText(G2frame.dataDisplay,label=' Tolerance: '),0,WACV)
     4654        minimiz.Add(G2G.ValidatedTxtCtrl(G2frame.dataDisplay,data,'Toler',nDig=(10,1,'g'),typeHint=float),0,WACV)
     4655    #Recomb':0.5,  needed??     
     4656        controlSizer.Add(minimiz,0,WACV)
     4657        return controlSizer
     4658   
     4659    def OverallSizer():
     4660#'DualFitFile':'', 'DualFltBack':[0.0,False],'DualScale':[1.0,False] future for neutrons - more than one?
     4661       
     4662        def OnScaleRef(event):
     4663            data['Scale'][1] = scaleref.GetValue()
     4664           
     4665        def OnBackRef(event):
     4666            data['FltBack'][1] = backref.GetValue()
     4667           
     4668        overall = wx.BoxSizer(wx.HORIZONTAL)
     4669        overall.Add(wx.StaticText(G2frame.dataDisplay,label=' Scale: '),0,WACV)
     4670        overall.Add(G2G.ValidatedTxtCtrl(G2frame.dataDisplay,data['Scale'],0,nDig=(10,2),typeHint=float),0,WACV)
     4671        scaleref = wx.CheckBox(G2frame.dataDisplay,label=' Refine?  ')
     4672        scaleref.SetValue(data['Scale'][1])
     4673        scaleref.Bind(wx.EVT_CHECKBOX, OnScaleRef)
     4674        overall.Add(scaleref,0,WACV)
     4675        overall.Add(wx.StaticText(G2frame.dataDisplay,label=' Flat bkg.: '),0,WACV)
     4676        overall.Add(G2G.ValidatedTxtCtrl(G2frame.dataDisplay,data['FltBack'],0,nDig=(10,2),typeHint=float),0,WACV)
     4677        backref = wx.CheckBox(G2frame.dataDisplay,label=' Refine?  ')
     4678        backref.SetValue(data['FltBack'][1])
     4679        backref.Bind(wx.EVT_CHECKBOX, OnBackRef)
     4680        overall.Add(backref,0,WACV)       
     4681        return overall
     4682       
     4683    def LayerSizer():
     4684    #'Layers':[{'Name':'vacuum','DenMul':[1.0,False],},
     4685#        {'Name':'vacuum','Thick':[1.e6,False],'Rough':[0.,False],'Penetration':[0.,False],'DenMul':[1.0,False]}
     4686        layerSizer = wx.BoxSizer(wx.VERTICAL)
     4687       
     4688       
     4689        return layerSizer
     4690       
     4691   
     4692    Sample = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId, 'Sample Parameters'))
     4693    Limits = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId, 'Limits'))
     4694    Inst = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId, 'Instrument Parameters'))
     4695    Substances = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId, 'Substances'))
     4696    ProfDict,Profile,Name = G2frame.PatternTree.GetItemPyData(G2frame.PatternId)[:3]
     4697    if G2frame.dataDisplay:
     4698        G2frame.dataFrame.DestroyChildren()   # is this a ScrolledWindow? If so, bad!
     4699    G2gd.SetDataMenuBar(G2frame,G2frame.dataFrame.ModelMenu)
     4700    if not G2frame.dataFrame.GetStatusBar():
     4701        G2frame.dataFrame.CreateStatusBar()
     4702    G2frame.dataFrame.SetLabel('Modelling')
     4703    G2frame.dataDisplay = wxscroll.ScrolledPanel(G2frame.dataFrame)
     4704    mainSizer = wx.BoxSizer(wx.VERTICAL)
     4705   
     4706    mainSizer.Add(wx.StaticText(G2frame.dataDisplay,label=' Reflectometry fitting for: '+Name),0,WACV)
     4707    mainSizer.Add(wx.StaticText(G2frame.dataDisplay,label=' Controls:'),0,WACV)
     4708    mainSizer.Add(ControlSizer())
     4709    G2G.HorizontalLine(mainSizer,G2frame.dataDisplay)   
     4710    mainSizer.Add(wx.StaticText(G2frame.dataDisplay,label=' Global parameters:'),0,WACV)
     4711    mainSizer.Add(OverallSizer())
     4712    G2G.HorizontalLine(mainSizer,G2frame.dataDisplay)   
     4713    mainSizer.Add(wx.StaticText(G2frame.dataDisplay,label=' Layers:'),0,WACV)
     4714    mainSizer.Add(LayerSizer())
     4715    mainSizer.Layout()   
     4716    G2frame.dataDisplay.SetSizer(mainSizer)
     4717    G2frame.dataDisplay.SetAutoLayout(1)
     4718    G2frame.dataDisplay.SetupScrolling()
     4719    Size = mainSizer.Fit(G2frame.dataFrame)
     4720    Size[0] += 25
     4721    G2frame.dataFrame.setSizePosLeft(Size)   
     4722   
     4723################################################################################
    46074724#####  PDF controls
    46084725################################################################################           
  • trunk/GSASIIstrMath.py

    r2753 r2754  
    36333633            x,y,w,yc,yb,yd = Histogram['Data']
    36343634            xB = np.searchsorted(x,Limits[0])
    3635             xF = np.searchsorted(x,Limits[1])
     3635            xF = np.searchsorted(x,Limits[1])+1
    36363636            dMdvh = np.sqrt(w[xB:xF])*getPowderProfileDerv(parmDict,x[xB:xF],
    36373637                varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup)
     
    36913691            dy = y-yc
    36923692            xB = np.searchsorted(x,Limits[0])
    3693             xF = np.searchsorted(x,Limits[1])
     3693            xF = np.searchsorted(x,Limits[1])+1
    36943694            dMdvh = getPowderProfileDerv(parmDict,x[xB:xF],
    36953695                varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup)
     
    37673767            yd *= 0.0
    37683768            xB = np.searchsorted(x,Limits[0])
    3769             xF = np.searchsorted(x,Limits[1])
     3769            xF = np.searchsorted(x,Limits[1])+1
    37703770            yc[xB:xF],yb[xB:xF] = getPowderProfile(parmDict,x[xB:xF],
    37713771                varylist,Histogram,Phases,calcControls,pawleyLookup)
Note: See TracChangeset for help on using the changeset viewer.