Skip to content

Commit

Permalink
Bugfix
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Kümmerer <[email protected]>
  • Loading branch information
matthias-k committed Mar 28, 2024
1 parent 9828783 commit a02cd33
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pysaliency/utils/variable_length_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self, data: Union[np.ndarray, List[list]], lengths: Optional[np.nda
else:
if not data.ndim >= 2:
raise ValueError("If data is a numpy array, it has to be at least 2-dimensional")
if lengths and np.max(lengths) > data.shape[1]:
if len(lengths) and np.max(lengths) > data.shape[1]:
raise ValueError("The specified lengths are larger than the number of columns in the data array")

else:
Expand All @@ -63,7 +63,7 @@ def __init__(self, data: Union[np.ndarray, List[list]], lengths: Optional[np.nda
if isinstance(data, np.ndarray):
self._data = data
else:
self._data = build_padded_2d_array(data, max_length=np.max(lengths) if lengths else 0)
self._data = build_padded_2d_array(data, max_length=np.max(lengths) if len(lengths) else 0)

# max_len = np.max(lengths)
# self._data = np.full((len(data), max_len), np.nan)
Expand Down

0 comments on commit a02cd33

Please sign in to comment.