Skip to content

Commit 71153ba

Browse files
committed
allow incomplete complex files to load fix #848
1 parent ca39660 commit 71153ba

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/urh/signalprocessing/IQArray.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,10 @@ def convert_array_to_iq(arr: np.ndarray) -> np.ndarray:
209209
arr = arr.view(np.float32)
210210
elif arr.dtype == np.complex128:
211211
arr = arr.view(np.float64)
212-
return arr.reshape((-1, 2), order="C")
212+
if len(arr) % 2 == 0:
213+
return arr.reshape((-1, 2), order="C")
214+
else: # ignore the last half sample to avoid a conversion error
215+
return arr[:-1].reshape((-1, 2), order="C")
213216
elif arr.ndim == 2:
214217
return arr
215218
else:

0 commit comments

Comments
 (0)