Changeset 3358 for trunk/GSASIIplot.py
- Timestamp:
- Apr 26, 2018 11:46:19 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIplot.py
r3356 r3358 2470 2470 if G2frame.logPlot: 2471 2471 Title = 'log('+Title+')' 2472 #Plot.set_title(Title) # show title only w/o magnification2473 2472 if G2frame.plotStyle['qPlot'] or plottype in ['SASD','REFD'] and not G2frame.Contour: 2474 2473 xLabel = r'$Q, \AA^{-1}$' … … 2484 2483 xLabel = r'$TOF, \mathsf{\mu}$s' 2485 2484 if G2frame.Weight: 2486 Plot.tick_params('x',length=0,labelbottom=False) 2487 Plot.tick_params('y',length=0,labelleft=False) 2485 Plot.set_visible(False) #hide old plot frame, will get replaced below 2488 2486 GS_kw = {'height_ratios':[4, 1],} 2489 2487 try: … … 5598 5596 G2frame.cid = None 5599 5597 #Dsp = lambda tth,wave: wave/(2.*npsind(tth/2.)) 5600 global Data,Masks,StrSta # RVD: these are needed for multiple image controls/masks5598 global Data,Masks,StrSta,Plot1 # RVD: these are needed for multiple image controls/masks 5601 5599 colors=['b','g','r','c','m','k'] 5602 5600 Data = G2frame.GPXtree.GetItemPyData( … … 5639 5637 Page.SetToolTipString('%6d deg'%(azm)) 5640 5638 elif 'line1' in str(item) or 'line2' in str(item): 5641 Page.SetToolTipString('%8.3f deg'%(tth)) 5639 Page.SetToolTipString('%8.3f deg'%(tth)) 5640 elif 'linescan' in str(item): 5641 Data['linescan'][1] = azm 5642 Page.SetToolTipString('%6.1f deg'%(azm)) 5642 5643 else: 5643 5644 xcent,ycent = Data['center'] … … 5750 5751 tth,azm,D,dsp = G2img.GetTthAzmDsp(xpos,ypos,Data) 5751 5752 G2frame.calibDmin.SetValue(dsp) 5752 elif event.key == 'l':5753 G2frame.logPlot = not G2frame.logPlot5754 5753 elif event.key in ['x',]: 5755 5754 Data['invert_x'] = not Data['invert_x'] … … 5781 5780 Data['LRazimuth'][1] = int(azm) 5782 5781 Data['LRazimuth'][1] %= 360 5782 elif 'linescan' in itemPicked: 5783 Data['linescan'][1] = azm 5783 5784 else: 5784 5785 return … … 5825 5826 elif 'line4' in itemPicked and 'Line2D' in itemPicked: 5826 5827 pick.set_data([[arcxI[-1],arcxO[-1]],[arcyI[-1],arcyO[-1]]]) 5828 elif 'linescan' in itemPicked: 5829 azm = Data['linescan'][1] 5830 dspI = wave/(2.0*sind(0.1/2.0)) 5831 xyI = G2img.GetDetectorXY(dspI,azm,Data) 5832 dspO = wave/(2.0*sind(60./2.0)) 5833 xyO = G2img.GetDetectorXY(dspO,azm,Data) 5834 pick.set_data([[xyI[0],xyO[0]],[xyI[1],xyO[1]]]) 5835 xy = G2img.GetLineScan(G2frame.ImageZ,Data) 5836 Plot1.cla() 5837 Plot1.plot(xy[0],xy[1]) 5838 Page.canvas.draw() 5839 5827 5840 Page.figure.gca().draw_artist(pick) 5828 5841 Page.canvas.blit(Page.figure.gca().bbox) … … 6249 6262 xylim = [] 6250 6263 new,plotNum,Page,Plot,lim = G2frame.G2plotNB.FindPlotTab('2D Powder Image','mpl',newImage=newImage) 6264 6265 if Data.get('linescan',[False,0.])[0]: 6266 Plot.set_visible(False) 6267 GS_kw = {'width_ratios':[1,2],} 6268 try: 6269 Plot1,Plot = Page.figure.subplots(1,2,gridspec_kw=GS_kw) 6270 except AttributeError: # figure.Figure.subplots added in MPL 2.2 6271 Plot1,Plot = MPLsubplots(Page.figure, 1,2, gridspec_kw=GS_kw) 6272 Plot1.set_title('Line scan at azm= %6.1f'%Data['linescan'][1]) 6273 Plot1.set_xlabel(r'$\mathsf{2\Theta}$',fontsize=12) 6274 Plot1.set_ylabel('Intensity',fontsize=12) 6275 xy = G2img.GetLineScan(G2frame.ImageZ,Data) 6276 Plot1.plot(xy[0],xy[1]) 6277 Plot1.set_xlim(Data['IOtth']) 6278 Plot1.set_xscale("linear") 6251 6279 if newImage: 6252 6280 G2frame.MaskKey = '' # subtitle will be removed, so turn off mode … … 6263 6291 Title = G2frame.GPXtree.GetItemText(G2frame.Image)[4:] 6264 6292 G2frame.G2plotNB.status.DestroyChildren() #get rid of special stuff on status bar 6265 if G2frame.logPlot:6266 Title = 'log('+Title+')'6267 6293 Plot.set_title(Title) 6268 6294 try: 6269 6295 if G2frame.GPXtree.GetItemText(G2frame.PickId) in ['Image Controls',]: 6270 Page.Choice = (' key press',' l: log(I) on','d: set dmin','x: flip x','y: flip y',)6271 if G2frame.logPlot:6272 Page.Choice[1] = 'l: log(I) off'6296 Page.Choice = (' key press','c: set beam center','d: set dmin','x: flip x','y: flip y',) 6297 # if G2frame.logPlot: 6298 # Page.Choice[1] = 'l: log(I) off' 6273 6299 Page.keyPress = OnImPlotKeyPress 6274 6300 elif G2frame.GPXtree.GetItemText(G2frame.PickId) in ['Masks',]: 6275 Page.Choice = [' key press',' l: log(I) on','a: arc mask','r: ring mask',6301 Page.Choice = [' key press','a: arc mask','r: ring mask', 6276 6302 'p: polygon mask','f: frame mask', 6277 6303 't: add spot mask at mouse position', … … 6280 6306 ' (space) input the spot mask diameter'] 6281 6307 Page.Choice.append('s: start multiple spot mask mode') # this must be the last choice 6282 if G2frame.logPlot:6283 Page.Choice[1] = 'l: log(I) off'6284 6308 Page.keyPress = OnImPlotKeyPress 6285 6309 elif G2frame.GPXtree.GetItemText(G2frame.PickId) in ['Stress/Strain',]: … … 6315 6339 A = G2img.ImageCompress(MA,imScale) 6316 6340 AM = G2img.ImageCompress(MaskA,imScale) 6317 if G2frame.logPlot:6318 A = np.where(A>Imin,np.where(A<Imax,A,0),0)6319 A = np.where(A>0,np.log(A),0)6320 AM = np.where(AM>0,np.log(AM),0)6321 Imin,Imax = [np.amin(A),np.amax(A)]6322 6341 Plot.imshow(AM,aspect='equal',cmap='Reds', 6323 6342 interpolation='nearest',vmin=0,vmax=2,extent=[0,Xmax,Ymax,0]) … … 6326 6345 6327 6346 Plot.plot(xcent,ycent,'x') 6328 #G2frame.GPXtree.GetItemText(item)6329 6347 if Data['showLines']: # draw integration range arc/circles/lines 6330 6348 LRAzim = Data['LRazimuth'] #NB: integers … … 6368 6386 ind = np.searchsorted(Azm,cake) 6369 6387 Plot.plot([arcxI[ind],arcxO[ind]],[arcyI[ind],arcyO[ind]],color='k',dashes=(5,5)) 6388 if 'linescan' in Data and Data['linescan'][0]: 6389 azm = Data['linescan'][1] 6390 IOtth = [0.1,60.] 6391 wave = Data['wavelength'] 6392 dspI = wave/(2.0*sind(IOtth[0]/2.0)) 6393 xyI = G2img.GetDetectorXY(dspI,azm,Data) 6394 dspO = wave/(2.0*sind(IOtth[1]/2.0)) 6395 xyO = G2img.GetDetectorXY(dspO,azm,Data) 6396 Plot.plot([xyI[0],xyO[0]],[xyI[1],xyO[1]],picker=3,label='linescan') 6370 6397 6371 6398 if G2frame.PickId and G2frame.GPXtree.GetItemText(G2frame.PickId) in ['Image Controls',]:
Note: See TracChangeset
for help on using the changeset viewer.