Skip to content

Commit

Permalink
BUG: fix error in parallel_beam_geometry overestimating number of points
Browse files Browse the repository at this point in the history
  • Loading branch information
adler-j committed Jan 3, 2017
1 parent 93497c7 commit d605c64
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
6 changes: 3 additions & 3 deletions odl/test/tomo/geometry/geometry_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,14 @@ def test_parallel_3d_single_axis_geometry():
assert repr(geom)


def test_parallel_beam_helper():
def test_parallel_beam_geometry_helper():
"""Test that parallel_beam_geometry satisfies the sampling conditions."""
# --- 2d case ---
space = odl.uniform_discr([-1, -1], [1, 1], [20, 20])
geometry = odl.tomo.parallel_beam_geometry(space)

rho = np.sqrt(2)
omega = 2 * np.pi * 10.0
omega = np.pi * 10.0

# Validate angles
assert geometry.motion_partition.is_uniform
Expand Down Expand Up @@ -168,7 +168,7 @@ def test_parallel_beam_helper():
geometry = odl.tomo.parallel_beam_geometry(space)

rho = np.sqrt(2) * 2
omega = 2 * np.pi * 10.0
omega = np.pi * 10.0

# Validate angles
assert geometry.motion_partition.is_uniform
Expand Down
14 changes: 9 additions & 5 deletions odl/tomo/geometry/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ def parallel_beam_geometry(space, angles=None, det_shape=None):
flexibility of the geometries, but simply want a geometry that works.
This default geometry gives a fully sampled sinogram according to the
nyquist criterion, which in general results in a very large number of
Nyquist criterion, which in general results in a very large number of
samples.
Parameters
Expand Down Expand Up @@ -462,9 +462,9 @@ def parallel_beam_geometry(space, angles=None, det_shape=None):
>>> space = odl.uniform_discr([-1, -1], [1, 1], [20, 20])
>>> geometry = parallel_beam_geometry(space)
>>> geometry.angles.size
89
45
>>> geometry.detector.size
57
29
Notes
-----
Expand Down Expand Up @@ -507,9 +507,13 @@ def parallel_beam_geometry(space, angles=None, det_shape=None):
corners = space.domain.corners()[:, :2]
rho = np.max(np.linalg.norm(corners, axis=1))

# Find default values according to Nyquist criterion
# Find default values according to Nyquist criterion.

# We assume that the function is bandlimited by a wave along the x or y
# axis. The highest frequency we can measure is then a standing wave with
# period of twice the inter-node distance.
min_side = min(space.partition.cell_sides[:2])
omega = 2 * np.pi / min_side
omega = np.pi / min_side

if det_shape is None:
if space.ndim == 2:
Expand Down

0 comments on commit d605c64

Please sign in to comment.