Skip to content

Check buffer data type in send_waveform#895

Closed
cyclic-pentane wants to merge 1 commit intoEttusResearch:masterfrom
cyclic-pentane:check-buffer-type
Closed

Check buffer data type in send_waveform#895
cyclic-pentane wants to merge 1 commit intoEttusResearch:masterfrom
cyclic-pentane:check-buffer-type

Conversation

@cyclic-pentane
Copy link
Copy Markdown

Pull Request Details

Description

Previously, the function MultiUSRP.send_waveform did not check the data type of the provided buffer, which made the SDR transmit garbage if e.g. np.complex128 buffers were passed. This PR adds in a simple type check.

Related Issue

n/a

Which devices/areas does this affect?

All of them as far as I can tell.

Testing Done

Tried passing a np.complex64 buffer to send_waveform, which still works. Then, I tried passing a np.complex128 one, which makes uhd complain.

Checklist

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project. See CODING.md.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes, and all previous tests pass.
  • I have checked all compat numbers if they need updating (FPGA compat,
    MPM compat, noc_shell, specific RFNoC block, ...)

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 8, 2026

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@cyclic-pentane
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

"""

# Check if waveform_proto has the correct data type
if waveform_proto.dtype != np.complex64:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cyclic-pentane If the user specified a custom streamer, the correct type might be different than fc32 (e.g., it could be sc16). This check is sensible, but it has to pull the correct data type out of the streamer.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...a quick glance at the code didn't immediately give me a good suggestion how to do this, tbh.

@mbr0wn
Copy link
Copy Markdown
Contributor

mbr0wn commented Mar 3, 2026

Until we have a good way of ensuring the user really wanted complex64, I'm going to have to close this. Thanks for the inspiration!

@mbr0wn mbr0wn closed this Mar 3, 2026
@github-actions github-actions bot locked and limited conversation to collaborators Mar 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants