Skip to content

Commit

Permalink
Simplify syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
dnerini committed Jun 20, 2019
1 parent 1c59593 commit 498a74b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pysteps/motion/lucaskanade.py
Original file line number Diff line number Diff line change
Expand Up @@ -688,10 +688,10 @@ def _declustering(x, y, u, v, decl_grid, min_nr_samples):
"""

# make sure these are all numpy vertical arrays
x = np.atleast_1d(np.array(x).squeeze())[:, None]
y = np.atleast_1d(np.array(y).squeeze())[:, None]
u = np.atleast_1d(np.array(u).squeeze())[:, None]
v = np.atleast_1d(np.array(v).squeeze())[:, None]
x = np.array(x).flatten()[:, None]
y = np.array(y).flatten()[:, None]
u = np.array(u).flatten()[:, None]
v = np.array(v).flatten()[:, None]

# return empty arrays if the number of sparse vectors is < min_nr_samples
if x.size < min_nr_samples:
Expand Down Expand Up @@ -785,10 +785,10 @@ def _interpolate_sparse_vectors(
"""

# make sure these are vertical arrays
x = np.atleast_1d(np.array(x).squeeze())[:, None]
y = np.atleast_1d(np.array(y).squeeze())[:, None]
u = np.atleast_1d(np.array(u).squeeze())[:, None]
v = np.atleast_1d(np.array(v).squeeze())[:, None]
x = np.array(x).flatten()[:, None]
y = np.array(y).flatten()[:, None]
u = np.array(u).flatten()[:, None]
v = np.array(v).flatten()[:, None]
points = np.concatenate((x, y), axis=1)
npoints = points.shape[0]

Expand Down

0 comments on commit 498a74b

Please sign in to comment.