dubfi.tests.test_inversion

Tests for Bayesian inversion.

Changed in version 0.1.1: (changed module path)

Added in version 0.1.0: (initial release)

Functions

gen_test_arrays(n, k, m[, localization_scale, b_prefactor])

Generate some tests arrays.

compare_strict([n, k, m, tests, norm_prefactor, ...])

Compare cost function and its derivatives in different linear algebra implementations.

compare_strict_diag([n, k, m, tests, norm_prefactor, ...])

Compare cost function and its derivatives in dense and diagonal case.

run_test_dense(test_arrays, regularization, norm_prefactor)

Run inversion using dense matrix linear algebra implementation.

run_test_diagonal(test_arrays, regularization, ...[, ...])

Run inversion using dense matrix linear algebra implementation.

run_test_sparse(test_arrays, regularization, ...[, ...])

Run inversion using sparse (CSC) matrix linear algebra implementation.

run_test_mpi_defaults([n, k, m])

Run inversion using MPI linear algebra implementation.

run_test_mpi(test_arrays, regularization, ...[, ...])

Run inversion using MPI linear algebra implementation.

compare_derivatives_hr(h, r, states, **kwargs)

Test derivatives of parameterized vector H and parametrized operator R.

compare_results(res1, res2, label1, label2)

Compare two inversion results.

profile_stats()

Show statistics from previously saved profiling data.

compare_InvertorOptimizer([n, k, m, tests, profiling, ...])

Test inversion by comparing inversion results for different linear algebra implementations.

compare_InvertorOptimizer_diag([n, k, m, tests, ...])

Test inversion by comparing inversion results for diagonal and CSC matrices.

test_compare_strict()

Unit test: fails if errors are encountered.

test_compare_strict_diag()

Unit test: fails if errors are encountered.

test_invertor()

Unit test: fails if errors are encountered.

test_invertor_diag()

Unit test: fails if errors are encountered.

Module Contents

dubfi.tests.test_inversion.gen_test_arrays(n, k, m, localization_scale=10.0, b_prefactor=0.1)

Generate some tests arrays.

Parameters:
  • n (int)

  • k (int)

  • m (int)

  • localization_scale (float)

  • b_prefactor (float)

Return type:

dict

dubfi.tests.test_inversion.compare_strict(n=117, k=23, m=17, tests=10, norm_prefactor=1.0, regularization=1.0, localization_scale=20.0, b_prefactor=0.1)

Compare cost function and its derivatives in different linear algebra implementations.

Parameters:
  • n (int)

  • k (int)

  • m (int)

  • tests (int)

Return type:

int

dubfi.tests.test_inversion.compare_strict_diag(n=117, k=23, m=17, tests=10, norm_prefactor=1.0, regularization=1.0, localization_scale=0.01, b_prefactor=0.1)

Compare cost function and its derivatives in dense and diagonal case.

Parameters:
  • n (int)

  • k (int)

  • m (int)

  • tests (int)

Return type:

int

dubfi.tests.test_inversion.run_test_dense(test_arrays, regularization, norm_prefactor, tests=10, profiling=False)

Run inversion using dense matrix linear algebra implementation.

Return type:

tuple[dubfi.inversion.inversion.InversionResult, int]

dubfi.tests.test_inversion.run_test_diagonal(test_arrays, regularization, norm_prefactor, tests=10, profiling=False)

Run inversion using dense matrix linear algebra implementation.

Return type:

tuple[dubfi.inversion.inversion.InversionResult, int]

dubfi.tests.test_inversion.run_test_sparse(test_arrays, regularization, norm_prefactor, tests=10, profiling=False)

Run inversion using sparse (CSC) matrix linear algebra implementation.

Return type:

tuple[dubfi.inversion.inversion.InversionResult, int]

dubfi.tests.test_inversion.run_test_mpi_defaults(n=349, k=23, m=17, **kwargs)

Run inversion using MPI linear algebra implementation.

Return type:

tuple[dubfi.inversion.inversion.InversionResult, int]

dubfi.tests.test_inversion.run_test_mpi(test_arrays, regularization, norm_prefactor, localization_scale, tests=10, profiling=False)

Run inversion using MPI linear algebra implementation.

Return type:

tuple[dubfi.inversion.inversion.InversionResult, int]

dubfi.tests.test_inversion.compare_derivatives_hr(h, r, states, **kwargs)

Test derivatives of parameterized vector H and parametrized operator R.

Return type:

int

dubfi.tests.test_inversion.compare_results(res1, res2, label1, label2)

Compare two inversion results.

Parameters:
Return type:

int

dubfi.tests.test_inversion.profile_stats()

Show statistics from previously saved profiling data.

dubfi.tests.test_inversion.compare_InvertorOptimizer(n=401, k=23, m=17, tests=2, profiling=False, norm_prefactor=0.5, regularization=1.0, localization_scale=20.0, b_prefactor=0.1)

Test inversion by comparing inversion results for different linear algebra implementations.

Parameters:
  • n (int)

  • k (int)

  • m (int)

  • tests (int)

Return type:

int

dubfi.tests.test_inversion.compare_InvertorOptimizer_diag(n=401, k=23, m=17, tests=2, profiling=False, norm_prefactor=0.5, regularization=1.0, localization_scale=0.01, b_prefactor=0.1)

Test inversion by comparing inversion results for diagonal and CSC matrices.

Parameters:
  • n (int)

  • k (int)

  • m (int)

  • tests (int)

Return type:

int

dubfi.tests.test_inversion.test_compare_strict()

Unit test: fails if errors are encountered.

dubfi.tests.test_inversion.test_compare_strict_diag()

Unit test: fails if errors are encountered.

dubfi.tests.test_inversion.test_invertor()

Unit test: fails if errors are encountered.

dubfi.tests.test_inversion.test_invertor_diag()

Unit test: fails if errors are encountered.