### Clean up: consistently use spaces instead of tabs (Matlab standard), remove...

`Clean up: consistently use spaces instead of tabs (Matlab standard), remove author and last-modified-notes, formatting fixes`
parent a0879d12
Pipeline #100437 passed with stage
in 1 minute and 38 seconds
 ... ... @@ -59,29 +59,26 @@ function varargout = centeredGrid(N, dx, computeMeshgrid) % % You should have received a copy of the GNU General Public License % along with this program. If not, see . % % % Last modified on March 19 2019 by Simon Maretzke % Default: unit spacing if nargin < 2 dx = 1; dx = 1; end dx = dx(:).' .* ones([1,numel(N)]); ndim = numel(N); % Grid in Fourier space for jj = 1:ndim x{jj} = ( -(0.5*(N(jj)-1)) : (0.5*(N(jj)-1)) ) * dx(jj); x{jj} = ( -(0.5*(N(jj)-1)) : (0.5*(N(jj)-1)) ) * dx(jj); end % Optionally assemble ndgrid (occupies more memory!) if nargin == 3 && computeMeshgrid [x{:}] = ndgrid(x{:}); [x{:}] = ndgrid(x{:}); elseif ndim > 1 for jj = 1:ndim x{jj} = reshape( x{jj}, [ones([1,jj-1]), N(jj), ones([1,ndim-jj])] ); end for jj = 1:ndim x{jj} = reshape( x{jj}, [ones([1,jj-1]), N(jj), ones([1,ndim-jj])] ); end end % Unpack cell-array ... ...
 ... ... @@ -68,23 +68,17 @@ function combinedImage = combineInFourierspace(highFrequencyImage,lowFrequencyIm % % You should have received a copy of the GNU General Public License % along with this program. If not, see . % % Original author: Martin Krenkel % Last modified on March 22 2019 by Mareike Toepperwien % default settings defaults.combineCutoff = 0.1; defaults.combineSigma = 0.01; if (nargin == 0) combinedImage = defaults; return end if (nargin < 3) settings = struct; end settings = completeStruct(settings, defaults); ... ... @@ -106,6 +100,5 @@ fftLowFrec = fft2(lowFrequencyImage); % result combinedImage = ifft2((1-weight).*fftHighFrec+weight.*fftLowFrec); end
 ... ... @@ -48,20 +48,17 @@ function sNew = completeStruct(s, sRef) % % You should have received a copy of the GNU General Public License % along with this program. If not, see . % % % Last modified on March 16 2019 by Simon Maretzke sNew = s; fnames = fieldnames(sRef); for jj = 1:length(fnames); fname = fnames{jj}; x = getfield(sRef, fname); if ~isfield(sNew, fname) sNew = setfield(sNew, fname, x); else if isstruct(x) % recursively apply the completion to sub-structs sNew = setfield(sNew, fname, completeStruct(getfield(sNew, fname), x)); end fname = fnames{jj}; x = getfield(sRef, fname); if ~isfield(sNew, fname) sNew = setfield(sNew, fname, x); else if isstruct(x) % recursively apply the completion to sub-structs sNew = setfield(sNew, fname, completeStruct(getfield(sNew, fname), x)); end end end
 ... ... @@ -50,13 +50,10 @@ function arrayCropped = croparray(array, cropPre, cropPost) % % You should have received a copy of the GNU General Public License % along with this program. If not, see . % % % Last modified on March 12 2019 by Simon Maretzke % Default: symmetric cropping if nargin < 3 cropPost = cropPre; cropPost = cropPre; end N = size(array); ... ... @@ -70,11 +67,11 @@ cropPost = [cropPost(:).', zeros([1,ndim-numel(cropPost)])]; % Crop array dimension by dimension arrayCropped = array; for dim = 1:ndim if cropPre(dim) > 0 || cropPost(dim) > 0 c1 = repmat({':'}, [dim-1,1]); c2 = repmat({':'}, [ndim-dim,1]); arrayCropped = arrayCropped(c1{:}, cropPre(dim)+1:N(dim)-cropPost(dim), c2{:}); end if cropPre(dim) > 0 || cropPost(dim) > 0 c1 = repmat({':'}, [dim-1,1]); c2 = repmat({':'}, [ndim-dim,1]); arrayCropped = arrayCropped(c1{:}, cropPre(dim)+1:N(dim)-cropPost(dim), c2{:}); end end end
 ... ... @@ -55,29 +55,26 @@ function varargout = fftfreq(N, dx, computeMeshgrid) % % You should have received a copy of the GNU General Public License % along with this program. If not, see . % % % Last modified on March 19 2019 by Simon Maretzke % Default: unit spacing if nargin < 2 dx = 1; dx = 1; end dx = dx(:).' .* ones([1,numel(N)]); ndim = numel(N); % Grid in Fourier space for jj = 1:ndim xi{jj} = ifftshift( ( -floor(0.5*N(jj)) : floor(0.5*(N(jj)-1)) ).' * ( 2*pi / (N(jj)*dx(jj)) ) ); xi{jj} = ifftshift( ( -floor(0.5*N(jj)) : floor(0.5*(N(jj)-1)) ).' * ( 2*pi / (N(jj)*dx(jj)) ) ); end % Optionally assemble ndgrid (occupies more memory!) if nargin == 3 && computeMeshgrid [xi{:}] = ndgrid(xi{:}); [xi{:}] = ndgrid(xi{:}); elseif ndim > 1 for jj = 1:ndim xi{jj} = reshape( xi{jj}, [ones([1,jj-1]), N(jj), ones([1,ndim-jj])] ); end for jj = 1:ndim xi{jj} = reshape( xi{jj}, [ones([1,jj-1]), N(jj), ones([1,ndim-jj])] ); end end % Unpack cell-array ... ...
 ... ... @@ -40,8 +40,6 @@ function XiSq = fftfreqNormSq(N, dx) % % You should have received a copy of the GNU General Public License % along with this program. If not, see . % % Last modified on May 15 2019 by Simon Maretzke % Default: Standard grid spacing assigned by function fftfreq. ... ...
 ... ... @@ -48,8 +48,6 @@ function arraySlice = getSlice(array, sliceIdx, dim) % % You should have received a copy of the GNU General Public License % along with this program. If not, see . % % Last modified on March 13 2019 by Simon Maretzke ndim = ndims(array); c1 = repmat({':'}, [dim-1,1]); ... ...
 ... ... @@ -24,10 +24,6 @@ function gpuIsAvailable = checkGPUSupport() % % You should have received a copy of the GNU General Public License % along with this program. If not, see . % % % Author: Simon Maretzke % Last checked and modified: April 24 2019 try gpuDevice(); ... ... @@ -35,4 +31,5 @@ try catch ME gpuIsAvailable = false; end end
 ... ... @@ -31,12 +31,9 @@ function array = gatherIf(array, condition) % % You should have received a copy of the GNU General Public License % along with this program. If not, see . % % % Author: Simon Maretzke % Last checked and modified: April 24 2019 if condition array = gather(array); end end
 ... ... @@ -29,10 +29,7 @@ function arrayOnHost = gatherIfOnGPU(array) % % You should have received a copy of the GNU General Public License % along with this program. If not, see . % % % Author: Simon Maretzke % Last checked and modified: April 24 2019 arrayOnHost = gatherIf(array, isOnGPU(array)); end
 ... ... @@ -32,13 +32,10 @@ function arrayOnGPUIf = gpuArrayIf(array, condition) % % You should have received a copy of the GNU General Public License % along with this program. If not, see . % % % Author: Simon Maretzke % Last checked and modified: April 24 2019 arrayOnGPUIf = array; if condition arrayOnGPUIf = gpuArray(arrayOnGPUIf); end end
 ... ... @@ -29,10 +29,7 @@ function arrayIsOnGPU = isOnGPU(array) % % You should have received a copy of the GNU General Public License % along with this program. If not, see . % % % Author: Simon Maretzke % Last checked and modified: April 24 2019 arrayIsOnGPU = strcmp(class(array), 'gpuArray'); end