Skip to content

Commit

Permalink
Resolve #530 (#531)
Browse files Browse the repository at this point in the history
* Add a test for fbp method

* Add support for fbp on gpu

* Add comment to test as per PR review
  • Loading branch information
bwohlberg authored Jun 12, 2024
1 parent d990555 commit e7df8d2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 1 addition & 2 deletions scico/linop/xray/astra.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ def fbp(self, sino: jax.Array, filter_type: str = "Ram-Lak") -> jax.Array:
<https://www.astra-toolbox.com/docs/algs/FBP_CUDA.html>`__.
"""

# Just use the CPU FBP alg for now; hitting memory issues with GPU one.
def f(sino):
sino = _ensure_writeable(sino)
sino_id = astra.data2d.create("-sino", self.proj_geom, sino)
Expand All @@ -200,7 +199,7 @@ def f(sino):
rec_id = astra.data2d.create("-vol", self.vol_geom)

# start to populate config
cfg = astra.astra_dict("FBP")
cfg = astra.astra_dict("FBP_CUDA" if self.device == "gpu" else "FBP")
cfg["ReconstructionDataId"] = rec_id
cfg["ProjectorId"] = self.proj_id
cfg["ProjectionDataId"] = sino_id
Expand Down
7 changes: 7 additions & 0 deletions scico/test/linop/xray/test_astra.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ def test_adjoint_typical_input(testobj):
adjoint_test(A, x=x, rtol=get_tol())


def test_fbp(testobj):
x = testobj.A.fbp(testobj.y)
# Test for a bug (related to calling the Astra CPU FBP implementation
# when using a FPU device) that resulted in a constant zero output.
assert np.sum(np.abs(x)) > 0.0


def test_jit_in_DiagonalStack():
"""See https://github.com/lanl/scico/issues/331"""
N = 10
Expand Down

0 comments on commit e7df8d2

Please sign in to comment.