odlgroup / odl

Operator Discretization Library https://odlgroup.github.io/odl/
Mozilla Public License 2.0
374 stars 105 forks source link

pytest error #1574

Open mimeng123 opened 4 years ago

mimeng123 commented 4 years ago

when I run the command python -c "import odl; odl.test()" ,receive a error as follow . I'm not familiar with this code,what should I do ?

__ test_projector[ geom='par2d' - impl='astra_cuda' - angles='uniform' - out-of-place ] ___

projector = RayTransform: uniform_discr([-20., -20.], [ 20., 20.], (100, 100), dtype='float32') -> uniform_discr([ 0., -30.], [ 6.2832, 30. ], (100, 100), dtype='float32') in_place = False

def test_projector(projector, in_place):
    """Test Ray transform forward projection."""
    # TODO: this needs to be improved
    # Accept 10% errors
    rtol = 1e-1

    # Create Shepp-Logan phantom
    vol = projector.domain.one()

    # Calculate projection
    if in_place:
        proj = projector.range.zero()
        projector(vol, out=proj)
    else:
        proj = projector(vol)

    # We expect maximum value to be along diagonal
    expected_max = projector.domain.partition.extent[0] * np.sqrt(2)
  assert proj.ufuncs.max() == pytest.approx(expected_max, rel=rtol)

E AssertionError: assert 93.279182 == 56.568542494923804 ± 5.7e+00 E + where 93.279182 = <bound method TensorSpaceUfuncs.max of <odl.util.ufuncs.TensorSpaceUfuncs object at 0 x7f79f97d4890>>() E + where <bound method TensorSpaceUfuncs.max of <odl.util.ufuncs.TensorSpaceUfuncs object at 0x7f79f97d4 890>> = <odl.util.ufuncs.TensorSpaceUfuncs object at 0x7f79f97d4890>.max E + where <odl.util.ufuncs.TensorSpaceUfuncs object at 0x7f79f97d4890> = uniform_discr([ 0., -30.], [ 6.2832, 30. ], (100, 100), dtype='float32').element(\n [[ 0., 0., 0., ..., 0.,...., 0., 0., ..., 0., 0., 0.],\n [ 0., 0., 0., ..., 0., 0., 0.],\n [ 0., 0., 0., ..., 0., 0., 0.]]\n).ufuncs E + and 56.568542494923804 ± 5.7e+00 = <function approx at 0x7f79d2f3def0>(56.568542494923804, rel=0.1) E + where <function approx at 0x7f79d2f3def0> = pytest.approx

anaconda3/envs/ct_odl/lib/python3.7/site-packages/odl/test/tomo/operators/ray_trafo_test.py:216: AssertionError

kohr-h commented 4 years ago

Hi @mimeng123. This may be due to the version of ASTRA used. We try our best to be backwards-compatible to 1.7, but there may have been a change in the recent refactoring of the tomo part that broke old versions. Which version of ASTRA are you using? In the recent development versions, there was at some point a change in scaling behavior which might be causing this issue.

If you don't need 2D parallel beam projections, then you don't need to worry about this failing test.

mimeng123 commented 4 years ago

Hi Mr Kohr-h.Thanks for your reply! I use the version of the ASTRA :1.9.9.dev4 ,the version of the ODL :1.0.0.dev0 .And I also need the parallel beam projections.Which version of ASTRA and ODL be suited to use?