tp@0: function EDB1editpathlist(edpathsfile,useedges,symmetricedges,pathstokeep) tp@0: % EDB1editpathlist - Does some semi-automatic editing of an edpathsfile. tp@0: % A vector, 'multfactors' is introduced, which will boost or tp@0: % keep or switch off paths in the list of paths. tp@0: % tp@0: % Input parameters: tp@0: % edpathsfile An edpaths file that should be modified. tp@0: % useedges (optional) A list of edges that should be used. All tp@0: % paths that contain an edge which is not this edge will tp@0: % be switched off. tp@0: % symmetricedges (optional) A matrix of edge pairs that are symmetrical tp@0: % around a symmetry plane. If, e.g., edges 2 and 3 are symmetric around the tp@0: % source/receiver plane, then symmetricedges = [2 3]. Several pairs are tp@0: % possible; symmetricedges = [2 3;7 8;9 12]; tp@0: % pathstokeep (optional) A matrix of specific diffraction paths to tp@0: % keep. tp@0: % SHOWTEXT (global) tp@0: % tp@0: % ---------------------------------------------------------------------------------------------- tp@0: % This file is part of the Edge Diffraction Toolbox by Peter Svensson. tp@0: % tp@0: % The Edge Diffraction Toolbox is free software: you can redistribute it and/or modify tp@0: % it under the terms of the GNU General Public License as published by the Free Software tp@0: % Foundation, either version 3 of the License, or (at your option) any later version. tp@0: % tp@0: % The Edge Diffraction Toolbox is distributed in the hope that it will be useful, tp@0: % but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS tp@0: % FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. tp@0: % tp@0: % You should have received a copy of the GNU General Public License along with the tp@0: % Edge Diffraction Toolbox. If not, see . tp@0: % ---------------------------------------------------------------------------------------------- tp@0: % Peter Svensson (svensson@iet.ntnu.no) 20050510 tp@0: % tp@0: % EDB1editpathlist(edpathsfile,useedges,symmetricedges,pathstokeep); tp@0: tp@0: global SHOWTEXT tp@0: tp@0: if isempty(symmetricedges) tp@0: dosymmetry = 0; tp@0: else tp@0: dosymmetry = 1; tp@0: end tp@0: tp@0: if isempty(pathstokeep) tp@0: dopathpruning = 0; tp@0: else tp@0: dopathpruning = 1; tp@0: end tp@0: tp@0: if ~isempty(useedges) tp@0: error(['ERROR: Sorry, the useedges option has not been implemented yet!']) tp@0: end tp@0: tp@0: %------------------------------------------------------------------------- tp@0: tp@0: nsymmetricedgepairs = size(symmetricedges,1); tp@0: tp@0: Varlist = [' S R allspecrows firstdiffrow mainlistguidepattern mainlistguide reflpaths pathtypevec']; tp@0: Varlist = [Varlist,' Sinsideplanenumber Rinsideplanenumber directsoundrow specextradata edgeextradata']; tp@0: if dosymmetry | dopathpruning tp@0: Varlist = [Varlist,' multfactors']; tp@0: end tp@0: tp@0: %------------------------------------------------------------------------- tp@0: tp@0: eval(['load ',edpathsfile]) tp@0: disp(' ') tp@0: disp(['Modifying ',edpathsfile]) tp@0: [ncombs,ncols] = size(reflpaths); tp@0: multfactors = ones(ncombs,1); tp@0: tp@0: %------------------------------------------------------------------------- tp@0: tp@0: if dosymmetry tp@0: tp@0: onesvec = ones(ncombs,1); tp@0: for kkk = 1:ncols tp@0: if SHOWTEXT >= 1 tp@0: disp([' Diffraction order ',int2str(kkk)]) tp@0: end tp@0: irow = sum((mainlistguidepattern=='d').').' == kkk; tp@0: if sum(irow) > 0 tp@0: ivselection = [double(mainlistguide(irow,2)):double(mainlistguide(irow,3))].'; tp@0: for mmm = 1:nsymmetricedgepairs tp@0: if SHOWTEXT >= 1 tp@0: disp([' Symmetry pair ',int2str(mmm)]) tp@0: end tp@0: iv = any(reflpaths(ivselection,:).'==symmetricedges(mmm,1)); tp@0: if ~isempty(iv) tp@0: iv = ivselection(iv); tp@0: for nnn=1:length(iv) tp@0: reflpathsmatch = reflpaths(iv(nnn),:); tp@0: if multfactors(iv(nnn)) ~= 0 tp@0: colstoswitch1 = find(reflpathsmatch==symmetricedges(mmm,1)); tp@0: colstoswitch2 = find(reflpathsmatch==symmetricedges(mmm,2)); tp@0: reflpathsmatch(colstoswitch1) = symmetricedges(mmm,2); tp@0: reflpathsmatch(colstoswitch2) = symmetricedges(mmm,1); tp@0: tp@0: reflpathsmatch = reflpathsmatch(onesvec,:); tp@0: tp@0: ivmatch = find(sum( (reflpaths==reflpathsmatch).' ).'==ncols); tp@0: if ~isempty(ivmatch) & multfactors(ivmatch) ~= 0 tp@0: multfactors(iv(nnn)) = 2*multfactors(iv(nnn)); tp@0: multfactors(ivmatch) = 0; tp@0: if SHOWTEXT >= 2 tp@0: disp([' Found symmetric edge pair:']) tp@0: disp([' ',int2str(iv(nnn)),': ',int2str(double(reflpaths(iv(nnn),:)))]) tp@0: disp([' ',int2str(ivmatch),': ',int2str(double(reflpaths(ivmatch,:)))]) tp@0: end tp@0: end tp@0: end % ... if multfactors(iv(nnn)) ~= 0, tp@0: tp@0: end % ... for nnn=1:length(iv) tp@0: end % ... if ~isempty(iv) tp@0: end % for mmm = 1:nsymmetricedgepairs tp@0: end % ...if sum(irow) > 0 tp@0: end % ... for kkk = 1:ncols tp@0: end % ...if dosymmetry tp@0: tp@0: %------------------------------------------------------------------------- tp@0: tp@0: if dopathpruning tp@0: multfactors = multfactors*0; tp@0: for ii = 1:size(pathstokeep,1) tp@0: pathtomatch = pathstokeep(ii,:); tp@0: pathtomatch = pathtomatch(ones(ncombs,1),:); tp@0: ivmatch = find(sum( (reflpaths==pathtomatch).' ).'==ncols); tp@0: multfactors(ivmatch) = 1; tp@0: end tp@0: end tp@0: tp@0: %------------------------------------------------------------------------- tp@0: tp@0: eval(['save ',edpathsfile,Varlist])