Refactor radar system
This commit is contained in:
@@ -119,7 +119,7 @@ def decode_result_collection(payload: bytes) -> ResultCollection:
|
||||
image_y_axis = np.frombuffer(cursor.read_bytes(y_count * 4), dtype="<f4").astype(np.float32, copy=False)
|
||||
value_count = x_count * y_count
|
||||
image_values = np.frombuffer(cursor.read_bytes(value_count * 4), dtype="<f4").astype(np.float32, copy=False)
|
||||
image = image_values.reshape((y_count, x_count)) if value_count > 0 else np.zeros((0, 0), dtype=np.float32)
|
||||
image = image_values.reshape((y_count, x_count))
|
||||
return ResultPayload(
|
||||
processing_name=name,
|
||||
kind=kind,
|
||||
@@ -130,13 +130,11 @@ def decode_result_collection(payload: bytes) -> ResultCollection:
|
||||
if kind == 4:
|
||||
table_columns = cursor.read_u32()
|
||||
table_rows = cursor.read_u32()
|
||||
if table_rows and not table_columns:
|
||||
raise ValueError("Result table with rows must have at least one column")
|
||||
value_count = table_columns * table_rows
|
||||
table_values = np.frombuffer(cursor.read_bytes(value_count * 4), dtype="<f4").astype(np.float32, copy=False)
|
||||
table = (
|
||||
table_values.reshape((table_rows, table_columns))
|
||||
if value_count > 0 and table_columns > 0
|
||||
else np.zeros((0, 0), dtype=np.float32)
|
||||
)
|
||||
table = table_values.reshape((table_rows, table_columns))
|
||||
return ResultPayload(
|
||||
processing_name=name,
|
||||
kind=kind,
|
||||
|
||||
Reference in New Issue
Block a user