org-arl / fjage

Framework for Java and Groovy Agents
https://fjage.readthedocs.io/en/latest/
Other
26 stars 13 forks source link

Complex number support for fjåge JSON protocol #249

Open mchitre opened 2 years ago

mchitre commented 2 years ago

Some languages support complex arrays (e.g. Julia, Python, etc). But JSON doesn't, and Java doesn't. We serialize complex arrays as interleaved real/imaginary parts, which is fine. But we need a way to indicate that the array data is to be treated as complex.

UnetStack uses a mechanism or adding a boolean true field with a suffix __isComplex for complex arrays. For example, if a field signal is a complex array, a field signal__isComplex = true is added to the JSON message.

This works well for most use cases, and is already implemented in Fjage.jl too. I propose that we add this to the JSON specifications for fjåge and implement it consistently across all gateways. Currently the only affected gateway will be Python (fjagepy).

Tasks:

notthetup commented 2 years ago

Also to update Gateway.md to update the spec to mention this.

Done. https://github.com/org-arl/fjage/commit/8441abe2f7ec48b368cfd00dc4e5efe77df2e60a