def build_projection_operator(l_x, n_dir):
 (X, Y) = _generate_center_coordinates(l_x)
 angles = np.linspace(0, np.pi, n_dir, endpoint=False)
 (data_inds, weights, camera_inds) = ([], [], [])
 data_unravel_indices = np.arange((l_x ** 2))
 data_unravel_indices = np.hstack((data_unravel_indices, data_unravel_indices))
 for (i, angle) in enumerate(angles):
  Xrot = ((np.cos(angle) * X) - (np.sin(angle) * Y))
  (inds, w) = _weights(Xrot, dx=1, orig=X.min())
  mask = np.logical_and((inds >= 0), (inds < l_x))
  weights += list(w[mask])
  camera_inds += list((inds[mask] + (i * l_x)))
  data_inds += list(data_unravel_indices[mask])
 proj_operator = sparse.coo_matrix((weights, (camera_inds, data_inds)))
 return proj_operator

def build_projection_operator ( l_x , n_dir ) : ( X , Y ) = _generate_center_coordinates ( l_x ) angles = np . linspace ( 0 , np . pi , n_dir , endpoint = False ) ( data_inds , weights , camera_inds ) = ( [ ] , [ ] , [ ] ) data_unravel_indices = np . arange ( ( l_x ** 2 ) ) data_unravel_indices = np . hstack ( ( data_unravel_indices , data_unravel_indices ) ) for ( i , angle ) in enumerate ( angles ) : Xrot = ( ( np . cos ( angle ) * X ) - ( np . sin ( angle ) * Y ) ) ( inds , w ) = _weights ( Xrot , dx = 1 , orig = X . min ( ) ) mask = np . logical_and ( ( inds >= 0 ) , ( inds < l_x ) ) weights += list ( w [ mask ] ) camera_inds += list ( ( inds [ mask ] + ( i * l_x ) ) ) data_inds += list ( data_unravel_indices [ mask ] ) proj_operator = sparse . coo_matrix ( ( weights , ( camera_inds , data_inds ) ) ) return proj_operator
compute the tomography design matrix .