Skip to content

Commit

Permalink
EXA Fix plot tomography l1 reconstruction (scikit-learn#11100)
Browse files Browse the repository at this point in the history
* Ensure that the number of angles is integer

* Fix plot_tomography_l1_reconstruction.py

Error was: TypeError: 'numpy.float64' object cannot be interpreted as an integer.

[doc build]
  • Loading branch information
lesteve authored and jnothman committed May 16, 2018
1 parent 48f3303 commit 1557cb8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions examples/applications/plot_tomography_l1_reconstruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class :class:`sklearn.linear_model.Lasso`, that uses the coordinate descent
the circular artifact separating the pixels in the corners, that have
contributed to fewer projections than the central disk.
"""
from __future__ import division

print(__doc__)

Expand All @@ -50,7 +51,7 @@ class :class:`sklearn.linear_model.Lasso`, that uses the coordinate descent

def _weights(x, dx=1, orig=0):
x = np.ravel(x)
floor_x = np.floor((x - orig) / dx)
floor_x = np.floor((x - orig) / dx).astype(np.int64)
alpha = (x - orig - floor_x * dx) / dx
return np.hstack((floor_x, floor_x + 1)), np.hstack((1 - alpha, alpha))

Expand Down Expand Up @@ -112,7 +113,7 @@ def generate_synthetic_data():

# Generate synthetic images, and projections
l = 128
proj_operator = build_projection_operator(l, l / 7.)
proj_operator = build_projection_operator(l, l // 7)
data = generate_synthetic_data()
proj = proj_operator * data.ravel()[:, np.newaxis]
proj += 0.15 * np.random.randn(*proj.shape)
Expand Down

0 comments on commit 1557cb8

Please sign in to comment.