Commit 80eae8ba authored by Philipp Arras's avatar Philipp Arras
Browse files

Docstrings, formatting and cleanup

parent c16036e2
Pipeline #77016 passed with stages
in 12 minutes and 21 seconds
......@@ -114,14 +114,16 @@ def check_operator(op, loc, tol=1e-12, ntries=100, perf_check=True,
If op is an EnergyOperator, metric_sampling determines whether the
test shall try to sample from the metric or not.
max_combinations : Integer
The maximum number of combinations of keys which shall be used for
checking partially constant operator and its derivative.
if not isinstance(op, Operator):
raise TypeError('This test tests only linear operators.')
_domain_check_nonlinear(op, loc)
_performance_check(op, loc, bool(perf_check))
_linearization_value_consistency(op, loc)
_jac_vs_finite_differences(op, loc, np.sqrt(tol), ntries, only_r_differentiable)
_jac_vs_finite_differences(op, loc, np.sqrt(tol), ntries,
_check_nontrivial_constant(op, loc, tol, ntries, only_r_differentiable,
metric_sampling, max_combinations)
......@@ -22,12 +22,6 @@ from nifty7.operators.simplify_for_const import ConstantOperator
def test_simplification():
# f1 = ift.Field.full(ift.RGSpace(10), 2.)
# op = ift.FFTOperator(f1.domain)
# _, op2 = op.simplify_for_constant_input(f1)
# assert_(isinstance(op2, ConstantOperator))
# assert_allclose(op(f1).val, op2.force(f1).val)
dom = {"a": ift.RGSpace(10)}
f1 = ift.full(dom, 2.)
op = ift.FFTOperator(f1.domain["a"]).ducktape("a")
......@@ -46,3 +40,4 @@ def test_simplification():
_, op2 = op.simplify_for_constant_input(f2)
assert_allclose(op(f1)["a"].val, op2.force(f1)["a"].val)
assert_allclose(op(f1)["b"].val, op2.force(f1)["b"].val)
# FIXME Add test for ChainOperator._simplify_for_constant_input_nontrivial()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment