Changeset 5524
- Timestamp:
- Mar 26, 2023 9:26:51 PM (8 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIdataGUI.py
r5504 r5524 3184 3184 self.itemPicked = None 3185 3185 self.Interpolate = 'nearest' 3186 self.ContourColor = GSASIIpath.GetConfigValue('Contour_color',' Paired')3186 self.ContourColor = GSASIIpath.GetConfigValue('Contour_color','GSPaired') 3187 3187 self.VcovColor = 'RdYlGn' 3188 3188 self.RamaColor = 'Blues' … … 7895 7895 if kind in ['PWDR','SASD','REFD',]: 7896 7896 NewPlot = True 7897 if 'xylim' in dir(G2frame): 7897 if 'Contour' in dir(G2frame) and G2frame.Contour: 7898 pass 7899 elif 'xylim' in dir(G2frame): 7898 7900 NewPlot = False 7899 7901 G2plt.PlotPatterns(G2frame,plotType=kind,newPlot=NewPlot) … … 8288 8290 # print('reloading G2pdG') 8289 8291 G2pdG.UpdatePeakGrid(G2frame,data) 8290 G2plt.PlotPatterns(G2frame) 8292 newPlot = False 8293 if hasattr(G2frame,'Contour'): 8294 if G2frame.Contour: 8295 G2frame.Contour = False 8296 newPlot = True 8297 G2plt.PlotPatterns(G2frame,newPlot) 8291 8298 elif G2frame.GPXtree.GetItemText(item) == 'Background': 8292 8299 G2frame.PatternId = G2frame.GPXtree.GetItemParent(item) 8293 8300 data = G2frame.GPXtree.GetItemPyData(item) 8294 8301 G2pdG.UpdateBackground(G2frame,data) 8295 G2plt.PlotPatterns(G2frame )8302 G2plt.PlotPatterns(G2frame,True) 8296 8303 elif G2frame.GPXtree.GetItemText(item) == 'Limits': 8297 8304 G2frame.PatternId = G2frame.GPXtree.GetItemParent(item) … … 8336 8343 8337 8344 G2pdG.UpdateSampleGrid(G2frame,data) 8338 G2plt.PlotPatterns(G2frame, plotType=datatype)8345 G2plt.PlotPatterns(G2frame,True,plotType=datatype) 8339 8346 elif G2frame.GPXtree.GetItemText(item) == 'Index Peak List': 8340 8347 G2frame.PatternId = G2frame.GPXtree.GetItemParent(item) … … 8350 8357 G2plt.PlotPowderLines(G2frame) 8351 8358 else: 8352 G2plt.PlotPatterns(G2frame) 8359 newPlot = False 8360 if hasattr(G2frame,'Contour'): 8361 if G2frame.Contour: 8362 G2frame.Contour = False 8363 newPlot = True 8364 G2plt.PlotPatterns(G2frame,newPlot) 8353 8365 elif G2frame.GPXtree.GetItemText(item) == 'Unit Cells List': 8354 8366 G2frame.PatternId = G2frame.GPXtree.GetItemParent(item) … … 8377 8389 G2plt.PlotPowderLines(G2frame) 8378 8390 else: 8391 newPlot = False 8392 if hasattr(G2frame,'Contour'): 8393 if G2frame.Contour: 8394 G2frame.Contour = False 8395 newPlot = True 8396 G2plt.PlotPatterns(G2frame,newPlot) 8379 8397 G2plt.PlotPatterns(G2frame) 8380 8398 elif G2frame.GPXtree.GetItemText(item) == 'Reflection Lists': #powder reflections … … 8386 8404 G2frame.RefList = list(data.keys())[0] 8387 8405 G2pdG.UpdateReflectionGrid(G2frame,data) 8388 G2plt.PlotPatterns(G2frame) 8406 newPlot = False 8407 if hasattr(G2frame,'Contour'): 8408 if G2frame.Contour: 8409 G2frame.Contour = False 8410 newPlot = True 8411 G2plt.PlotPatterns(G2frame,newPlot) 8389 8412 elif G2frame.GPXtree.GetItemText(item) == 'Reflection List': #HKLF reflections 8390 8413 G2frame.dataWindow.HideShow.Enable(True) -
trunk/GSASIIplot.py
r5522 r5524 34 34 :func:`PlotXYZ` Simple contour plot of xyz data 35 35 :func:`PlotXYZvect` Quiver Plot for 3D cartesian vectors 36 :func:`Plot3 Dxyz` Surface Plot for 3D vectors36 :func:`Plot3dXYZ` Surface Plot for 3D vectors 37 37 :func:`PlotAAProb` Protein "quality" plot 38 38 :func:`PlotStrain` Plot of strain data, used for diagnostic purposes … … 53 53 :func:`PlotLayers` show layer structures as balls & sticks 54 54 :func:`PlotFPAconvolutors` plots the convolutors from Fundamental Parameters 55 :func: 'PlotClusterYYZ'plots the result of cluster analysis55 :func:`PlotClusterXYZ` plots the result of cluster analysis 56 56 ============================ =========================================================================== 57 57 … … 327 327 self.toolbar.Realize() 328 328 self.plotStyle = {'qPlot':False,'dPlot':False,'sqrtPlot':False,'sqPlot':False, 329 'logPlot':False,'exclude':False,'partials':True }329 'logPlot':False,'exclude':False,'partials':True,'chanPlot':False} 330 330 331 331 sizer=wx.BoxSizer(wx.VERTICAL) … … 1161 1161 RefreshPlot() 1162 1162 dlg.ShowModal() 1163 1164 def uneqImgShow(figure,ax,Xlist,Ylist,cmap,vmin,vmax,Ylbls=[]): 1165 '''Plots a contour plot where point spacing varies within a dataset 1166 and where the X values may differ between histograms. Note that 1167 the length of Xlist and Ylist must be the same and will be the number 1168 of histograms to be plotted 1169 1170 :param matplotlib.figure figure: 1171 The figure where the plot will be placed. 1172 :param matplotlib.axes ax: 1173 The axes where the plot will be made. 1174 :param list Xlist: 1175 A list of X values for each histogram. 1176 :param list Ylist: 1177 A list of intensities for each histogram. 1178 :param matplotlib.colormap cmap: 1179 The colormap used for shading intensities. 1180 :param float vmin: 1181 Minimum intensity. 1182 :param float vmax: float 1183 Maximum intensity. 1184 :param list Ylbls: Optional. 1185 Label to place on each histogram. The default is [] where the axes 1186 are labeled normally with the first histogram numbered starting at 0. 1187 ''' 1188 def midPoints(x): 1189 '''Return the pixel corners for a series of steps 1190 For the series [1,2,3,5] this will be [0.5,1.5,2.5,4,6] 1191 Note that n+1 points are returned for input of n points 1192 ''' 1193 return np.concatenate( [[1.5*x[0] - x[1]/2], 1194 (x[:-1]+x[1:])/2, 1195 [1.5*x[-1] - x[-2]/2]] ) 1196 1197 lenX = len(Xlist) 1198 if lenX != len(Ylist): 1199 raise Exception("uneqImgShow error: unequal list lengths") 1200 figure.subplots_adjust(right=.85) 1201 #print('vmin,vmax',vmin,vmax) 1202 meshlist = [] 1203 for i,(X,Y) in enumerate(zip(Xlist,Ylist)): 1204 #print(i,'X',min(X),max(X),'Y',min(Y),max(Y)) 1205 meshlist.append( 1206 ax.pcolormesh(midPoints(X), [i-0.5,i+0.5], Y[np.newaxis,:], 1207 cmap=cmap,vmin=vmin,vmax=vmax)) 1208 # label y axis with provided labels 1209 if lenX == len(Ylbls): 1210 pos = np.arange(lenX) 1211 ax.set_yticks(pos,Ylbls) 1212 # add the colorbar 1213 ax1 = figure.add_axes([0.87, 0.1, 0.04, 0.8]) 1214 mpl.colorbar.ColorbarBase(ax1, cmap=cmap, norm=mpl.colors.Normalize(vmin,vmax)) 1215 # does not plot grid lines at present 1216 # if mpl.rcParams['axes.grid'] 1217 1163 1218 #### PlotSngl ################################################################ 1164 1219 def PlotSngl(G2frame,newPlot=False,Data=None,hklRef=None,Title=''): … … 2074 2129 G2frame.HKL = [] # array of generated reflections 2075 2130 G2frame.Extinct = [] # array of extinct reflections 2076 PlotPatterns(G2frame, newPlot,plotType)2131 PlotPatterns(G2frame,plotType=plotType) 2077 2132 2078 2133 def plotVline(Page,Plot,Lines,Parms,pos,color,pick): … … 2117 2172 elif G2frame.Weight: 2118 2173 G2frame.Weight = False 2119 PlotPatterns(G2frame, newPlot=newPlot,plotType=plottype,extraKeys=extraKeys)2174 PlotPatterns(G2frame,plotType=plottype,extraKeys=extraKeys) 2120 2175 PublishRietveldPlot(G2frame,Pattern,Plot,Page) 2121 2176 G2frame.Weight = True 2122 PlotPatterns(G2frame, newPlot=newPlot,plotType=plottype,extraKeys=extraKeys)2177 PlotPatterns(G2frame,plotType=plottype,extraKeys=extraKeys) 2123 2178 return 2124 2179 else: … … 2229 2284 G2frame.SinglePlot = True 2230 2285 G2frame.Contour = not G2frame.Contour 2231 if G2frame.Contour:2232 Page.plotStyle['qPlot'] = False2233 Page.plotStyle['dPlot'] = False2234 2286 elif (event.key == 'p' and 'PWDR' in plottype and G2frame.SinglePlot): 2235 2287 Page.plotStyle['partials'] = not Page.plotStyle['partials'] … … 2287 2339 if 'PWDR' in plottype: 2288 2340 Page.plotStyle['qPlot'] = not Page.plotStyle['qPlot'] 2289 if Page.plotStyle['qPlot']:2290 G2frame.Contour = False2291 2341 Page.plotStyle['dPlot'] = False 2342 Page.plotStyle['chanPlot'] = False 2292 2343 elif plottype in ['SASD','REFD']: 2293 2344 Page.plotStyle['sqPlot'] = not Page.plotStyle['sqPlot'] 2345 elif event.key == 'h' and G2frame.Contour: 2346 newPlot = True 2347 Page.plotStyle['qPlot'] = False 2348 Page.plotStyle['dPlot'] = False 2349 Page.plotStyle['chanPlot'] = not Page.plotStyle['chanPlot'] 2350 elif event.key == 'e' and G2frame.Contour: 2351 newPlot = True 2352 G2frame.TforYaxis = not G2frame.TforYaxis 2294 2353 elif event.key == 't' and 'PWDR' in plottype and not ifLimits: 2295 if G2frame.Contour: 2296 G2frame.TforYaxis = not G2frame.TforYaxis 2297 else: 2298 Page.plotStyle['dPlot'] = not Page.plotStyle['dPlot'] 2299 if Page.plotStyle['dPlot']: 2300 G2frame.Contour = False 2301 Page.plotStyle['qPlot'] = False 2302 newPlot = True 2354 newPlot = True 2355 Page.plotStyle['dPlot'] = not Page.plotStyle['dPlot'] 2356 Page.plotStyle['qPlot'] = False 2357 Page.plotStyle['chanPlot'] = False 2303 2358 elif event.key == 'm': 2304 2359 if not G2frame.Contour: … … 2348 2403 2349 2404 def OnMotion(event): 2350 ' Update the status line with info based on the mouse position'2405 'PlotPatterns: Update the status line with info based on the mouse position' 2351 2406 global PlotList 2352 2407 SetCursor(Page) … … 2405 2460 wave = G2mth.getWave(Parms) 2406 2461 dT = tolerance*wave*90./(np.pi**2*cosd(xpos/2)) 2462 elif Page.plotStyle['chanPlot'] and G2frame.Contour: 2463 xpos = ma.getdata(X)[min(len(X)-1,int(xpos))] 2464 try: 2465 dsp = G2lat.Pos2dsp(Parms,xpos) 2466 q = 2.*np.pi/dsp 2467 except: 2468 dsp = -1 2469 q = -1 2407 2470 elif plottype in ['SASD','REFD']: 2408 2471 q = xpos … … 2423 2486 return 2424 2487 dT = tolerance*xpos/dsp 2425 elif G2frame.Contour and 'T' in Parms['Type'][0]:2426 xpos = X[int(xpos)]2427 dsp = G2lat.Pos2dsp(Parms,xpos)2428 q = 2.*np.pi/dsp2429 2488 else: 2430 2489 dsp = G2lat.Pos2dsp(Parms,xpos) … … 2433 2492 if G2frame.Contour: #PWDR only 2434 2493 try: 2494 pNum = int(ypos+.5) 2495 indx = abs(PlotList[pNum][1][0] - xpos).argmin() # closest point to xpos 2496 val = 'int={:.3g}'.format(ma.getdata(PlotList[pNum][1][1])[indx]) 2435 2497 if 'T' in Parms['Type'][0]: 2436 statLine = 'TOF =%9.3f d=%9.5f Q=%9.5f pattern ID =%5d, %s'%(xpos,dsp,q,int(ypos+.5),PlotList[int(ypos+.5)][-1])2498 statLine = 'TOF=%.3f d=%.5f Q=%.5f %s pattern ID=%d, %s'%(xpos,dsp,q,val,pNum,PlotList[pNum][-1]) 2437 2499 else: 2438 statLine = '2-theta =%9.3f d=%9.5f Q= %9.5f pattern ID =%5d, %s'%(xpos,dsp,q,int(ypos+.5),PlotList[int(ypos+.5)][-1])2500 statLine = '2-theta=%.3f d=%.5f Q=%.5f %s pattern ID=%d, %s'%(xpos,dsp,q,val,pNum,PlotList[pNum][-1]) 2439 2501 except IndexError: 2440 2502 pass … … 2452 2514 if Page.plotStyle['sqrtPlot']: 2453 2515 ytmp = ypos**2 2454 statLine = '2-theta=%.3f d=%.5f Q=%.4f Intensity=%.2f'%(xpos,dsp,q,y pos)2516 statLine = '2-theta=%.3f d=%.5f Q=%.4f Intensity=%.2f'%(xpos,dsp,q,ytmp) 2455 2517 elif plottype == 'SASD': 2456 2518 statLine = 'q =%12.5g Intensity =%12.5g d =%9.1f'%(q,ypos,dsp) … … 3267 3329 Page.plotStyle['qPlot'] = False 3268 3330 Page.plotStyle['dPlot'] = False 3331 # keys in use for graphics control: 3332 # a,b,c,d,e,f,g,i,l,m,n,o,p,q,r,s,t,u,w,x, (unused: j, k, y, z) 3333 # also: +,/, C,D,S,U 3269 3334 if G2frame.Contour: 3270 3335 Page.Choice = (' key press','b: toggle subtract background', … … 3273 3338 'o: reset contour limits','g: toggle grid', 3274 3339 'i: interpolation method','S: color scheme','c: contour off', 3275 't: temperature for y-axis','s: toggle sqrt plot', 3340 'e: toggle temperature for y-axis','s: toggle sqrt plot', 3341 'w: toggle w(Yo-Yc) contour plot','h: toggle channel # plot', 3342 'q: toggle Q plot','t: toggle d-spacing plot', 3276 3343 'C: contour plot control window', 3277 'w: toggle w(Yo-Yc) contour plot'3278 3344 ) 3279 3345 else: … … 3292 3358 '+: toggle obs line plot'] 3293 3359 else: 3294 Page.Choice += ['q: toggle q plot','s: toggle sqrt plot', 3295 't: toggle d-spacing plot','w: toggle (Io-Ic)/sig plot', 3296 '+: toggle obs line plot'] 3360 Page.Choice += [ 3361 'q: toggle Q plot','t: toggle d-spacing plot', 3362 's: toggle sqrt plot','w: toggle (Io-Ic)/sig plot', 3363 '+: toggle obs line plot'] 3297 3364 if Page.plotStyle['sqrtPlot'] or Page.plotStyle['logPlot']: 3298 3365 del Page.Choice[1] … … 3399 3466 if timeDebug: 3400 3467 print('plot build time: %.3f for %dx%d patterns'%(time.time()-time0,len(PlotList[0][1][1]),len(PlotList))) 3401 lenX = 0 3468 lenX = 0 # length of first histogram, used for contour plots 3402 3469 Ymax = None 3403 3470 for ip,Pattern in enumerate(PlotList): … … 3421 3488 if Page.plotStyle['qPlot'] or plottype in ['SASD','REFD'] and not G2frame.Contour and not ifLimits: 3422 3489 xLabel = r'$Q, \AA^{-1}$' 3423 elif Page.plotStyle['dPlot'] and 'PWDR' in plottype and not G2frame.Contour and notifLimits:3490 elif Page.plotStyle['dPlot'] and 'PWDR' in plottype and not ifLimits: 3424 3491 xLabel = r'$d, \AA$' 3492 elif Page.plotStyle['chanPlot'] and G2frame.Contour: 3493 xLabel = 'Channel no.' 3425 3494 else: 3426 3495 if 'T' in ParmList[0]['Type'][0]: 3427 if G2frame.Contour: 3428 xLabel = r'Channel no.' 3429 else: 3430 xLabel = r'$TOF, \mathsf{\mu}$s' 3496 xLabel = r'$TOF, \mathsf{\mu}$s' 3431 3497 elif 'E' in ParmList[0]['Type'][0]: 3432 3498 xLabel = 'E, keV' 3433 3499 else: 3434 3500 xLabel = r'$\mathsf{2\theta}$' 3501 3435 3502 if G2frame.Weight and not G2frame.Contour: 3436 3503 Plot.set_visible(False) #hide old plot frame, will get replaced below … … 3477 3544 ContourZ = [] 3478 3545 ContourY = [] 3546 ContourX = None 3547 Xlist = [] 3548 X0 = None 3479 3549 Nseq = 0 3480 3550 Nmax = len(PlotList)-1 3481 3551 time0 = time.time() 3552 Plot.figure.subplots_adjust(right=.95) 3553 if G2frame.Contour and G2frame.TforYaxis: 3554 Plot.set_ylabel('Temperature',fontsize=14) 3555 elif G2frame.Contour: 3556 Plot.set_ylabel('Data sequence',fontsize=14) 3557 unequalArrays = False # set to True for contour plots with unequal pixels 3558 avgStep = None 3559 if G2frame.Contour: # detect unequally spaced points in a contour plot 3560 for N,Pattern in enumerate(PlotList): 3561 xye = np.array(ma.getdata(Pattern[1])) # strips mask = X,Yo,W,Yc,Yb,Yd 3562 if Page.plotStyle['qPlot'] and 'PWDR' in plottype and not ifLimits: 3563 X = 2.*np.pi/G2lat.Pos2dsp(Parms,xye[0]) 3564 elif Page.plotStyle['dPlot'] and 'PWDR' in plottype and not ifLimits: 3565 X = G2lat.Pos2dsp(Parms,xye[0]) 3566 else: 3567 X = copy.deepcopy(xye[0]) 3568 if not X0: 3569 X0 = X[0] # save 1st point in 1st pattern 3570 elif abs(X0 - X[0]) > 0.05 * X0: 3571 unequalArrays = True 3572 if Page.plotStyle['qPlot'] or Page.plotStyle['dPlot']: # not in original units 3573 unequalArrays = True 3574 elif 'T' in ParmList[0]['Type'][0] and not Page.plotStyle['chanPlot']: # assume TOF is non-linear steps 3575 unequalArrays = True 3576 # check to see if the average step size changes across the selected patterns 3577 elif avgStep is None and not unequalArrays: 3578 avgStep = (X[-1]-X[0])/(len(X)-1) 3579 elif not unequalArrays and abs(avgStep - (X[-1]-X[0])/(len(X)-1)) > 0.05 * avgStep: 3580 unequalArrays = True 3581 3582 ExMask = [] 3482 3583 for N,Pattern in enumerate(PlotList): 3483 3584 Parms = ParmList[N] … … 3488 3589 if Pattern[1] is None: continue # skip over uncomputed simulations 3489 3590 xye = np.array(ma.getdata(Pattern[1])) # strips mask = X,Yo,W,Yc,Yb,Yd 3490 xye0 = Pattern[1][0] # keeps mask3491 if PickId: 3591 ExMask.append(np.full(len(xye[0]),False)) 3592 if PickId: # when is this not true? 3492 3593 ifpicked = Pattern[2] == G2frame.GPXtree.GetItemText(PatternId) 3493 3594 # recompute mask from excluded regions, in case they have changed 3595 xye0 = xye[0] # no mask in case there are no limits 3494 3596 for excl in limits[2:]: 3495 3597 xye0 = ma.masked_inside(xye[0],excl[0],excl[1],copy=False) #excluded region mask 3496 if not G2frame.Contour: 3497 xye0 = ma.masked_outside(xye[0],limits[1][0],limits[1][1],copy=False) #now mask for limits 3598 if unequalArrays: 3599 if ma.is_masked(xye0): 3600 ExMask[N] = ma.getmask(xye0) # save excluded regions 3601 xye0 = ma.masked_outside(xye[0],limits[1][0],limits[1][1],copy=False) #now mask for limits 3602 Lmask = ma.getmask(xye0) # limits applied 3603 ExMask[N] = ExMask[N][~Lmask] # drop points outside limits 3604 elif not G2frame.Contour: 3605 xye0 = ma.masked_outside(xye0,limits[1][0],limits[1][1],copy=False) #now mask for limits 3606 else: 3607 xye0 = Pattern[1][0] # keeps mask 3608 Lmask = Emask = np.full(len(xye0),False) 3609 3610 if G2frame.Contour: 3611 xye0 = xye[0] # drop mask 3612 3498 3613 if Page.plotStyle['qPlot'] and 'PWDR' in plottype and not ifLimits: 3499 3614 X = 2.*np.pi/G2lat.Pos2dsp(Parms,xye0) … … 3584 3699 Y = ma.array(Y,mask=ma.getmask(X)) 3585 3700 3586 if ifpicked :3701 if ifpicked and not G2frame.Contour: # draw limit & excluded region lines 3587 3702 lims = limits[1:] 3588 3703 if Page.plotStyle['qPlot'] and 'PWDR' in plottype and not ifLimits: … … 3590 3705 elif Page.plotStyle['dPlot'] and 'PWDR' in plottype and not ifLimits: 3591 3706 lims = G2lat.Pos2dsp(Parms,lims) 3592 # plotlimit lines3707 # limit lines 3593 3708 Lines.append(Plot.axvline(lims[0][0],color='g',dashes=(5,5), 3594 3709 picker=True,pickradius=3.)) 3595 3710 Lines.append(Plot.axvline(lims[0][1],color='r',dashes=(5,5), 3596 3711 picker=True,pickradius=3.)) 3597 # plotexcluded region lines3712 # excluded region lines 3598 3713 for i,item in enumerate(lims[1:]): 3599 3714 Lines.append(Plot.axvline(item[0],color='m',dashes=(5,5), … … 3602 3717 picker=True,pickradius=3.)) 3603 3718 exclLines += [2*i+2,2*i+3] 3604 if G2frame.Contour: 3605 if len(X) == lenX:3606 if G2frame.Weight:3607 ContourZ.append((xye[1]-xye[3])*np.sqrt(xye[2]))3719 if G2frame.Contour: 3720 if Page.plotStyle['chanPlot']: 3721 if unequalArrays: 3722 X = np.array(range(len(X)),float) 3608 3723 else: 3609 ContourZ.append(Y) 3610 elif len(X) < lenX: 3611 Yext = np.ones(lenX)*Y[-1] 3612 Yext[:len(X)] = Y 3724 X = np.array(range(lenX),float) 3725 Lmask = Emask = np.full(len(X),False) 3726 if G2frame.Weight: 3727 Ytmp = (xye[1]-xye[3])*np.sqrt(xye[2]) 3728 else: 3729 Ytmp = Y 3730 # pad or truncate arrays when plotting with mpl.imshow 3731 if unequalArrays: 3732 ContourZ.append(Ytmp[~Lmask]) 3733 elif len(Y) < lenX: 3734 Yext = np.ones(lenX)*Ytmp[-1] 3735 Yext[:len(X)] = Ytmp 3613 3736 ContourZ.append(Yext) 3737 elif len(Y) > lenX: 3738 ContourZ.append(Ytmp[:lenX]) 3614 3739 else: 3615 ContourZ.append(Y[:len(X)]) 3740 ContourZ.append(Ytmp) 3741 #if unequalArrays and G2frame.TforYaxis: 3742 # TODO: could set this to temperature and then plot 3743 # against temperature, but this only works if patterns are sorted by T 3616 3744 ContourY.append(N) 3617 if 'C' in ParmList[0]['Type'][0]: 3745 if unequalArrays: 3746 Xlist.append(X[~Lmask]) 3747 elif ContourX is None: 3618 3748 ContourX = X 3619 else: #'T'OF3620 ContourX = range(lenX)3621 3749 Nseq += 1 3622 if G2frame.TforYaxis:3623 Plot.set_ylabel('Temperature',fontsize=14)3624 else:3625 Plot.set_ylabel('Data sequence',fontsize=14)3626 3750 else: 3627 3751 if not G2frame.plusPlot: … … 3933 4057 else: 3934 4058 Plot.legend(handles,legends,title='Data',loc='best') 3935 4059 3936 4060 if G2frame.Contour: 3937 4061 time0 = time.time() … … 3939 4063 Vmin = Ymax*G2frame.Cmin 3940 4064 Vmax = Ymax*G2frame.Cmax 3941 if G2frame.Weight: 3942 Vmin = np.min(ContourZ) 3943 Vmax = np.max(ContourZ) 3944 Page.Img = Plot.imshow(ContourZ,cmap=acolor,vmin=Vmin,vmax=Vmax, 3945 interpolation=G2frame.Interpolate,extent=[ContourX[0],ContourX[-1],ContourY[0]-.5,ContourY[-1]+.5], 3946 aspect='auto',origin='lower') 3947 if G2frame.TforYaxis: 3948 imgAx = Page.Img.axes 3949 ytics = imgAx.get_yticks() 3950 # ytics = np.where(ytics<len(Temps),ytics,-1) 3951 # imgAx.set_yticks(ytics) 3952 ylabs = [Temps[int(i)] for i in ytics[:-1]] 3953 imgAx.set_yticklabels(ylabs) 3954 Page.figure.colorbar(Page.Img) 4065 if unequalArrays: 4066 if G2frame.Weight: 4067 #Vmin = min([i.min() for i in ContourZ]) 4068 Vmin = min([ma.array(i,mask=m).min() for i,m in zip(ContourZ,ExMask)]) # don't count excluded points in limits 4069 #Vmax = max([i.max() for i in ContourZ]) 4070 Vmax = max([ma.array(i,mask=m).max() for i,m in zip(ContourZ,ExMask)]) 4071 if G2frame.TforYaxis: 4072 imgLbls = Temps 4073 else: 4074 imgLbls = [] 4075 uneqImgShow(Plot.figure,Plot,Xlist,ContourZ,cmap=acolor, 4076 vmin=Vmin,vmax=Vmax,Ylbls=imgLbls) 4077 Page.Img = None # don't have an overall image 4078 if G2frame.TforYaxis: 4079 Plot.yaxis.set_label_coords(-.1, .5) 4080 else: 4081 Plot.yaxis.set_label_coords(-.05, .5) 4082 Plot.xaxis.set_label_coords(0.5, -.07) 4083 else: 4084 if G2frame.Weight: 4085 Vmin = np.min(ContourZ) 4086 Vmax = np.max(ContourZ) 4087 Page.Img = Plot.imshow(ContourZ,cmap=acolor,vmin=Vmin,vmax=Vmax, 4088 interpolation=G2frame.Interpolate,extent=[ContourX[0],ContourX[-1],ContourY[0]-.5,ContourY[-1]+.5], 4089 aspect='auto',origin='lower') 4090 if G2frame.TforYaxis: 4091 imgAx = Page.Img.axes 4092 ytics = imgAx.get_yticks() 4093 # ytics = np.where(ytics<len(Temps),ytics,-1) 4094 # imgAx.set_yticks(ytics) 4095 ylabs = [Temps[int(i)] for i in ytics[:-1]] 4096 imgAx.set_yticklabels(ylabs) 4097 Page.figure.colorbar(Page.Img) 3955 4098 if timeDebug: 3956 4099 print('Contour display time: %.3f'%(time.time()-time0)) … … 6062 6205 #### Plot3dXYZ ################################################################################ 6063 6206 def Plot3dXYZ(G2frame,nX,nY,Zdat,labelX=r'X',labelY=r'Y',labelZ=r'Z',newPlot=False,Title='',Centro=False): 6064 6207 '''Creates a surface Plot for 3D vectors''' 6065 6208 def OnMotion(event): 6066 6209 xpos = event.xdata
Note: See TracChangeset
for help on using the changeset viewer.