📄 plotseismic.m
字号:
function plotseismic(seis,t,x,kol)
% PLOTSEISMIC: A wtva seismic viewer with GUI controls
%
% plotseismic(seis,t,x)
%
% seis ... input seismic matrix, one trace per column
% t ... column vector of times, one entry per row of seis
% ********** default = 1:size(seis,1) ************
% x ... row vector of distances, one entry per column of seis
% ********** default = 1:size(seis,2) ************
% kol ... color to draw traces with
% ********** default = 'b' (blue) **********
%
% G.F. Margrave, CREWES, 2001
%
% NOTE: It is illegal for you to use this software for a purpose other
% than non-profit education or research UNLESS you are employed by a CREWES
% Project sponsor. By using this software, you are agreeing to the terms
% detailed in this software's Matlab source file.
% BEGIN TERMS OF USE LICENSE
%
% This SOFTWARE is maintained by the CREWES Project at the Department
% of Geology and Geophysics of the University of Calgary, Calgary,
% Alberta, Canada. The copyright and ownership is jointly held by
% its author (identified above) and the CREWES Project. The CREWES
% project may be contacted via email at: crewesinfo@crewes.org
%
% The term 'SOFTWARE' refers to the Matlab source code, translations to
% any other computer language, or object code
%
% Terms of use of this SOFTWARE
%
% 1) Use of this SOFTWARE by any for-profit commercial organization is
% expressly forbidden unless said organization is a CREWES Project
% Sponsor.
%
% 2) A CREWES Project sponsor may use this SOFTWARE under the terms of the
% CREWES Project Sponsorship agreement.
%
% 3) A student or employee of a non-profit educational institution may
% use this SOFTWARE subject to the following terms and conditions:
% - this SOFTWARE is for teaching or research purposes only.
% - this SOFTWARE may be distributed to other students or researchers
% provided that these license terms are included.
% - reselling the SOFTWARE, or including it or any portion of it, in any
% software that will be resold is expressly forbidden.
% - transfering the SOFTWARE in any form to a commercial firm or any
% other for-profit organization is expressly forbidden.
%
% END TERMS OF USE LICENSE
if(nargin<1)
error('plotseismic requires at least one input');
elseif(nargin==1)
if(isstr(seis))
action=seis;
else
action='init';
t=1:size(seis,1);
x=1:size(seis,2);
kol='b';
end
elseif(nargin<3)
action='init';
x=1:size(seis,2);
kol='b';
elseif(nargin<4)
action='init';
kol='b';
elseif(nargin==4)
action='init';
else
error('plotseismic can have no more than four input arguments');
end
if(strcmp(action,'init'))
pscale=2;
cliplvl=1;
hfig=figure;
set(hfig,'menubar','none')
%add a close button, a hardcopy button, a msg panel, and install simple zooming
sep=1;
xnow=sep;
ynow=sep;
width=40;
height=20;
hclose=uicontrol('style','pushbutton','string','Close','position',...
[xnow,ynow,width,height],'callback','close(gcf)','visible','off');
%xnow=xnow+width+sep;
width=110;
hamp=uicontrol('style','popupmenu','string','Amp: independent|Amp: master|Amp: slave',...
'value',1,'position',[xnow,ynow,width,height],'callback','plotseismic(''replot'')',...
'tooltipstring','Specify amplitude scaling control');
% make an ampllitude control
xnow=xnow+width+sep;
width=60;
ampstring=['Amp lvl ' num2str(pscale)];
fsize=get(0,'factoryuicontrolfontsize');
hamplabel=uicontrol('style','text','fontsize',fsize,'string',ampstring,'position',...
[xnow,ynow+height/2,width,2*height/3],'tooltipstring','Current value of amplitude level');
hampslider=uicontrol('style','slider','string','Amplevel','position',...
[xnow,ynow,width,height/2],'callback','plotseismic(''champ'')',...
'tooltipstring','Change the seismic amplitude level','max',10,'min',.2,...
'tag','amplevel','value',pscale,'userdata',hamplabel,'sliderstep',[1/9.8 .2/9.8]);
xnow=xnow+width+sep;
width=60;
fsize=get(0,'factoryuicontrolfontsize');
hlabel=uicontrol('style','text','fontsize',fsize,'string','Phase 0','position',...
[xnow,ynow+height/2,width,2*height/3],'tooltipstring','Current value of seismic phase');
hslider=uicontrol('style','slider','string','Phase','position',...
[xnow,ynow,width,height/2],'callback','plotseismic(''phase'')',...
'tooltipstring','Rotate the seismic phase','max',180,'min',-180,...
'tag','phase','value',0,'userdata',hlabel,'sliderstep',[10/360 1/360]);
xnow=xnow+width+sep;
width=40;
polarity=1;
hpolbut=uicontrol('style','pushbutton','string','Polarity','position',...
[xnow,ynow,width,height],'callback','plotseismic(''polarity'')',...
'tooltipstring','Flip the seismic polarity','userdata',polarity);
black=[0 0 0];white=[1 1 1];
grey=[.7529 .7529 .7529];
if( polarity==-1 )
set(hpolbut,'backgroundcolor',black,'foregroundcolor',white)
end
% the value of polarity is stored in the menu hpolarity
xnow=xnow+width+sep;
width=300;
button=1;
msg= 'MB1: drag to zoom, click to unzoom';
%this is now retired. Its invisible instead of deleted because its userdata is needed
hmsg=uicontrol('style','text','string',msg,'visible','off',...
'position',[xnow,ynow,width,height]);
%hmessage=uimenu(hfig,'label',msg,'selectionhighlight','off','hittest','off');
set(gcf,'name',['PLOTSEISMIC ... ' msg])
% set(gcf,'name',['PLOTSEISMIC ... ' msg],'numbertitle','off')
width=60;
hbigwhite=uicontrol('style','pushbutton','string','Bigfont etc.',...
'position',[xnow,ynow,width,height],'callback','plotseismic(''bigfontetc'')',...
'tooltipstring','Double fontsize and linewidth, white background','tag','to');
%hbigwhite's userdata is used in the callback
xnow=xnow+width+sep;
%clipboard button
width=50;
if(ispc)
hcopyclip=uicontrol('style','pushbutton','string','Clipboard','position',...
[xnow,ynow,width,height],'callback','plotseismic(''toclip'')',...
'tooltipstring','Copy figure to the Windows clipboard');
else
hcopyclip=uicontrol('style','pushbutton','string','Tiff','position',...
[xnow,ynow,width,height],'callback','plotseismic(''toclip'')',...
'tooltipstring','Create tiff file');
end
xnow=xnow+width+sep;
width=35;
htitbut=uicontrol('style','pushbutton','string','Retitle','position',...
[xnow,ynow,width,height],'callback','plotseismic(''retitle'')',...
'tooltipstring','Change the figure title');
%set(htitbut,'userdata',hist);
xnow=xnow+width+sep;
width=35;
yscale=10;
hhardcopy=uicontrol('style','pushbutton','string','Print','position',...
[xnow,ynow,width,height],'callback','plotseismic(''print'')',...
'userdata',yscale,'tooltipstring','Controlled-scale hardcopy');
set(gcf,'userdata',[hclose,hhardcopy,hmsg,0,0,0,0,...
0,0,0,0,0,0,0,hamp,0,htitbut,hcopyclip,hbigwhite,hslider,...
0,hpolbut,hlabel hampslider hamplabel]);
%add a context menu to both axes
hcntx=uicontextmenu;
hpub=uimenu(hcntx,'label','Publish Zoom Limits','callback','plotseismic(''pubzoom'')','separator','on',...
'enable','on');
hmatch=uimenu(hcntx,'label','Match Zoom','callback','plotseismic(''matchzoom'')','enable','on');
set(gca,'UIcontextmenu',hcntx);
simplezoom(button,'plotseismic(''finzoom'')');
%store seismic data
%chek seismic for nans
ind=find(isnan(seis));
if(~isempty(ind))
seis(ind)=0;
end
set(hclose,'userdata',{seis t x })
set(hamp,'userdata',[pscale cliplvl]);
%the userdata of hlabel is reserved for the Hilbert transform
set(hmsg,'userdata',kol);
plotseismic('replot');
return;
elseif(strcmp(action,'finzoom'))
h=get(gcf,'userdata');
xl=get(gca,'xlim');
yl=get(gca,'ylim');
h(5:8)=[xl yl];
set(gcf,'userdata',h)
%xl=h(5:6);
%set(gca,'xlim',xl);
%no action required
return;
elseif(strcmp(action,'print'))
h=get(gcf,'userdata');
hclose=h(1);
hhard=h(2);
hmsg=h(3);
hseis=gca;
hamp=h(15);
htitbut=h(17);
hcopyclip=h(18);
hbigfont=h(19);
hpolbut=h(22);
hlabel=h(23);
hslider=h(20);
hamplabel=h(25);
hampslider=h(24);
yscale = get(hhard,'userdata');
%ask for scale info
q={'Timing scale (inches/second)'};
a={num2str(yscale)};
answer = askthingsle('questions',q,'answers',a,'Enter plotting scale');
if isempty(answer)
return;
end
yscale=sscanf(answer{1},'%G');
printhist=0;
set(hhard,'userdata',yscale)%save the new scale
% y dimensions
ylim=get(hseis,'ylim');%yaxis limits
ysize=yscale*abs(diff(ylim));%required size of y axis
set(hseis,'units','inches');%set y units to inches
ps=get(hseis,'position');
ysizeold=ps(4);
ps(4)=ysize;
set(hseis,'position',ps);
set(hmsg,'visible','off')
%see if the figure must be resized
resize=0;
if(ysize>ysizeold | printhist)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -