8000 fix data representation for flight summary · RocketPy-Team/Infinity-API@65538e8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 65538e8

Browse files
fix data representation for flight summary
1 parent 58be67e commit 65538e8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/utils.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def to_python_primitive(v: Any) -> Any:
1616
1717
Args:
1818
v: Any value, particularly those with a 'source' attribute
19-
containing numpy arrays or generic types.
19+
containing numpy arrays or generic types.
2020
2121
Returns:
2222
The primitive representation of the input value.
@@ -29,6 +29,13 @@ def to_python_primitive(v: Any) -> Any:
2929
return v.source.item()
3030

3131
return str(v.source)
32+
33+
if isinstance(v, (np.generic,)):
34+
return v.item()
35+
36+
if isinstance(v, (np.ndarray,)):
37+
return v.tolist()
38+
3239
return str(v)
3340

3441

0 commit comments

Comments
 (0)
0