Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing test on main branch #1671

Closed
elma16 opened this issue Jan 8, 2025 · 5 comments
Closed

Failing test on main branch #1671

elma16 opened this issue Jan 8, 2025 · 5 comments

Comments

@elma16
Copy link

elma16 commented Jan 8, 2025

When I run

import odl
odl.test()

on google colab with a GPU, I get one failed test. In particular, this occurs on the operator sum test.

______________________________ test_operator_sum[ dom_eq_ran=False ] _______________________________

dom_eq_ran = False

    def test_operator_sum(dom_eq_ran):
        """Check operator sum against NumPy reference."""
        if dom_eq_ran:
            mat1 = np.random.rand(3, 3)
            mat2 = np.random.rand(3, 3)
        else:
            mat1 = np.random.rand(4, 3)
            mat2 = np.random.rand(4, 3)
    
        op1 = MultiplyAndSquareOp(mat1)
        op2 = MultiplyAndSquareOp(mat2)
        xarr, x = noise_elements(op1.domain)
    
        # Explicit instantiation
        sum_op = OperatorSum(op1, op2)
        assert not sum_op.is_linear
>       check_call(sum_op, x, mult_sq_np(mat1, xarr) + mult_sq_np(mat2, xarr))

/usr/local/lib/python3.10/site-packages/odl/test/operator/operator_test.py:143: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

operator = OperatorSum(MultiplyAndSquareOp: rn(3) -> rn(4), MultiplyAndSquareOp: rn(3) -> rn(4))
x = rn(3).element([-2.2697122 , -0.73576414,  0.88103102])
expected = array([ 2.47990429,  2.6283014 ,  0.49551227,  2.94155397])

    def check_call(operator, x, expected):
        """Assert that operator(point) == expected."""
        # Out-of-place check
>       assert all_almost_equal(operator(x), expected)
E       assert False
E        +  where False = all_almost_equal(rn(4).element([ 0.26634276,  1.48797478,  0.20117861, -1.26019371]), array([ 2.47990429,  2.6283014 ,  0.49551227,  2.94155397]))
E        +    where rn(4).element([ 0.26634276,  1.48797478,  0.20117861, -1.26019371]) = OperatorSum(MultiplyAndSquareOp: rn(3) -> rn(4), MultiplyAndSquareOp: rn(3) -> rn(4))(rn(3).element([-2.2697122 , -0.73576414,  0.88103102]))

/usr/local/lib/python3.10/site-packages/odl/test/operator/operator_test.py:77: AssertionError
========================================= warnings summary =========================================
../usr/local/lib/python3.10/site-packages/_pytest/config/__init__.py:1126
  /usr/local/lib/python3.10/site-packages/_pytest/config/__init__.py:1126: PytestAssertRewriteWarning: Module already imported so cannot be rewritten: odl
    self._mark_plugins_for_rewrite(hook)

../usr/local/lib/python3.10/site-packages/_pytest/config/__init__.py:1126
  /usr/local/lib/python3.10/site-packages/_pytest/config/__init__.py:1126: PytestAssertRewriteWarning: Module already imported so cannot be rewritten: anyio
    self._mark_plugins_for_rewrite(hook)

discr/discr_ops.py: 2 warnings
discr/discr_utils.py: 1 warning
test/discr/discr_utils_test.py: 2 warnings
test/tomo/geometry/geometry_test.py: 3 warnings
test/tomo/operators/ray_trafo_test.py: 11 warnings
tomo/geometry/conebeam.py: 4 warnings
  /usr/local/lib/python3.10/site-packages/odl/discr/discr_utils.py:631: UserWarning: Unable to infer accurate dtype for interpolation coefficients, defaulting to `float`.
    warn("Unable to infer accurate dtype for"

test/discr/discr_ops_test.py::test_resizing_op_mixed_uni_nonuni
  /usr/local/lib/python3.10/site-packages/odl/discr/discr_ops.py:460: RuntimeWarning: invalid value encountered in cast
    offset = np.around(offset_float).astype(int)

test/solvers/functional/default_functionals_test.py::test_kullback_leibler_cross_entorpy[ space=power_space_unif_discr - tspace_impl='numpy' ]
  /usr/local/lib/python3.10/site-packages/odl/space/npy_tensors.py:429: ComplexWarning: Casting complex values to real discards the imaginary part
    arr = np.array(inp, copy=False, dtype=self.dtype, ndmin=self.ndim,

test/space/pspace_test.py::test_real_setter_product_space[ space=product_space - element=space ]
test/space/pspace_test.py::test_imag_setter_product_space[ space=product_space - element=space ]
test/space/pspace_test.py::test_real_setter_product_space[ space=power_space - element=space ]
test/space/pspace_test.py::test_imag_setter_product_space[ space=power_space - element=space ]
  /usr/local/lib/python3.10/site-packages/odl/space/base_tensors.py:666: ComplexWarning: Casting complex values to real discards the imaginary part
    return self.asarray().astype(dtype, copy=False)

ufunc_ops/ufunc_ops.py::odl.ufunc_ops.ufunc_ops.arccos_op
  /usr/local/lib/python3.10/site-packages/odl/space/npy_tensors.py:1669: RuntimeWarning: invalid value encountered in arccos
    res = ufunc(*inputs, **kwargs)

ufunc_ops/ufunc_ops.py::odl.ufunc_ops.ufunc_ops.arccosh_op
  /usr/local/lib/python3.10/site-packages/odl/space/npy_tensors.py:1669: RuntimeWarning: invalid value encountered in arccosh
    res = ufunc(*inputs, **kwargs)

ufunc_ops/ufunc_ops.py::odl.ufunc_ops.ufunc_ops.arcsin_op
  /usr/local/lib/python3.10/site-packages/odl/space/npy_tensors.py:1669: RuntimeWarning: invalid value encountered in arcsin
    res = ufunc(*inputs, **kwargs)

ufunc_ops/ufunc_ops.py::odl.ufunc_ops.ufunc_ops.arctanh_func
  /usr/local/lib/python3.10/site-packages/odl/ufunc_ops/ufunc_ops.py:334: RuntimeWarning: divide by zero encountered in arctanh
    return getattr(np, name)(x)

ufunc_ops/ufunc_ops.py::odl.ufunc_ops.ufunc_ops.arctanh_op
  /usr/local/lib/python3.10/site-packages/odl/space/npy_tensors.py:1669: RuntimeWarning: divide by zero encountered in arctanh
    res = ufunc(*inputs, **kwargs)

ufunc_ops/ufunc_ops.py::odl.ufunc_ops.ufunc_ops.arctanh_op
  /usr/local/lib/python3.10/site-packages/odl/space/npy_tensors.py:1669: RuntimeWarning: invalid value encountered in arctanh
    res = ufunc(*inputs, **kwargs)

ufunc_ops/ufunc_ops.py::odl.ufunc_ops.ufunc_ops.log10_op
  /usr/local/lib/python3.10/site-packages/odl/space/npy_tensors.py:1669: RuntimeWarning: invalid value encountered in log10
    res = ufunc(*inputs, **kwargs)

ufunc_ops/ufunc_ops.py::odl.ufunc_ops.ufunc_ops.log1p_op
  /usr/local/lib/python3.10/site-packages/odl/space/npy_tensors.py:1669: RuntimeWarning: divide by zero encountered in log1p
    res = ufunc(*inputs, **kwargs)

ufunc_ops/ufunc_ops.py::odl.ufunc_ops.ufunc_ops.log2_op
  /usr/local/lib/python3.10/site-packages/odl/space/npy_tensors.py:1669: RuntimeWarning: invalid value encountered in log2
    res = ufunc(*inputs, **kwargs)

ufunc_ops/ufunc_ops.py::odl.ufunc_ops.ufunc_ops.log_op
  /usr/local/lib/python3.10/site-packages/odl/space/npy_tensors.py:1669: RuntimeWarning: invalid value encountered in log
    res = ufunc(*inputs, **kwargs)

ufunc_ops/ufunc_ops.py::odl.ufunc_ops.ufunc_ops.sqrt_op
  /usr/local/lib/python3.10/site-packages/odl/space/npy_tensors.py:1669: RuntimeWarning: invalid value encountered in sqrt
    res = ufunc(*inputs, **kwargs)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
===================================== short test summary info ======================================
FAILED ../usr/local/lib/python3.10/site-packages/odl/test/operator/operator_test.py::test_operator_sum[ dom_eq_ran=False ]
==================== 1 failed, 3466 passed, 1461 skipped, 42 warnings in 42.09s ====================
@leftaroundabout
Copy link
Contributor

Thanks for the report! What version of ODL are you running / how did you install ODL? This looks a lot like one of the problems that were already solved for release 0.8.0.

@elma16
Copy link
Author

elma16 commented Jan 8, 2025

Thanks for the speedy response! For completeness, here are the commands I wrote to reproduce the issue

!pip install odl
import odl
odl.test()

... although in saying that, now a completely different set of tests failed now!

======================================= test session starts ========================================
platform linux -- Python 3.10.12, pytest-8.3.4, pluggy-1.5.0
rootdir: /usr/local/lib/python3.10/dist-packages/odl
configfile: pytest.ini
plugins: odl-0.8.1, typeguard-4.4.1, anyio-3.7.1
collected 4932 items

../usr/local/lib/python3.10/dist-packages/odl/deform/linearized.py ...                       [  0%]
../usr/local/lib/python3.10/dist-packages/odl/diagnostics/examples.py .                      [  0%]
../usr/local/lib/python3.10/dist-packages/odl/discr/diff_ops.py .....                        [  0%]
../usr/local/lib/python3.10/dist-packages/odl/discr/discr_ops.py ...                         [  0%]
../usr/local/lib/python3.10/dist-packages/odl/discr/discr_space.py ..........                [  0%]
../usr/local/lib/python3.10/dist-packages/odl/discr/discr_utils.py ....                      [  0%]
../usr/local/lib/python3.10/dist-packages/odl/discr/grid.py ...........................      [  1%]
../usr/local/lib/python3.10/dist-packages/odl/discr/partition.py ...................         [  1%]
../usr/local/lib/python3.10/dist-packages/odl/operator/default_ops.py ...................... [  1%]
..........                                                                                   [  2%]
../usr/local/lib/python3.10/dist-packages/odl/operator/operator.py ..................        [  2%]
../usr/local/lib/python3.10/dist-packages/odl/operator/oputils.py ....                       [  2%]
../usr/local/lib/python3.10/dist-packages/odl/operator/pspace_ops.py ..................      [  2%]
../usr/local/lib/python3.10/dist-packages/odl/operator/tensor_ops.py ............            [  3%]
../usr/local/lib/python3.10/dist-packages/odl/phantom/geometric.py ...                       [  3%]
../usr/local/lib/python3.10/dist-packages/odl/set/domain.py ................                 [  3%]
../usr/local/lib/python3.10/dist-packages/odl/set/sets.py ................                   [  3%]
../usr/local/lib/python3.10/dist-packages/odl/set/space.py ....                              [  3%]
../usr/local/lib/python3.10/dist-packages/odl/solvers/functional/default_functionals.py .... [  4%]
..............                                                                               [  4%]
../usr/local/lib/python3.10/dist-packages/odl/solvers/functional/derivatives.py ...          [  4%]
../usr/local/lib/python3.10/dist-packages/odl/solvers/functional/example_funcs.py .          [  4%]
../usr/local/lib/python3.10/dist-packages/odl/solvers/functional/functional.py .....         [  4%]
../usr/local/lib/python3.10/dist-packages/odl/solvers/util/callback.py ............          [  4%]
../usr/local/lib/python3.10/dist-packages/odl/solvers/util/steplen.py ..                     [  4%]
../usr/local/lib/python3.10/dist-packages/odl/space/base_tensors.py ..                       [  4%]
../usr/local/lib/python3.10/dist-packages/odl/space/npy_tensors.py .......................   [  5%]
../usr/local/lib/python3.10/dist-packages/odl/space/pspace.py ................               [  5%]
../usr/local/lib/python3.10/dist-packages/odl/space/space_utils.py ....                      [  5%]
../usr/local/lib/python3.10/dist-packages/odl/test/deform/linearized_deform_test.py .......s [  5%]
....s....s.........s....s.........s...................                                       [  6%]
../usr/local/lib/python3.10/dist-packages/odl/test/discr/diff_ops_test.py .................. [  7%]
............................................................................................ [  9%]
............................................................................................ [ 11%]
.................                                                                            [ 11%]
../usr/local/lib/python3.10/dist-packages/odl/test/discr/discr_ops_test.py ................. [ 11%]
................                                                                             [ 12%]
../usr/local/lib/python3.10/dist-packages/odl/test/discr/discr_space_test.py ............... [ 12%]
............................................................................................ [ 14%]
...................................                                                          [ 14%]
../usr/local/lib/python3.10/dist-packages/odl/test/discr/discr_utils_test.py ............... [ 15%]
........................................                                                     [ 16%]
../usr/local/lib/python3.10/dist-packages/odl/test/discr/grid_test.py ...................... [ 16%]
..                                                                                           [ 16%]
../usr/local/lib/python3.10/dist-packages/odl/test/discr/partition_test.py ...............   [ 16%]
../usr/local/lib/python3.10/dist-packages/odl/test/largescale/solvers/nonsmooth/default_functionals_slow_test.py s [ 16%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 18%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 20%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 22%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 24%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss             [ 25%]
../usr/local/lib/python3.10/dist-packages/odl/test/largescale/space/tensor_space_slow_test.py s [ 25%]
sssssssssssssssssssssssssssssssssss                                                          [ 26%]
../usr/local/lib/python3.10/dist-packages/odl/test/largescale/tomo/analytic_slow_test.py sss [ 26%]
sssssssssssssssssssssssssssssssssssssssssssss                                                [ 27%]
../usr/local/lib/python3.10/dist-packages/odl/test/largescale/tomo/ray_transform_slow_test.py s [ 27%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 29%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 31%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 33%]
sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss          [ 34%]
../usr/local/lib/python3.10/dist-packages/odl/test/largescale/trafos/fourier_slow_test.py ss [ 34%]
ssssssssssssss                                                                               [ 35%]
../usr/local/lib/python3.10/dist-packages/odl/test/operator/operator_test.py ............... [ 35%]
......................................................                                       [ 36%]
../usr/local/lib/python3.10/dist-packages/odl/test/operator/oputils_test.py ..........       [ 36%]
../usr/local/lib/python3.10/dist-packages/odl/test/operator/pspace_ops_test.py ............. [ 37%]
.........                                                                                    [ 37%]
../usr/local/lib/python3.10/dist-packages/odl/test/operator/tensor_ops_test.py ..........s.. [ 37%]
..s.........s......................                                                          [ 38%]
../usr/local/lib/python3.10/dist-packages/odl/test/set/domain_test.py ...................... [ 38%]
.                                                                                            [ 38%]
../usr/local/lib/python3.10/dist-packages/odl/test/set/sets_test.py ......                   [ 38%]
../usr/local/lib/python3.10/dist-packages/odl/test/set/space_test.py ............            [ 39%]
../usr/local/lib/python3.10/dist-packages/odl/test/solvers/functional/default_functionals_test.py . [ 39%]
............................................................................................ [ 41%]
....................................................                                         [ 42%]
../usr/local/lib/python3.10/dist-packages/odl/test/solvers/functional/functional_test.py ... [ 42%]
............................................................................................ [ 43%]
.ss......................................................................................... [ 45%]
..........                                                                                   [ 46%]
../usr/local/lib/python3.10/dist-packages/odl/test/solvers/iterative/iterative_test.py ..... [ 46%]
............                                                                                 [ 46%]
../usr/local/lib/python3.10/dist-packages/odl/test/solvers/nonsmooth/admm_test.py ..         [ 46%]
../usr/local/lib/python3.10/dist-packages/odl/test/solvers/nonsmooth/alternating_dual_updates_test.py . [ 46%]
                                                                                             [ 46%]
../usr/local/lib/python3.10/dist-packages/odl/test/solvers/nonsmooth/difference_convex_test.py . [ 46%]
                                                                                             [ 46%]
../usr/local/lib/python3.10/dist-packages/odl/test/solvers/nonsmooth/douglas_rachford_test.py . [ 46%]
...                                                                                          [ 46%]
../usr/local/lib/python3.10/dist-packages/odl/test/solvers/nonsmooth/forward_backward_test.py . [ 46%]
....                                                                                         [ 46%]
../usr/local/lib/python3.10/dist-packages/odl/test/solvers/nonsmooth/primal_dual_hybrid_gradient_test.py . [ 46%]
.                                                                                            [ 46%]
../usr/local/lib/python3.10/dist-packages/odl/test/solvers/nonsmooth/proximal_operator_test.py . [ 46%]
..............                                                                               [ 47%]
../usr/local/lib/python3.10/dist-packages/odl/test/solvers/nonsmooth/proximal_utils_test.py . [ 47%]
.......................................................................                      [ 48%]
../usr/local/lib/python3.10/dist-packages/odl/test/solvers/smooth/smooth_test.py ........... [ 48%]
.....................................................                                        [ 49%]
../usr/local/lib/python3.10/dist-packages/odl/test/solvers/util/steplen_test.py ...          [ 49%]
../usr/local/lib/python3.10/dist-packages/odl/test/space/pspace_test.py .................... [ 50%]
...............................................................ss                            [ 51%]
../usr/local/lib/python3.10/dist-packages/odl/test/space/space_utils_test.py .               [ 51%]
../usr/local/lib/python3.10/dist-packages/odl/test/space/tensors_test.py ................... [ 51%]
............................................................................................ [ 53%]
............................................................................................ [ 55%]
............................................................................................ [ 57%]
............................................................................................ [ 59%]
............................................................................................ [ 61%]
............................................................................................ [ 63%]
............................................................................................ [ 65%]
............................................................................................ [ 66%]
............................................................................................ [ 68%]
............................................................................................ [ 70%]
...................................................................................          [ 72%]
../usr/local/lib/python3.10/dist-packages/odl/test/system/import_test.py .                   [ 72%]
../usr/local/lib/python3.10/dist-packages/odl/test/test_doc.py s                             [ 72%]
../usr/local/lib/python3.10/dist-packages/odl/test/test_examples.py sssss                    [ 72%]
../usr/local/lib/python3.10/dist-packages/odl/test/tomo/backends/astra_cpu_test.py ss        [ 72%]
../usr/local/lib/python3.10/dist-packages/odl/test/tomo/backends/astra_cuda_test.py sssss    [ 72%]
../usr/local/lib/python3.10/dist-packages/odl/test/tomo/backends/astra_setup_test.py sssssss [ 72%]
sssss                                                                                        [ 72%]
../usr/local/lib/python3.10/dist-packages/odl/test/tomo/backends/skimage_test.py .           [ 72%]
../usr/local/lib/python3.10/dist-packages/odl/test/tomo/geometry/geometry_test.py .......... [ 73%]
............................................                                                 [ 73%]
../usr/local/lib/python3.10/dist-packages/odl/test/tomo/geometry/spect_geometry_test.py .    [ 73%]
../usr/local/lib/python3.10/dist-packages/odl/test/tomo/operators/ray_trafo_test.py ssssssss [ 74%]
sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss... [ 75%]
.......sssss.FFFFFssssFFFF                                                                   [ 76%]
../usr/local/lib/python3.10/dist-packages/odl/test/trafos/backends/pyfftw_bindings_test.py s [ 76%]
ssssssssssssssssssssssssssssssssssssss                                                       [ 77%]
../usr/local/lib/python3.10/dist-packages/odl/test/trafos/backends/pywt_bindings_test.py sss [ 77%]
sss                                                                                          [ 77%]
../usr/local/lib/python3.10/dist-packages/odl/test/trafos/fourier_test.py .................. [ 77%]
.................sssssssssssssssss......ss......ss.s.............                            [ 79%]
../usr/local/lib/python3.10/dist-packages/odl/test/trafos/util/ft_utils_test.py ............ [ 79%]
......                                                                                       [ 79%]
../usr/local/lib/python3.10/dist-packages/odl/test/trafos/wavelet_test.py ssssssssssssssssss [ 79%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 81%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 83%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 85%]
ssssssssssssssssssssssssssssssssssssssssss                                                   [ 86%]
../usr/local/lib/python3.10/dist-packages/odl/test/util/normalize_test.py .................. [ 86%]
.................................                                                            [ 87%]
../usr/local/lib/python3.10/dist-packages/odl/test/util/numerics_test.py ................... [ 87%]
............................................................................................ [ 89%]
............................................................................................ [ 91%]
............................................................................................ [ 93%]
...............................................................                              [ 94%]
../usr/local/lib/python3.10/dist-packages/odl/test/util/utility_test.py ....                 [ 94%]
../usr/local/lib/python3.10/dist-packages/odl/test/util/vectorization_test.py .........      [ 94%]
../usr/local/lib/python3.10/dist-packages/odl/tomo/analytic/filtered_back_projection.py .    [ 94%]
../usr/local/lib/python3.10/dist-packages/odl/tomo/geometry/conebeam.py ............         [ 95%]
../usr/local/lib/python3.10/dist-packages/odl/tomo/geometry/detector.py ................     [ 95%]
../usr/local/lib/python3.10/dist-packages/odl/tomo/geometry/geometry.py ..                   [ 95%]
../usr/local/lib/python3.10/dist-packages/odl/tomo/geometry/parallel.py ..............       [ 95%]
../usr/local/lib/python3.10/dist-packages/odl/tomo/util/utility.py ....                      [ 95%]
../usr/local/lib/python3.10/dist-packages/odl/trafos/fourier.py ..                           [ 95%]
../usr/local/lib/python3.10/dist-packages/odl/ufunc_ops/ufunc_ops.py ....................... [ 96%]
............................................................................................ [ 98%]
............................................................                                 [ 99%]
../usr/local/lib/python3.10/dist-packages/odl/util/normalize.py ....                         [ 99%]
../usr/local/lib/python3.10/dist-packages/odl/util/numerics.py ....                          [ 99%]
../usr/local/lib/python3.10/dist-packages/odl/util/testutils.py ....                         [ 99%]
../usr/local/lib/python3.10/dist-packages/odl/util/utility.py ...............                [ 99%]
../usr/local/lib/python3.10/dist-packages/odl/util/vectorization.py .                        [100%]

============================================= FAILURES =============================================
___________________________ test_anisotropic_voxels[ geometry='par2d' ] ____________________________

geometry = Parallel2dGeometry(
    uniform_partition(0.0, 3.142, 100),
    uniform_partition(-30.0, 30.0, 100)
)

    def test_anisotropic_voxels(geometry):
        """Test projection and backprojection with anisotropic voxels."""
        ndim = geometry.ndim
        shape = [10] * (ndim - 1) + [5]
        space = odl.uniform_discr([-1] * ndim, [1] * ndim, shape=shape,
                                  dtype='float32')
    
        # If no implementation is available, skip
        if ndim == 2 and not odl.tomo.ASTRA_AVAILABLE:
>           pytest.skip(msg='ASTRA not available, skipping 2d test')
E           TypeError: skip() got an unexpected keyword argument 'msg'

/usr/local/lib/python3.10/dist-packages/odl/test/tomo/operators/ray_trafo_test.py:362: TypeError
___________________________ test_anisotropic_voxels[ geometry='par3d' ] ____________________________

geometry = Parallel3dAxisGeometry(
    uniform_partition(0.0, 3.142, 100),
    uniform_partition([-30., -30.], [ 30.,  30.], (100, 100))
)

    def test_anisotropic_voxels(geometry):
        """Test projection and backprojection with anisotropic voxels."""
        ndim = geometry.ndim
        shape = [10] * (ndim - 1) + [5]
        space = odl.uniform_discr([-1] * ndim, [1] * ndim, shape=shape,
                                  dtype='float32')
    
        # If no implementation is available, skip
        if ndim == 2 and not odl.tomo.ASTRA_AVAILABLE:
            pytest.skip(msg='ASTRA not available, skipping 2d test')
        elif ndim == 3 and not odl.tomo.ASTRA_CUDA_AVAILABLE:
>           pytest.skip(msg='ASTRA_CUDA not available, skipping 3d test')
E           TypeError: skip() got an unexpected keyword argument 'msg'

/usr/local/lib/python3.10/dist-packages/odl/test/tomo/operators/ray_trafo_test.py:364: TypeError
___________________________ test_anisotropic_voxels[ geometry='cone2d' ] ___________________________

geometry = FanBeamGeometry(
    uniform_partition(0.0, 6.283, 100),
    uniform_partition(-30.0, 30.0, 100),
    src_radius=200.0,
    det_radius=100.0
)

    def test_anisotropic_voxels(geometry):
        """Test projection and backprojection with anisotropic voxels."""
        ndim = geometry.ndim
        shape = [10] * (ndim - 1) + [5]
        space = odl.uniform_discr([-1] * ndim, [1] * ndim, shape=shape,
                                  dtype='float32')
    
        # If no implementation is available, skip
        if ndim == 2 and not odl.tomo.ASTRA_AVAILABLE:
>           pytest.skip(msg='ASTRA not available, skipping 2d test')
E           TypeError: skip() got an unexpected keyword argument 'msg'

/usr/local/lib/python3.10/dist-packages/odl/test/tomo/operators/ray_trafo_test.py:362: TypeError
___________________________ test_anisotropic_voxels[ geometry='cone3d' ] ___________________________

geometry = ConeBeamGeometry(
    uniform_partition(0.0, 6.283, 100),
    uniform_partition([-60., -60.], [ 60.,  60.], (100, 100)),
    src_radius=200.0,
    det_radius=100.0
)

    def test_anisotropic_voxels(geometry):
        """Test projection and backprojection with anisotropic voxels."""
        ndim = geometry.ndim
        shape = [10] * (ndim - 1) + [5]
        space = odl.uniform_discr([-1] * ndim, [1] * ndim, shape=shape,
                                  dtype='float32')
    
        # If no implementation is available, skip
        if ndim == 2 and not odl.tomo.ASTRA_AVAILABLE:
            pytest.skip(msg='ASTRA not available, skipping 2d test')
        elif ndim == 3 and not odl.tomo.ASTRA_CUDA_AVAILABLE:
>           pytest.skip(msg='ASTRA_CUDA not available, skipping 3d test')
E           TypeError: skip() got an unexpected keyword argument 'msg'

/usr/local/lib/python3.10/dist-packages/odl/test/tomo/operators/ray_trafo_test.py:364: TypeError
__________________________ test_anisotropic_voxels[ geometry='helical' ] ___________________________

geometry = ConeBeamGeometry(
    uniform_partition(0.0, 50.27, 100),
    uniform_partition([-30.,  -3.], [ 30.,   3.], (100, 100)),
    src_radius=200.0,
    det_radius=100.0,
    pitch=5.0
)

    def test_anisotropic_voxels(geometry):
        """Test projection and backprojection with anisotropic voxels."""
        ndim = geometry.ndim
        shape = [10] * (ndim - 1) + [5]
        space = odl.uniform_discr([-1] * ndim, [1] * ndim, shape=shape,
                                  dtype='float32')
    
        # If no implementation is available, skip
        if ndim == 2 and not odl.tomo.ASTRA_AVAILABLE:
            pytest.skip(msg='ASTRA not available, skipping 2d test')
        elif ndim == 3 and not odl.tomo.ASTRA_CUDA_AVAILABLE:
>           pytest.skip(msg='ASTRA_CUDA not available, skipping 3d test')
E           TypeError: skip() got an unexpected keyword argument 'msg'

/usr/local/lib/python3.10/dist-packages/odl/test/tomo/operators/ray_trafo_test.py:364: TypeError
_____________________________________ test_detector_shifts_2d ______________________________________

    def test_detector_shifts_2d():
        """Check that detector shifts are handled correctly.
    
        We forward project a cubic phantom and check that ray transform
        and back-projection with and without detector shifts are
        numerically close (the error depends on domain discretization).
        """
    
        if not odl.tomo.ASTRA_AVAILABLE:
>           pytest.skip(msg='ASTRA not available, skipping 2d test')
E           TypeError: skip() got an unexpected keyword argument 'msg'

/usr/local/lib/python3.10/dist-packages/odl/test/tomo/operators/ray_trafo_test.py:489: TypeError
______________________________________ test_source_shifts_2d _______________________________________

    def test_source_shifts_2d():
        """Check that source shifts are handled correctly.
    
        We forward project a Shepp-Logan phantom and check that reconstruction
        with flying focal spot is equal to a sum of reconstructions with two
        geometries which mimic ffs by using initial angular offsets and
        detector shifts
        """
    
        if not odl.tomo.ASTRA_AVAILABLE:
>           pytest.skip(msg='ASTRA required but not available')
E           TypeError: skip() got an unexpected keyword argument 'msg'

/usr/local/lib/python3.10/dist-packages/odl/test/tomo/operators/ray_trafo_test.py:546: TypeError
_____________________________________ test_detector_shifts_3d ______________________________________

    def test_detector_shifts_3d():
        """Check that detector shifts are handled correctly.
    
        We forward project a cubic phantom and check that ray transform
        and back-projection with and without detector shifts are
        numerically close (the error depends on domain discretization).
        """
        if not odl.tomo.ASTRA_CUDA_AVAILABLE:
>           pytest.skip(msg='ASTRA CUDA required but not available')
E           TypeError: skip() got an unexpected keyword argument 'msg'

/usr/local/lib/python3.10/dist-packages/odl/test/tomo/operators/ray_trafo_test.py:625: TypeError
______________________________________ test_source_shifts_3d _______________________________________

    def test_source_shifts_3d():
        """Check that source shifts are handled correctly.
    
        We forward project a Shepp-Logan phantom and check that reconstruction
        with flying focal spot is equal to a sum of reconstructions with two
        geometries which mimic ffs by using initial angular offsets and
        detector shifts
        """
        if not odl.tomo.ASTRA_CUDA_AVAILABLE:
>           pytest.skip(msg='ASTRA_CUDA not available, skipping 3d test')
E           TypeError: skip() got an unexpected keyword argument 'msg'

/usr/local/lib/python3.10/dist-packages/odl/test/tomo/operators/ray_trafo_test.py:680: TypeError
========================================= warnings summary =========================================
../usr/local/lib/python3.10/dist-packages/_pytest/config/__init__.py:1277
  /usr/local/lib/python3.10/dist-packages/_pytest/config/__init__.py:1277: PytestAssertRewriteWarning: Module already imported so cannot be rewritten: odl
    self._mark_plugins_for_rewrite(hook)

discr/discr_ops.py: 2 warnings
discr/discr_utils.py: 1 warning
test/discr/discr_utils_test.py: 2 warnings
test/tomo/geometry/geometry_test.py: 3 warnings
test/tomo/operators/ray_trafo_test.py: 11 warnings
tomo/geometry/conebeam.py: 4 warnings
  /usr/local/lib/python3.10/dist-packages/odl/discr/discr_utils.py:631: UserWarning: Unable to infer accurate dtype for interpolation coefficients, defaulting to `float`.
    warn("Unable to infer accurate dtype for"

test/discr/discr_ops_test.py::test_resizing_op_mixed_uni_nonuni
  /usr/local/lib/python3.10/dist-packages/odl/discr/discr_ops.py:460: RuntimeWarning: invalid value encountered in cast
    offset = np.around(offset_float).astype(int)

test/solvers/functional/default_functionals_test.py::test_kullback_leibler_cross_entorpy[ space=power_space_unif_discr - tspace_impl='numpy' ]
  /usr/local/lib/python3.10/dist-packages/odl/space/npy_tensors.py:429: ComplexWarning: Casting complex values to real discards the imaginary part
    arr = np.array(inp, copy=False, dtype=self.dtype, ndmin=self.ndim,

test/space/pspace_test.py::test_real_setter_product_space[ space=product_space - element=space ]
test/space/pspace_test.py::test_imag_setter_product_space[ space=product_space - element=space ]
test/space/pspace_test.py::test_real_setter_product_space[ space=power_space - element=space ]
test/space/pspace_test.py::test_imag_setter_product_space[ space=power_space - element=space ]
  /usr/local/lib/python3.10/dist-packages/odl/space/base_tensors.py:666: ComplexWarning: Casting complex values to real discards the imaginary part
    return self.asarray().astype(dtype, copy=False)

ufunc_ops/ufunc_ops.py::odl.ufunc_ops.ufunc_ops.arccos_op
  /usr/local/lib/python3.10/dist-packages/odl/space/npy_tensors.py:1669: RuntimeWarning: invalid value encountered in arccos
    res = ufunc(*inputs, **kwargs)

ufunc_ops/ufunc_ops.py::odl.ufunc_ops.ufunc_ops.arccosh_op
  /usr/local/lib/python3.10/dist-packages/odl/space/npy_tensors.py:1669: RuntimeWarning: invalid value encountered in arccosh
    res = ufunc(*inputs, **kwargs)

ufunc_ops/ufunc_ops.py::odl.ufunc_ops.ufunc_ops.arcsin_op
  /usr/local/lib/python3.10/dist-packages/odl/space/npy_tensors.py:1669: RuntimeWarning: invalid value encountered in arcsin
    res = ufunc(*inputs, **kwargs)

ufunc_ops/ufunc_ops.py::odl.ufunc_ops.ufunc_ops.arctanh_func
  /usr/local/lib/python3.10/dist-packages/odl/ufunc_ops/ufunc_ops.py:334: RuntimeWarning: divide by zero encountered in arctanh
    return getattr(np, name)(x)

ufunc_ops/ufunc_ops.py::odl.ufunc_ops.ufunc_ops.arctanh_op
  /usr/local/lib/python3.10/dist-packages/odl/space/npy_tensors.py:1669: RuntimeWarning: divide by zero encountered in arctanh
    res = ufunc(*inputs, **kwargs)

ufunc_ops/ufunc_ops.py::odl.ufunc_ops.ufunc_ops.arctanh_op
  /usr/local/lib/python3.10/dist-packages/odl/space/npy_tensors.py:1669: RuntimeWarning: invalid value encountered in arctanh
    res = ufunc(*inputs, **kwargs)

ufunc_ops/ufunc_ops.py::odl.ufunc_ops.ufunc_ops.log10_op
  /usr/local/lib/python3.10/dist-packages/odl/space/npy_tensors.py:1669: RuntimeWarning: invalid value encountered in log10
    res = ufunc(*inputs, **kwargs)

ufunc_ops/ufunc_ops.py::odl.ufunc_ops.ufunc_ops.log1p_op
  /usr/local/lib/python3.10/dist-packages/odl/space/npy_tensors.py:1669: RuntimeWarning: divide by zero encountered in log1p
    res = ufunc(*inputs, **kwargs)

ufunc_ops/ufunc_ops.py::odl.ufunc_ops.ufunc_ops.log2_op
  /usr/local/lib/python3.10/dist-packages/odl/space/npy_tensors.py:1669: RuntimeWarning: invalid value encountered in log2
    res = ufunc(*inputs, **kwargs)

ufunc_ops/ufunc_ops.py::odl.ufunc_ops.ufunc_ops.log_op
  /usr/local/lib/python3.10/dist-packages/odl/space/npy_tensors.py:1669: RuntimeWarning: invalid value encountered in log
    res = ufunc(*inputs, **kwargs)

ufunc_ops/ufunc_ops.py::odl.ufunc_ops.ufunc_ops.sqrt_op
  /usr/local/lib/python3.10/dist-packages/odl/space/npy_tensors.py:1669: RuntimeWarning: invalid value encountered in sqrt
    res = ufunc(*inputs, **kwargs)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
===================================== short test summary info ======================================
FAILED ../usr/local/lib/python3.10/dist-packages/odl/test/tomo/operators/ray_trafo_test.py::test_anisotropic_voxels[ geometry='par2d' ]
FAILED ../usr/local/lib/python3.10/dist-packages/odl/test/tomo/operators/ray_trafo_test.py::test_anisotropic_voxels[ geometry='par3d' ]
FAILED ../usr/local/lib/python3.10/dist-packages/odl/test/tomo/operators/ray_trafo_test.py::test_anisotropic_voxels[ geometry='cone2d' ]
FAILED ../usr/local/lib/python3.10/dist-packages/odl/test/tomo/operators/ray_trafo_test.py::test_anisotropic_voxels[ geometry='cone3d' ]
FAILED ../usr/local/lib/python3.10/dist-packages/odl/test/tomo/operators/ray_trafo_test.py::test_anisotropic_voxels[ geometry='helical' ]
FAILED ../usr/local/lib/python3.10/dist-packages/odl/test/tomo/operators/ray_trafo_test.py::test_detector_shifts_2d
FAILED ../usr/local/lib/python3.10/dist-packages/odl/test/tomo/operators/ray_trafo_test.py::test_source_shifts_2d
FAILED ../usr/local/lib/python3.10/dist-packages/odl/test/tomo/operators/ray_trafo_test.py::test_detector_shifts_3d
FAILED ../usr/local/lib/python3.10/dist-packages/odl/test/tomo/operators/ray_trafo_test.py::test_source_shifts_3d
==================== 9 failed, 3467 passed, 1456 skipped, 41 warnings in 54.16s ====================

@elma16
Copy link
Author

elma16 commented Jan 8, 2025

If I try installing it using conda-forge:

!pip install -q condacolab
import condacolab
condacolab.install()
!mamba install conda-forge::odl

I get the same failing 9 tests. I am unsure as to how I managed to get the results at the beginning 🤔

@leftaroundabout
Copy link
Contributor

leftaroundabout commented Jan 8, 2025

All good! It seems you had ODL 0.7 previously, which is known to be incompatible with non-ancient NumPy / SciPy versions.

Now you have ODL 0.8.1, which has fixed those issues. The test failures you're getting now are #1670, which you can safely ignore - this is purely a PyTest problem and has nothing to do with the code that's being tested.

However, depending on what kind of work you intent to do with ODL you might want to consider installing Astra (with Cuda enabled), which would also have the effect that those pytest.skip calls don't happen.

@elma16
Copy link
Author

elma16 commented Jan 8, 2025

Aha! I see now. In fact, if I also import astra, I get

=================== 3598 passed, 1329 skipped, 1 xfailed, 44 warnings in 53.56s ====================

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants