Changeset 4067


Ignore:
Timestamp:
Jul 18, 2019 8:40:48 AM (4 years ago)
Author:
vondreele
Message:

background plotting options now fixed completely for PWDR data.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIplot.py

    r4066 r4067  
    30153015        NoffY = offsetY*(Nmax-N)
    30163016        if Pattern[1] is None: continue # skip over uncomputed simulations
    3017         xye = np.array(ma.getdata(Pattern[1])) # strips mask
     3017        xye = np.array(ma.getdata(Pattern[1])) # strips mask = X,Yo,W,Yc,Yb,Yd
    30183018        xye0 = Pattern[1][0]  # keeps mask
    3019         #bxye = G2pdG.GetFileBackground(G2frame,xye,Pattern)
    30203019        if PickId:
    30213020            ifpicked = Pattern[2] == G2frame.GPXtree.GetItemText(PatternId)
     
    30243023            # recompute mask from excluded regions, in case they have changed
    30253024            excls = limits[2:]
    3026 #            xye0 = ma.masked_outside(xye0,limits[0],limits[1],copy=False)
    30273025            for excl in excls:
    30283026                xye0 = ma.masked_inside(xye[0],excl[0],excl[1],copy=False)                   #excluded region mask
    3029 #            Pattern[1][0] = ma.array(Pattern[1][0],mask=ma.getmask(xye0))       #save the excluded region masking
    30303027            if not G2frame.Contour:
    30313028                xye0 = ma.masked_outside(xye[0],limits[1][0],limits[1][1],copy=False)            #now mask for limits
     
    30893086            multArray = ma.getdata(multArray)
    30903087        if 'PWDR' in plottype:
    3091             YI = copy.copy(xye[1])
     3088            YI = copy.copy(xye[1])      #yo
    30923089            if G2frame.SubBack:
    3093                 YI -= xye[5]
     3090                YI -= xye[4]            #background
    30943091            if Page.plotStyle['sqrtPlot']:
    30953092                olderr = np.seterr(invalid='ignore') #get around sqrt(-ve) error
     
    30973094                np.seterr(invalid=olderr['invalid'])
    30983095            elif Page.plotStyle.get('WgtDiagnostic',False):
    3099                 Y = xye[1]*xye[2]
     3096                Y = xye[1]*xye[2]       #Y-obs*wt
    31003097            elif 'PWDR' in plottype and G2frame.SinglePlot and not \
    31013098                (Page.plotStyle['logPlot'] or Page.plotStyle['sqrtPlot'] or G2frame.Contour):
     
    31053102        elif plottype in ['SASD','REFD']:
    31063103            if plottype == 'SASD':
    3107                 B = xye[5]
     3104                B = xye[5]      #Yo - Yc
    31083105            else:
    31093106                B = np.zeros_like(xye[5])
     
    31593156            Ifin = np.searchsorted(X,limits[1][1])
    31603157            if ifpicked:
     3158                ZI = copy.copy(xye[3])      #Yc
    31613159                if Page.plotStyle['sqrtPlot']:
    31623160                    olderr = np.seterr(invalid='ignore') #get around sqrt(-ve) error
    3163                     ZI = copy.copy(xye[3])
    3164                     if G2frame.SubBack:
    3165                         ZI -= xye[5]
    31663161                    Z = np.where(ZI>=0.,np.sqrt(ZI),-np.sqrt(-ZI))
    31673162                    np.seterr(invalid=olderr['invalid'])
     
    31693164                    if 'PWDR' in plottype and G2frame.SinglePlot and not (
    31703165                        Page.plotStyle['logPlot'] or Page.plotStyle['sqrtPlot'] or G2frame.Contour):
    3171                         Z = xye[3]*multArray+NoffY*Ymax/100.0
     3166                        Z = ZI*multArray+NoffY*Ymax/100.0   #yc
    31723167                    else:
    3173                         Z = xye[3]+NoffY*Ymax/100.0
     3168                        Z = ZI+NoffY*Ymax/100.0         #yc
    31743169                if 'PWDR' in plottype:
    31753170                    if Page.plotStyle['sqrtPlot']:
    31763171                        olderr = np.seterr(invalid='ignore') #get around sqrt(-ve) error
    3177                         W = np.where(xye[4]>=0.,np.sqrt(xye[4]),-np.sqrt(-xye[4]))
     3172                        W = np.where(xye[4]>=0.,np.sqrt(xye[4]),-np.sqrt(-xye[4]))      #yb
    31783173                        np.seterr(invalid=olderr['invalid'])
    31793174                        D = np.where(xye[5],(Y-Z),0.)-Page.plotStyle['delOffset']
     
    31823177                    elif G2frame.SinglePlot and not (
    31833178                        Page.plotStyle['logPlot'] or Page.plotStyle['sqrtPlot'] or G2frame.Contour):
    3184                         W = xye[4]*multArray+NoffY*Ymax/100.0
    3185                         D = multArray*xye[5]-Page.plotStyle['delOffset']  #powder background
     3179                        W = xye[4]*multArray+NoffY*Ymax/100.0       #yb
     3180                        D = multArray*xye[5]-Page.plotStyle['delOffset']  #Yo-Yc
    31863181                    else:
    3187                         W = xye[4]+NoffY*Ymax/100.0
    3188                         D = xye[5]-Page.plotStyle['delOffset']  #powder background
     3182                        W = xye[4]+NoffY*Ymax/100.0     #yb
     3183                        D = xye[5]-Page.plotStyle['delOffset']  #Yo-Yc
    31893184                elif plottype in ['SASD','REFD']:
    31903185                    if Page.plotStyle['sqPlot']:
    3191                         W = xye[4]*X**4
    3192                         Z = xye[3]*X**4
    3193                         B = B*X**4
     3186                        W = xye[4]*X**4         #Yb
     3187                        Z = xye[3]*X**4         #Yc
     3188                        B = B*X**4              #(yo-Yc)*x**4
    31943189                    else:
    3195                         W = xye[4]
     3190                        W = xye[4]              #Yb
    31963191                    if G2frame.SubBack:
    31973192                        YB = Y-B
     
    32463241                    if G2frame.SubBack:
    32473242                        if 'PWDR' in plottype:
    3248                             ObsLine = Plot.plot(Xum,Y-W,colors[0]+pP,picker=False,clip_on=Clip_on,label='_obs')  #Io-Ib
     3243                            ObsLine = Plot.plot(Xum,Y,colors[0]+pP,picker=False,clip_on=Clip_on,label='_obs')  #Io-Ib
    32493244                            CalcLine = Plot.plot(X,Z-W,colors[1],picker=False,label='_calc')               #Ic-Ib
    32503245                        else:
     
    33063301                if Page.plotStyle['logPlot'] and 'PWDR' in plottype:
    33073302                    Plot.set_ylim(bottom=np.min(np.trim_zeros(Y))/2.,top=np.max(Y)*2.)
    3308 #    if not G2frame.SinglePlot and not G2frame.Contour:
    3309 #        axcb = mpl.colorbar.ColorbarBase(N)
    3310 #        axcb.set_label('PDF number')
    33113303    if timeDebug:
    33123304        print('plot fill time: %.3f'%(time.time()-time0))
Note: See TracChangeset for help on using the changeset viewer.