summaryrefslogtreecommitdiffstats
path: root/samples/python
diff options
context:
space:
mode:
authorDaniel M. Pelt <D.M.Pelt@cwi.nl>2016-04-25 10:47:59 +0200
committerDaniel M. Pelt <D.M.Pelt@cwi.nl>2016-04-25 10:47:59 +0200
commit1e26f7602b6685c584fd4d857353f390622e3a34 (patch)
treeb6a494550b24896c10ffda19cdebe02b9c699221 /samples/python
parent8b67986464daae799d0171aed70a0d2cd96fd8d1 (diff)
downloadastra-1e26f7602b6685c584fd4d857353f390622e3a34.tar.gz
astra-1e26f7602b6685c584fd4d857353f390622e3a34.tar.bz2
astra-1e26f7602b6685c584fd4d857353f390622e3a34.tar.xz
astra-1e26f7602b6685c584fd4d857353f390622e3a34.zip
Change flatten to ravel in Python code
Diffstat (limited to 'samples/python')
-rw-r--r--samples/python/s009_projection_matrix.py2
-rw-r--r--samples/python/s015_fp_bp.py6
-rw-r--r--samples/python/s017_OpTomo.py2
3 files changed, 5 insertions, 5 deletions
diff --git a/samples/python/s009_projection_matrix.py b/samples/python/s009_projection_matrix.py
index c4c4557..e20d58c 100644
--- a/samples/python/s009_projection_matrix.py
+++ b/samples/python/s009_projection_matrix.py
@@ -46,7 +46,7 @@ W = astra.matrix.get(matrix_id)
# Manually use this projection matrix to do a projection:
import scipy.io
P = scipy.io.loadmat('phantom.mat')['phantom256']
-s = W.dot(P.flatten())
+s = W.dot(P.ravel())
s = np.reshape(s, (len(proj_geom['ProjectionAngles']),proj_geom['DetectorCount']))
import pylab
diff --git a/samples/python/s015_fp_bp.py b/samples/python/s015_fp_bp.py
index fa0bf86..ff0b30a 100644
--- a/samples/python/s015_fp_bp.py
+++ b/samples/python/s015_fp_bp.py
@@ -46,12 +46,12 @@ class astra_wrap(object):
def matvec(self,v):
sid, s = astra.create_sino(np.reshape(v,(vol_geom['GridRowCount'],vol_geom['GridColCount'])),self.proj_id)
astra.data2d.delete(sid)
- return s.flatten()
+ return s.ravel()
def rmatvec(self,v):
bid, b = astra.create_backprojection(np.reshape(v,(len(proj_geom['ProjectionAngles']),proj_geom['DetectorCount'],)),self.proj_id)
astra.data2d.delete(bid)
- return b.flatten()
+ return b.ravel()
vol_geom = astra.create_vol_geom(256, 256)
proj_geom = astra.create_proj_geom('parallel', 1.0, 384, np.linspace(0,np.pi,180,False))
@@ -65,7 +65,7 @@ proj_id = astra.create_projector('cuda',proj_geom,vol_geom)
sinogram_id, sinogram = astra.create_sino(P, proj_id)
# Reshape the sinogram into a vector
-b = sinogram.flatten()
+b = sinogram.ravel()
# Call lsqr with ASTRA FP and BP
import scipy.sparse.linalg
diff --git a/samples/python/s017_OpTomo.py b/samples/python/s017_OpTomo.py
index 967fa64..214e9a7 100644
--- a/samples/python/s017_OpTomo.py
+++ b/samples/python/s017_OpTomo.py
@@ -50,7 +50,7 @@ pylab.figure(2)
pylab.imshow(sinogram)
# Run the lsqr linear solver
-output = scipy.sparse.linalg.lsqr(W, sinogram.flatten(), iter_lim=150)
+output = scipy.sparse.linalg.lsqr(W, sinogram.ravel(), iter_lim=150)
rec = output[0].reshape([256, 256])
pylab.figure(3)