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

📄 picksle.m

📁 基于matlab的反演程序,用于地球物理勘探中射线追踪及偏移成像程序.
💻 M
📖 第 1 页 / 共 3 页
字号:
function picksout=picksle(arg1,arg2,arg3,arg4,arg5)
%***************
%*** PICKSLE ***
%***************
%
% picksle(transfer,seisstruct);
% picksle(transfer,seisstruct,masteraxes);
% picksle(transfer,seisstruct,masteraxes,preferances);
%
% PICKSLE is a new picking routine that allows users to make picks across
% seismic sections and interpolate between
%
% PICKSLE cleans up after it has calculated the initial picks and erases
% them from the axis.  The picks information is passed using the 'transfer'
% argument which executes upon the final calculation.  This transfer
% should be a routine in the users program which calls picksle and have the
% following command 'picksout=picksle('EXPORT')' to access the picks 
% information that was calculated.
%
% The seisstruct is set up in a field the following way.
% SEIS : (2D Array of seismic data) 
% T : (Depth or Time) - optional
% X : (Distance) - optional
%
% masteraxes - The specific axes where calculations will take place
% default - gca
%
% The preferance argument has several variables that can be changed to
% allow for greater flexibility in automatic picking.  The variables are
% descibed below.  It should be noted that not all properties need be
% present for this program to work.
%
% {'hmsg' 'nodetolerance' 'sampleadd' 'showprogress' 'percenttolerance' 
% 'lockto' 'askdetail'
%
% 'hmsg' :  a handle where messages from pickles can be sent to relay
% information to the user (default = empty)
%
% 'nodetolerance' : Allows the user to control how many pics are made.  The
% highter the number, the less pics.  1 will allow for one pic per trace
% (default = 5)
%
% 'sampleadd' : This controls samples size of the windowed area that the is
% taken of the initial clicked trace. (defaul = 100)
%
% 'showprogress' : This is more for debugging purposes to show the user
% where the cross correlation scanning is happing on the image
% (default = "Show Progress", leave empty to not show progress)
%
% 'percenttolerance' : percentage crosscorelation that picksle will check
% for and accept when searching for nodes, in decmil form
% 
% 'lockto' : can be set to 'open', 'peak', 'trough', 'zerocross+',
% 'zerocross-'
% (default = open)
%
% 'askdetail' : This argument allows the user to shut on or off the figure
% that allows adjustment in click location and window size.
% (default = 'on' )
%
% Christopher Harrison, 2004
%
% 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:  crewes@geo.ucalgary.ca
%
% 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<=0|nargin>=5)
    stringinfo={'Please see picksle help for details in proper use'};
    helpdlg(stringinfo,'Check PICKSLE help file');
    return
elseif(nargin==1)
    if(~ischar(arg1))
        stringinfo={'Input data not set up properly.',...
                'Please see picksle help for details in proper use'};
        helpdlg(stringinfo,'Check PICKSLE help file');
        return
    else
        checkstr=findstr('bdownbmotionbupEXPORT',arg1);
        if(isempty(checkstr))
            stringinfo={'Input data not set up properly.',...
                    'Please see picksle help for details in proper use'};
            helpdlg(stringinfo,'Check PICKSLE help file');
            return
        end
        switch arg1
            case 'bdown'
                PLE_buttondown
            case 'bmotion'
                PLE_motion
            case 'bup'
                PLE_up
            case 'EXPORT'
                %--- Getting Data ---
                pref=get(gca,'userdata');
                if(~isstruct(pref))
                    % something is wrong if this is not a structure
                    picksout=[];
                    return
                end
                % doing a last check, just in case something has gone wrong
                fnms=fieldnames(pref);
                dat=[];
                for ii=1:length(fnms)
                    if(strcmp(fnms{ii},'holddat'))
                        dat=getfield(pref,'holddat');
                        break
                    end
                end
                %----------
                picksout=dat;
        end
        return
    end
elseif(nargin==2)
    % Two arguments mean user has passed seis structure and gca
    trans=arg1;
    seisstruct=arg2;
    masteraxes=gca;
    preferances=[];
elseif(nargin==3)
    % seis structure and gca, and location of th pulldownmenu
    trans=arg1;
    seisstruct=arg2;
    masteraxes=arg3;
    preferances=[];
elseif(nargin==4)
    trans=arg1;
    seisstruct=arg2;
    masteraxes=arg3;
    preferances=arg4;
elseif(nargin==5)
    return
end
% Checking first if figure and axes are actually right
if(~ishandle(masteraxes))
    stringinfo={'Axes handle has not been choosen properly.',...
            'Please see picksle help for details in proper use'};
    helpdlg(stringinfo,'Check PICKSLE help file');
    return
elseif(~strcmp(get(masteraxes,'type'),'axes'))
    stringinfo={'Axes handle has not been choosen properly.',...
            'Please see picksle help for details in proper use'};
    helpdlg(stringinfo,'Check PICKSLE help file');
    return
end
masterfig=get(gca,'parent');
% eventually there will be an "Initial Picks"
initialpicks=[];

% checking to make sure seis data is in structure form
if(~isstruct(seisstruct))
    stringinfo={'seisstruct has not been set up properly.',...
            'Please see picksle help for details in proper use'};
    helpdlg(stringinfo,'Check PICKSLE help file');
    return
end
% checking to see that seis struct has the proper components
fnms=fieldnames(seisstruct);
checknms={'SEIS' 'T' 'X'};  % there will evenutally be a "y" for 3D 
SEIS=[];
T=[];
X=[];
for ii=1:size(checknms,2)
    checked=[];
    for jj=1:size(fnms,1)
        if(strcmp(lower(checknms{ii}),lower(fnms{jj})))
            % just in case 
            checked='Check';
            checknms{ii}=getfield(seisstruct,(fnms{jj}));
            break
        end
    end
    if(isempty(checked)&strcmp(lower(checknms{ii}),lower('SEIS')))
        stringinfo={'seisstruct has not been set up properly.',...
                'Please see picksle help for details in proper use'};
        helpdlg(stringinfo,'Check PICKSLE help file');
        return
    end
end
SEIS=checknms{1};
T=checknms{2};
X=checknms{3};
if(isempty(SEIS)||isstr(SEIS))
    stringinfo={'Make sure your SEIS array is not empty.',...
            'Please see picksle help for details in proper use'};
    helpdlg(stringinfo,'Check PICKSLE help file');
    return
end
if(isempty(T)||isstr(T))
    T=[1:1:size(SEIS,1)];
end
if(isempty(X)||isstr(X))
    X=[1:1:size(SEIS,2)];
end
seiss.SEIS=SEIS;
seiss.T=T;
seiss.X=X;
seisstruct=seiss;
% Check seistruct to make sure proper matrix lengths have been creat
if(isempty(T))
    T=[0:1:size(SEIS,1)-1]';
    seisstruct.T=T;
elseif(size(SEIS,1)~=length(T))
    stringinfo={'seisstruct has not been set up properly.',...
            'Please see picksle help for details in proper use'};
    helpdlg(stringinfo,'Check PICKSLE help file');
    return
end
if(isempty(X))
    X=[0:1:size(SEIS,2)-1];
    seisstruct.X=X;
elseif(size(SEIS,2)~=length(X))
    stringinfo={'seisstruct has not been set up properly.',...
            'Please see picksle help for details in proper use'};
    helpdlg(stringinfo,'Check PICKSLE help file');
    return
else
    if(X(1)==X(end))
    end
end
pref.seisstruct=seisstruct;
pref.axes=masteraxes;
pref.transfer=trans;
pref.holddat=[];    % This helps with the transfer of data.
if(~isempty(preferances))
    % checking preferances
    if(~isstruct(preferances))
        stringinfo={'Your preferances are not set up properly.',...
                'Please see picksle help for details in proper use'};
        helpdlg(stringinfo,'Check PICKSLE help file');
        return
    end
    % checking to make sure that user has set up the preferance file right
    % NOTE, when adding new prefereance to program, you must also add them
    % to the "checkfields" prefernce field.
    hmsg='nothing yet';
    nodetolerance='nothing yet';
    sampleadd='nothing yet';
    showprogress='Showing Progress';
    percenttolerance='nothing yet';
    lockto='open';
    askdetail='on';
    checkfield={'hmsg' 'nodetolerance' 'sampleadd' 'showprogress' 'percenttolerance' 'lockto' 'askdetail'};
    fnames=fieldnames(preferances);
    % checking to make sure the properties that have been included in the
    % preferances correspond to know preferences
    checked='no';
    for ii=1:size(fnames)
        for jj=1:size(checkfield)
            if(strcmpi(fnames(ii),checkfield(jj)))
                % This allows the user to input only one propertie 
                checked='yes';
                break
            end
        end
        if(~strcmpi(checked,'yes'))
            stringinfo={'Your preferances are not set up properly.',...
                'Please see picksle help for details in proper use'};
            helpdlg(stringinfo,'Check PICKSLE help file');
            return
        end
    end
    checkfields={'hmsg' 'nodetolerance' 'sampleadd' 'showprogress' 'percenttolerance',...
        'axes' 'transfer' 'holddat' 'lockto' 'askdetail'};
    % doing a last check of the preferences
    if(~ishandle(hmsg))        hmsg=[];    end
    if(~isnumeric(nodetolerance))        nodetolerance=1;    elseif(nodetolerance<=1) nodetolerance=1; end
    if(~isnumeric(sampleadd))        sampleadd=100;    end
    if(~isnumeric(percenttolerance))        percenttolerance=.2;    end 
    checkpreset={{'open','peak','trough','zerocross','zerocross+','zerocross-'} {'on' 'off'}};
    checkinput={lower(lockto) lower(askdetail)};
    checking={[] []};
    checkerror={'Locking for advanced picking has not been set up correctly',...
            'Detail has not been set up properly'};
    for ii=1:size(checkpreset,2)
        cpreset=checkpreset{ii};
        for jj=1:size(cpreset,2)
            if(strcmpi(checkinput{ii},cpreset{jj}))
                checking{ii}='Checked';
                break
            end
        end
        if(isempty(checking{ii}))
            stringinfo=checkerror{ii};
            helpdlg(stringinfo,'Check PICKSLE help file');
            return
        end
    end
    pref.showprogress=showprogress; % empty means no show progress
    pref.sampleadd=sampleadd;
    pref.percenttolerance=percenttolerance;
    pref.nodetolerance=nodetolerance;
    pref.hmsg=hmsg;
    pref.lockto=checkinput{1};

⌨️ 快捷键说明

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