⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 picksle.m

📁 基于matlab的反演程序,用于地球物理勘探中射线追踪及偏移成像程序.
💻 M
📖 第 1 页 / 共 3 页
字号:
    pref.askdetail=checkinput{2};
    pref.checkfields=checkfields;
else
    % NOTE, when adding new prefereance to program, you must also add them
    % to the data check section
    pref.showprogress=[]; % empty means no show progress
    pref.sampleadd=[100];
    pref.percenttolerance=[.70];
    pref.nodetolerance=[5];
    pref.hmsg=[];
end    
% saveing data in handle
set(gca,'userdata',pref);
buttondownstr=['bdown'];   % info is going to be sent through one argument
% setting gcf buttons
set(masterfig,'windowbuttondownfcn',['picksle(''' buttondownstr ''');']);

%---------------
%- Button Down -
%---------------
%
% The initial button down for picksle
function PLE_buttondown(hhandle)
checkobj=get(gco,'type');
checkclick=get(gcf,'selectiontype');
if(strcmp(checkobj,'figure')|~strcmp(checkclick,'normal'))
    % doing nothing 'cause click should take place in axes, not figure
    % or click is not a left mouse button click
    return
else

end
% checking to make sure that data is still available
checkdata=PLE_checkdata(get(gca,'userdata'));
pref=get(gca,'userdata');
if(isempty(checkdata)||isempty(pref))
    % if preferences are gone, either wrong axes has been clicked on, or
    % data is gonzo
    return
end
%--- Getting Data ---
masteraxes=getfield(pref,'axes');
seisstruct=getfield(pref,'seisstruct');
%----------
masterfig=get(masteraxes,'parent');
if(gca~=masteraxes)
    % user is not clicking in master axes
    return
end
pt=get(gca,'currentpoint');

hln=line([pt(1,1) pt(1,1)],[pt(1,2) pt(1,2)],'color','r','linestyle','-',...
    'tag','PICKSLE-LINE','erasemode','xor');
% setting windowbutton functions
buttonmotionstr=['bmotion'];
set(masterfig,'windowbuttonmotionfcn',['picksle(''' buttonmotionstr ''');']);
buttonupstr=['bup'];
set(masterfig,'windowbuttonupfcn',['picksle(''' buttonupstr ''');']);
%--- Saving Data ---
pref.holddat={pt hln};
set(gca,'userdata',pref);
%-------------------

%----------
%- Motion -
%----------
%
% Motion o' the line
function PLE_motion(hhandle,transfer)
%--- Getting Data ---
pref=get(gca,'userdata');
masteraxes=getfield(pref,'axes');
seisstruct=getfield(pref,'seisstruct');
dat=getfield(pref,'holddat');
%----------
oldpt=dat{1};
hln=dat{2};
newpt=get(gca,'currentpoint');
xdat=get(gca,'xlim');
ydat=get(gca,'ylim');
xdat=sort([xdat(1) xdat(2) newpt(1,1)]);
ydat=sort([ydat(1) ydat(2) newpt(1,2)]);
xln=get(hln,'xdata');
yln=get(hln,'ydata');
set(hln,'xdata',[xln(1) xdat(2)],'ydata',[yln(1) ydat(2)]);
%--- Saving Data ---
pref.holddat={newpt hln};
set(gca,'userdata',pref);
%-------------------


%-------------
%- Button Up -
%-------------
%
% Second last step in the war on finding lines
function PLE_up(hhandle)
% setting windowbutton functions
set(gcf,'windowbuttonmotionfcn','');
set(gcf,'windowbuttonupfcn','');% checking to make sure that data is still available
% checking to make sure that data is still available
checkdata=PLE_checkdata(get(gca,'userdata'));
if(isempty(checkdata))
    return
end
%--- Getting Data ---
pref=get(gca,'userdata');
masteraxes=getfield(pref,'axes');
seisstruct=getfield(pref,'seisstruct');
dat=getfield(pref,'holddat');
hmsg=getfield(pref,'hmsg');
transfer=getfield(pref,'transfer');
sampleadd=getfield(pref,'sampleadd');
lockto=getfield(pref,'lockto');
percenttolerance=getfield(pref,'percenttolerance');
nodetolerance=getfield(pref,'nodetolerance');
showprogress=getfield(pref,'showprogress');
lockto=getfield(pref,'lockto');
askdetail=getfield(pref,'askdetail');
%----------
xlm=get(gca,'xlim');
ylm=get(gca,'ylim');
hln=dat{2};
% getting relavent line data
xlndat=get(hln,'xdata');
xdat=sort(xlndat);
xstr=xlndat(1);
xend=xlndat(2);
ylndat=get(hln,'ydata');
ydat=sort(ylndat);
% yyy=sort([ylndat(1) ylndat(2)]);
ystr=ylndat(1);
yend=ylndat(2);

delete(hln);    % deleting the guide line
seis=getfield(seisstruct,'SEIS');
t=getfield(seisstruct,'T');
x=getfield(seisstruct,'X');

% checking to make sure that T and X similr to the x and y limits of the
% axes.
if((t(end)-t(1))*(ylm(2)-ylm(1))<0)
    % values are opposite, t will be forced to be same as axes
    tcha=[];
    for ii=1:length(t)
        if(ii==length(t))
            tcha=[tcha t(1)];
        else
            tcha=[tcha t(length(t)-ii+1)];
        end
    end
    t=tcha;
end
if((x(end)-x(1))*(xlm(2)-xlm(1))<0)
    % values are opposite, t will be forced to be same as axes
    xcha=[];
    for ii=1:length(x)
        if(ii==length(x))
            xcha=[xcha x(1)];
        else
            xcha=[xcha x(length(x)-ii+1)];
        end
    end
    x=xcha;
end
% finding where user has clicked, this could appear strange on the plot
y1=find(t>=ydat(1));
y2=find(t<=ydat(2));
x1=find(x>=xdat(1));
x2=find(x<=xdat(2));
xnum=[x1(1):x2(end)];
xnew=x(x1(1):1:x2(end));
ystuff=[t(y1(1)) t(y2(end))];   % for debugging
if(isempty(xnew))
    % going to cross correlate across the the entire image, have to ask
    % user for permission
    checkwuser=questdlg('Do you want to check for picks across entire section?',...
        'Check for pics?','Yes','No','Yes');
    switch checkwuser
        case 'Yes'
            xnum=[1:1:length(x)];
        case 'No'
            return
    end
    checkx=1;
end
xnew=x(xnum);
seisnew=seis(:,xnum);
% getting data out of PicksData
% tolerance is going to have two different means
% one will be for depth in seconds
% the second one is for depth in meters, or any other unit for that matter
% nearest value, peak, trogh, and zero crossing, has to be in initiated
% lockto;
smpladd=sampleadd;
xx=find(xstr<=xnew);
if(xstr==xend)
    nmx=find(x>=xstr);
    nmx(1);
    if(isempty(nmx))
        nmx=find(x<=xend);
        nmx=nmx(end);
    else
        nmx(1);
    end
    strtrc=seisnew(:,nmx(1));
    xfirst=xnum(end);
    swt=2;
elseif(isempty(xx))
    % means line started from smaller to short
    strtrc=seisnew(:,1);
    xfirst=xnum(end);
    swt=2;
else
    strtrc=seisnew(:,end);
    xfirst=xnum(1);
    swt=1;
end
% wavelet midpoint, it may not actually be the middle of the wavelet
% inquestion, but it will be point closest to where user clicked
wvltmid=find(ystr>=t);
% finding the wavelet window
if(isempty(wvltmid))
    wvltmid=1;
elseif(wvltmid(end)-smpladd<0)
    wvltmid=wvltmid(end);
else
    wvltmid=wvltmid(end);
end
if(xstr==xend)
    trc=seisnew(:,x1(1));
elseif(swt==2)
    trc=seisnew(:,end);
elseif(swt==1)
    trc=seisnew(:,1);
else
    % something is wrong
    return
end
% setting up proper format, just in case something has gone wrong
if(size(trc,1)~=size(t,1))
    t=t';
end
if(strcmp(lockto,'open'))
    % do nothing, already set up for open
    checkinglock='checked';
else
    lockto=deblank(lower(lockto));
    nhood=10;
    dataout=nodefind(trc,wvltmid,lockto,nhood);
    wvltmid=dataout;
    if(isempty(wvltmid))
        switch lockto
            case 'peak'
                locktoadd='s';
            case 'trough'
                locktoadd='s';
            case 'zerocross'
                locktoadd='ing';
        end
        stringinfo=['No ' lockto locktoadd ' were found within tolerance area.  Please check your data.'];
        helpdlg(stringinfo,'Check PICKSLE help file');
        return
    end
end
if(strcmpi(askdetail,'on'))
    % showing the user detail of the section chosen for scanning
    trc=[trc t];
    % the following line is just a point marked for debug reference 
    % referancepoint=line([xstr xstr],[ystr ystr],'color','b','marker','*');
    % window extractor
    dataout=winextractor(gca,trc,wvltmid,smpladd,lockto);
    if(isempty(dataout))
        if(isempty(hmsg))     
            return    
        end
        stringinfo='Action Canceled';
        set(hmsg,'string',stringinfo,'backgroundcolor',[1 1 1]);
        return
    end
    pause(.005);    % need to pause to get rid of ghost image of winextrator figure
    wvltmid=getfield(dataout,'midpoint');
    smpladd=getfield(dataout,'samples');
end

if(isempty(wvltmid))
    wvlttop=1;
    wvltmid=1;
elseif(wvltmid(end)-smpladd<0)
    wvltmid=wvltmid(end);
    wvlttop=[1];
    wvltmid=wvltmid(end);
else
    wvltmid=wvltmid(end);
    wvlttop=wvltmid-smpladd;
end
if(size(seisnew,1)<=wvltmid+smpladd)
    wvltbot=size(seisnew,1);
else
    wvltbot=wvltmid+smpladd;
end

wvltwndw=[wvlttop:1:wvltbot]';
% wvltln=line([xstr(1) xstr(1)],[t(wvlttop) t(wvltbot)],'color','r');
% wvltln2=line([xstr(1) xstr(1)],[t(wvlttop) t(wvltbot)],'color','r');
% lns=[wvltln wvltln2];
lns=[];

% creating the "wavelet", again its not a wavelet, but for the lack of a
% better word 'cause i am using window later.
wvlt=strtrc(wvltwndw);
wvltnms=sort([wvlttop,wvltbot]);
% Tolerance checking
if(abs(t(2)-t(1))<0.2)
    % probably not the best way to decide that depth is in time
    [spec,f]=fftrl(wvlt,t(wvltnms(1):wvltnms(2)));
    domfreq=max(f);
    domperiod=1/domfreq;
else
    
end

% % angle, this based on # of rows and not the depth of distance
% ang=atan((ylimit(end)-ylimit(1))/(xlimit(end)-xlimit(1)));
% angle didn't work
if(xend-xstr==0)
    % single click for crosscorrelation across entire seciotn

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -