Changeset 3444


Ignore:
Timestamp:
Jun 20, 2018 9:35:13 AM (3 years ago)
Author:
vondreele
Message:

fix problem of masked xdata values as limits to linspace for background functions & derivatives; use the data instead of the masked data

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpwd.py

    r3435 r3444  
    757757            yb = parmDict[pfx+'Back;0']*T1+parmDict[pfx+'Back;1']*T2
    758758        else:
     759            xnomask = ma.getdata(xdata)
     760            xmin,xmax = xnomask[0],xnomask[-1]
    759761            if bakType == 'lin interpolate':
    760                 bakPos = np.linspace(xdata[0],xdata[-1],nBak,True)
     762                bakPos = np.linspace(xmin,xmax,nBak,True)
    761763            elif bakType == 'inv interpolate':
    762                 bakPos = 1./np.linspace(1./xdata[-1],1./xdata[0],nBak,True)
     764                bakPos = 1./np.linspace(1./xmax,1./xmin,nBak,True)
    763765            elif bakType == 'log interpolate':
    764                 bakPos = np.exp(np.linspace(np.log(xdata[0]),np.log(xdata[-1]),nBak,True))
    765             bakPos[0] = xdata[0]
    766             bakPos[-1] = xdata[-1]
     766                bakPos = np.exp(np.linspace(np.log(xmin),np.log(xmax),nBak,True))
     767            bakPos[0] = xmin
     768            bakPos[-1] = xmax
    767769            bakVals = np.zeros(nBak)
    768770            for i in range(nBak):
     
    875877            dydb = [T1,T2]
    876878        else:
     879            xnomask = ma.getdata(xdata)
     880            xmin,xmax = xnomask[0],xnomask[-1]
    877881            if bakType == 'lin interpolate':
    878                 bakPos = np.linspace(xdata[0],xdata[-1],nBak,True)
     882                bakPos = np.linspace(xmin,xmax,nBak,True)
    879883            elif bakType == 'inv interpolate':
    880                 bakPos = 1./np.linspace(1./xdata[-1],1./xdata[0],nBak,True)
     884                bakPos = 1./np.linspace(1./xmax,1./xmin,nBak,True)
    881885            elif bakType == 'log interpolate':
    882                 bakPos = np.exp(np.linspace(np.log(xdata[0]),np.log(xdata[-1]),nBak,True))
    883             bakPos[0] = xdata[0]
    884             bakPos[-1] = xdata[-1]
     886                bakPos = np.exp(np.linspace(np.log(xmin),np.log(xmax),nBak,True))
     887            bakPos[0] = xmin
     888            bakPos[-1] = xmax
    885889            for i,pos in enumerate(bakPos):
    886890                if i == 0:
Note: See TracChangeset for help on using the changeset viewer.