Changeset 4870
- Timestamp:
- Mar 31, 2021 7:19:27 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIplot.py
r4858 r4870 2191 2191 elif event.key in ['+','=']: 2192 2192 G2frame.plusPlot = not G2frame.plusPlot 2193 elif event.key == '/': 2194 Page.plotStyle['Normalize'] = not Page.plotStyle['Normalize'] 2193 2195 elif event.key == 'i' and G2frame.Contour: #for smoothing contour plot 2194 2196 choice = ['nearest','bilinear','bicubic','spline16','spline36','hanning', … … 2981 2983 'refDelt':0.1*Ymax,}) 2982 2984 #end patch 2985 if 'Normalize' not in Page.plotStyle: 2986 Page.plotStyle['Normalize'] = False 2983 2987 # reset plot when changing between different data types 2984 2988 try: … … 3130 3134 Page.Choice = Page.Choice+ \ 3131 3135 ['u/U: offset up/10x','d/D: offset down/10x','l: offset left','r: offset right', 3132 'o: reset offset','f: select data', ]3133 3136 'o: reset offset','f: select data', 3137 '/: normalize'] 3134 3138 elif plottype in ['SASD','REFD']: 3135 3139 Page.Choice = [' key press', … … 3171 3175 G2frame.PatternId, 'Instrument Parameters')) 3172 3176 Sample = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Sample Parameters')) 3177 Limits = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Limits')) 3173 3178 ParmList = [Parms,] 3174 3179 SampleList = [Sample,] 3180 LimitsList = [Limits,] 3175 3181 Title = data[0].get('histTitle') 3176 3182 if not Title: … … 3187 3193 ParmList = [] 3188 3194 SampleList = [] 3195 LimitsList = [] 3189 3196 Temps = [] 3190 3197 # loop through tree looking for matching histograms to plot … … 3210 3217 SampleList.append(G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame, 3211 3218 pid, 'Sample Parameters'))) 3219 LimitsList.append(G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame, 3220 pid, 'Limits'))) 3212 3221 Temps.append('%.1fK'%SampleList[-1]['Temperature']) 3213 3222 if not G2frame.Contour: … … 3215 3224 ParmList.reverse() 3216 3225 SampleList.reverse() 3226 LimitsList.reverse() 3217 3227 if timeDebug: 3218 3228 print('plot build time: %.3f for %dx%d patterns'%(time.time()-time0,len(PlotList[0][1][1]),len(PlotList))) … … 3261 3271 else: 3262 3272 Plot.set_xlabel(xLabel,fontsize=16) 3263 if 'T' in ParmList[0]['Type'][0] :3273 if 'T' in ParmList[0]['Type'][0] or (Page.plotStyle['Normalize'] and not G2frame.SinglePlot): 3264 3274 if Page.plotStyle['sqrtPlot']: 3265 3275 Plot.set_ylabel(r'$\sqrt{Normalized\ intensity}$',fontsize=16) … … 3296 3306 Parms = ParmList[N] 3297 3307 Sample = SampleList[N] 3308 limits = np.array(LimitsList[N]) 3298 3309 ifpicked = False 3299 LimitId = 03300 3310 NoffY = offsetY*(Nmax-N) 3301 3311 if Pattern[1] is None: continue # skip over uncomputed simulations … … 3304 3314 if PickId: 3305 3315 ifpicked = Pattern[2] == G2frame.GPXtree.GetItemText(PatternId) 3306 LimitId = G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId,'Limits')3307 limits = G2frame.GPXtree.GetItemPyData(LimitId)3308 3316 # recompute mask from excluded regions, in case they have changed 3309 3317 excls = limits[2:] … … 3399 3407 Y = ma.array(Y,mask=ma.getmask(X)) 3400 3408 3401 if LimitId and ifpicked: 3402 limits = np.array(G2frame.GPXtree.GetItemPyData(LimitId)) 3409 #if LimitId and ifpicked: 3410 # limits = np.array(G2frame.GPXtree.GetItemPyData(LimitId)) 3411 if ifpicked: 3403 3412 lims = limits[1] 3404 3413 if Page.plotStyle['qPlot'] and 'PWDR' in plottype and not ifLimits: … … 3560 3569 Plot.plot(X,ZB,colors[2],picker=False,label=incCptn('calc')) 3561 3570 else: # not logPlot 3571 ymax = 1. 3572 if Page.plotStyle['Normalize'] and Y.max() != 0 and not G2frame.SinglePlot: 3573 ymax = Y.max() 3562 3574 if G2frame.SubBack: 3563 3575 if 'PWDR' in plottype: 3564 ObsLine = Plot.plot(Xum,Y ,color=colors[0],marker=pP,3576 ObsLine = Plot.plot(Xum,Y/ymax,color=colors[0],marker=pP, 3565 3577 picker=False,clip_on=Clip_on,label=incCptn('obs-bkg')) #Io-Ib 3566 3578 if np.any(Z): #only if there is a calc pattern 3567 CalcLine = Plot.plot(X, Z-W,colors[1],picker=False,label=incCptn('calc-bkg')) #Ic-Ib3579 CalcLine = Plot.plot(X,(Z-W)/ymax,colors[1],picker=False,label=incCptn('calc-bkg')) #Ic-Ib 3568 3580 else: 3569 3581 Plot.plot(X,YB,color=colors[0],marker=pP, … … 3572 3584 else: 3573 3585 if 'PWDR' in plottype: 3574 ObsLine = Plot.plot(Xum,Y ,color=colors[0],marker=pP,3586 ObsLine = Plot.plot(Xum,Y/ymax,color=colors[0],marker=pP, 3575 3587 picker=True,pickradius=3.,clip_on=Clip_on,label=incCptn('obs')) #Io 3576 CalcLine = Plot.plot(X,Z ,colors[1],picker=False,label=incCptn('calc')) #Ic3588 CalcLine = Plot.plot(X,Z/ymax,colors[1],picker=False,label=incCptn('calc')) #Ic 3577 3589 else: 3578 3590 Plot.plot(X,YB,color=colors[0],marler=pP, … … 3580 3592 Plot.plot(X,ZB,colors[2],picker=False,label=incCptn('calc')) 3581 3593 if 'PWDR' in plottype and (G2frame.SinglePlot and G2frame.plusPlot): 3582 BackLine = Plot.plot(X,W ,colors[2],picker=False,label=incCptn('bkg')) #Ib3594 BackLine = Plot.plot(X,W/ymax,colors[2],picker=False,label=incCptn('bkg')) #Ib 3583 3595 if not G2frame.Weight and np.any(Z): 3584 DifLine = Plot.plot(X,D ,colors[3],3596 DifLine = Plot.plot(X,D/ymax,colors[3], 3585 3597 picker=True,pickradius=1.,label=incCptn('diff')) #Io-Ic 3586 3598 Plot.axhline(0.,color='k',label='_zero') … … 3617 3629 3618 3630 else: #not picked 3631 ymax = 1. 3632 if Page.plotStyle['Normalize'] and Y.max() != 0: 3633 ymax = Y.max() 3619 3634 icolor = 256*N//len(PlotList) 3620 3635 if Page.plotStyle['logPlot']: … … 3635 3650 else: 3636 3651 if 'PWDR' in plottype: 3637 Plot.plot(X,Y ,color=mcolors.cmap(icolor),picker=False)3652 Plot.plot(X,Y/ymax,color=mcolors.cmap(icolor),picker=False) 3638 3653 elif plottype in ['SASD','REFD']: 3639 3654 try:
Note: See TracChangeset
for help on using the changeset viewer.