Skip to content

Commit

Permalink
allow incomplete complex files to load fix #848
Browse files Browse the repository at this point in the history
  • Loading branch information
jopohl committed Mar 13, 2021
1 parent ca39660 commit 71153ba
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/urh/signalprocessing/IQArray.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,10 @@ def convert_array_to_iq(arr: np.ndarray) -> np.ndarray:
arr = arr.view(np.float32)
elif arr.dtype == np.complex128:
arr = arr.view(np.float64)
return arr.reshape((-1, 2), order="C")
if len(arr) % 2 == 0:
return arr.reshape((-1, 2), order="C")
else: # ignore the last half sample to avoid a conversion error
return arr[:-1].reshape((-1, 2), order="C")
elif arr.ndim == 2:
return arr
else:
Expand Down

0 comments on commit 71153ba

Please sign in to comment.