sigmf/SigMF

Validation Error with Complex64

beenjohn opened this issue · 4 comments

When creating a file with:

...
SigMFFile.DATATYPE_KEY: get_data_type_str(data)
...

and running file.validate(), the returned datatype is cf64_le which fails validation as being an unsupported type.

Apologies in advance if this is a user error. I'm new here.

Copy+paste of the file write example in the README should reproduce the issue. Python 3.9 was used for testing.

Hi @beenjohn, cf64_le is not a supported datatype for SigMF at this point. It has been proposed for inclusion (see #196) and will likely be included in the next release.

@jacobagilbert Thanks for the quick response. The issue I had was that, when using complex64 for 32-bit IQ, the get_data_type_str returns cf64_le rather than cf32_le. cf64_le then produced the validation error.

Thanks for the clarification, I now see what you are saying. This is definitely a bug, caused by a difference between how many systems define complex data bit depth and how numpy does.

https://github.com/gnuradio/SigMF/blob/sigmf-v1.x/sigmf/utils.py#L111:

def get_data_type_str(ray):
    """
    Return the SigMF datatype string for the datatype of `ray`.
    """
    ...
    atype = ray.dtype
    ...
    data_type_str += str(atype.itemsize * 8)  # units is bits

The last line returns 64 for "32-bit complex data".

Thanks for the bug report!