runtests

Environment to run tests of IPscatt.

Warning: This functions uses setInput, such that a directory and several files are created. Also variables are cleared.

Contents

Syntax

seti = runtests()
seti = runtests(test)

Description

Specific tests by setting parameter test

Figures

Examples

Example 1: Run all tests

seti = runtests();

Example 2: Run the test of grid scaling

seti = runtests('g');

Input Arguments

Output Arguments

Figures

(Fig. 1-10 are reserved because exp. set-up and predefined contrast is plotted, see start.html).

Note that FF(q) does mean $\mathcal{F}(q)$.

Fig. no.Content
01-10 Preliminary definitions...
as described in start.m too
expSetup.m
01source and measurement points plot...
setContrast.m
02predefined contrast (real part)
03predefined contrast (imag part)
04-10currently unused
11-20 Test derivative (testDerivative.m)
(2D: 11-14, 3D: 15-20)
112D: test derivative of FF(q)
12-14currently unused
153D: test derivative of FF(q)
163D (slice): Adjoint of derivative (ADFFq) computed by mimo
173D (slice): Adjoint of derivative (ADFFq) computed by direct A,B decompostion
18-20currently unused
21-30 Test mimo (testMimo.m)
(2D: 21-24, 3D: 25-30)
212D: Computed scattered field
222D: Reference scattered field
232D: Difference
24currently unused
253D: Computed scattered field
263D: Reference scattered field
273D: Difference
28In 3D (slice): Computed scattered field
29In 3D (slice): Reference scattered field
30In 3D (slice): Difference
31-40 Test grid scaling (testGridScale.m)
In 2D case: (in 3D no plot output)
31original matrix A (fine grid)
32matrix A down scaled
33matrix A after down and up scale
34-40currently unused

More About

How to run tests standalone?

Call before:

init;
setInput;

Better: Use runtests, e.g.:

seti = runtests('g');

See Also

Code

function seti = runtests(test)
disp(' ')
disp('################ -------- tests of IPscatt ------- ################')
disp(' ')

inseti = 'tests'; % the variable inseti will be used in the routine setInput
init;
setInput; % Clears all variables (except closed and seti).
          % This is not recommended in tests... but for standalone running it is necessary...

Diary log: start

disp(' ')
disp('## diary -- start diary log ---------------------------------------')
disp(' ')
diary(sprintf('%s/diary%s.log',seti.dirname,seti.fileSuffix)); % store all output in diary
% The structure array seti was defined before in setInput.
diary on; % later diary off

Run options

enablePauses = 0;
if nargin == 0
    test = 'all';
end

switch test

Tests

    case 'd'
        disp(' ')
        disp('## testDerivative -- test derivative ----------------------')
        disp(' ')
        testDerivative;
    case 'm'
        disp(' ')
        disp('## testMimo -- test multiple input and multiple output ----')
        disp(' ')
        testMimo;
    case 'mnf'
        disp(' ')
        disp('## testMimoNearAndFar2D -- test mimo (2D) and compare near and far field results --')
        disp(' ')
        testMimoNearAndFar2D;
    case 'g'
        disp(' ')
        disp('## testGridScale -- testGridScale -------------------------')
        disp(' ')
        testGridScale;
    case 'a'
        disp(' ')
        disp('## testAdjointKdAndKg -- test adjoint of Kd and Kg --------')
        disp(' ')
        testAdjointKdAndKg;
    case 'all' % all tests
        disp(' ')
        disp('## tests: all -- run all tests-----------------------------')
        disp(' ')

All tests: tests with fig output

        disp(' ')
        disp('## testDerivative -- 2D -----------------------------------')
        disp(' ')
        seti.dim = 2;
        testDerivative;
        disp(' '); disp('-----'); disp(' ')
        drawnow;
        if enablePauses
            disp('(Press any key to continue)')
            pause
        end

        disp(' ')
        disp('## testDerivative -- 3D -----------------------------------')
        disp(' ')
        seti.dim = 3;
        seti.incPntsType = 'sphereFibo';
        seti.measPntsType = 'sphereFibo';
        testDerivative;
        seti = rmfield(seti,'incPntsType');
        seti = rmfield(seti,'measPntsType');
        disp(' '); disp('-----'); disp(' ')
        drawnow;
        if enablePauses
            disp('(Press any key to continue)')
            pause
        end

        disp(' ')
        disp('## testMimo -- 2D -----------------------------------------')
        disp(' ')
        seti.dim = 2;
        seti.model = 'helmholtz2D';
        testMimo;
        disp(' '); disp('-----'); disp(' ')
        drawnow;
        if enablePauses
            disp('(Press any key to continue)')
            pause
        end

        disp(' ')
        disp('## testMimo -- 3D -----------------------------------------')
        disp(' ')
        seti.dim = 3;
        seti.model = 'helmholtz3D';
        seti.incPntsType = 'sphereFibo';
        seti.measPntsType = 'sphereFibo';
        testMimo;
        seti = rmfield(seti,'incPntsType');
        seti = rmfield(seti,'measPntsType');
        disp(' '); disp('-----'); disp(' ')
        drawnow;
        if enablePauses
            disp('(Press any key to continue)')
            pause
        end

        disp(' ')
        disp('## testGridscale -- 2D ------------------------------------')
        disp(' ')
        dim = 2; % The parameter dim is used in testGridScale.
        testGridScale;
        disp(' '); disp('-----'); disp(' ')
        drawnow;
        if enablePauses
            disp('(Press any key to continue)')
            pause
        end

        disp(' ')
        disp('## testGridScale -- 3D ------------------------------------')
        disp(' ')
        dim = 3;
        testGridScale; % The parameter dim is used in testGridScale.
        disp(' '); disp('-----'); disp(' ')
        drawnow;
        if enablePauses
            disp('(Press any key to continue)')
            pause
        end

All tests: tests without fig output

        disp(' ')
        disp('## Test mimo (2D) and compare near and far field results --')
        disp(' ')
        testMimoNearAndFar2D;
        disp(' '); disp('-----'); disp(' ')

        disp(' ')
        disp('## Test adjoint of Kd and Kg ------------------------------')
        disp(' ')
        testAdjointKdAndKg;
        disp(' '); disp('-----'); disp(' ')
end

Diary log: end

disp(' ')
disp('## diary -- end diary log -----------------------------------------')
disp(' ')
diary off;
end