Skip to content

Commit db52a2d

Browse files
committed
Add an explicit check that N_t < T
1 parent 8a5476b commit db52a2d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pysteps/optflow/darts.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ def DARTS(Z, **kwargs):
3838
N_y : int
3939
Number of DFT coefficients to use for the input images, y-axis (default=50).
4040
N_t : int
41-
Number of DFT coefficients to use for the input images, time axis (default=4).
41+
Number of DFT coefficients to use for the input images, time axis (default=4).
42+
N_t must be strictly smaller than T.
4243
M_x : int
4344
Number of DFT coefficients to compute for the output advection field,
4445
x-axis (default=2).
@@ -73,6 +74,10 @@ def DARTS(Z, **kwargs):
7374
print_info = kwargs.get("print_info", False)
7475
lsq_method = kwargs.get("lsq_method", 2)
7576
verbose = kwargs.get("verbose", True)
77+
78+
if N_t >= Z.shape[0]:
79+
raise ValueError("N_t = %d >= %d = T, but N_t < T required" % (N_t, Z.shape[0]))
80+
7681
if verbose:
7782
print("Computing the motion field with the DARTS method.")
7883
t0 = time.time()

0 commit comments

Comments
 (0)