Skip to content

Add SAR backprojection example using real data#1158

Merged
tbensonatl merged 9 commits intomainfrom
add-sarbp-real-data-example
Apr 22, 2026
Merged

Add SAR backprojection example using real data#1158
tbensonatl merged 9 commits intomainfrom
add-sarbp-real-data-example

Conversation

@tbensonatl
Copy link
Copy Markdown
Collaborator

Add an example using the sar_bp and other MatX operators to reconstruct a real data set. Several commercial spaceborne SAR companies provide data sets with permissive licensing. This example includes supporting scripts and code to read and process one such data set. See the example README.md file for detailed instructions.

This example will download and install additional third-party open-source software projects and data sets. Review the license terms of these open-source projects and data sets before use.

Signed-off-by: Thomas Benson <tbenson@nvidia.com>
Signed-off-by: Thomas Benson <tbenson@nvidia.com>
Signed-off-by: Thomas Benson <tbenson@nvidia.com>
Signed-off-by: Thomas Benson <tbenson@nvidia.com>
@tbensonatl tbensonatl self-assigned this Apr 19, 2026
@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented Apr 19, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 19, 2026

Greptile Summary

This PR adds a complete end-to-end SAR backprojection example using real spaceborne CPHD data: a Python preprocessing script (cphd_to_sarbp_input.py) that converts CPHD to a self-contained .sarbp binary, a CUDA driver (sarbp.cu) that performs GPU backprojection via the MatX sar_bp operator, and a visualisation helper (view_sarbp_image.py). All previously flagged P0/P1 issues (stack overflow on oversized pulse headers, bad fallback header size, byteswap correctness, TOA intersection edge case, vel_enu trimming) have been addressed in follow-up commits.

Confidence Score: 5/5

Safe to merge; all prior P0/P1 concerns are resolved and only minor P2 observations remain.

Every critical issue raised in previous review rounds (stack overflow, bad fallback size, byteswap correctness, TOA intersection, vel_enu post-trim mismatch) has been addressed. The two remaining comments are P2 quality-of-life items (silent write-error and an unvectorised Python loop) that do not affect correctness or security.

No files require special attention; sarbp.cu output-write error handling is a minor hardening opportunity.

Important Files Changed

Filename Overview
examples/sarbp/sarbp.cu Main CUDA backprojection driver; previous P0 (stack overflow, bad fallback size) and P1 (warmup semantics) issues resolved; output-write error check missing (P2).
examples/sarbp/cphd_to_sarbp_input.py CPHD → .sarbp conversion script; previously flagged issues (byteswap, TOA intersection, vel_enu trimming) all resolved; Doppler mask construction is an unvectorised Python loop (P2).
examples/sarbp/view_sarbp_image.py Visualisation helper; reads .sarbp header for dimensions, handles square-image fallback, and gracefully selects an interactive matplotlib backend. No issues found.
examples/CMakeLists.txt Adds sarbp executable target and a post-build rule to copy the two Python helper scripts beside the binary. Straightforward and correct.
examples/sarbp/requirements.txt Pinned dependency list for sarpy, matplotlib, numpy, scipy etc. Versions look reasonable; pinning aids reproducibility.
examples/sarbp/README.md Clear step-by-step instructions covering data download, Python venv setup, conversion, build, GPU execution and visualisation. No issues.

Sequence Diagram

sequenceDiagram
    participant User
    participant Python as cphd_to_sarbp_input.py
    participant CPHD as CPHD File (sarpy)
    participant SARBP as .sarbp File
    participant CUDA as sarbp.cu (GPU)
    participant RAW as .raw Output

    User->>Python: run with .cphd path
    Python->>CPHD: open_phase_history() + read_pvp_array()
    CPHD-->>Python: metadata, PVP, signal data
    Python->>Python: aperture trim, ENU conversion, resolution auto-sizing
    Python->>SARBP: write header + per-pulse records (int16 or complex64)
    User->>CUDA: run sarbp executable
    CUDA->>SARBP: read 256-byte file header
    CUDA->>SARBP: stream per-pulse headers + samples
    CUDA->>CUDA: ifft-shift + zero-pad + IFFT/FFT (range compression)
    CUDA->>CUDA: sar_bp accumulate blocks → image tensor
    CUDA->>RAW: write complex float image
    User->>Python: view_sarbp_image.py output.raw
Loading

Reviews (6): Last reviewed commit: "Fix viewer orientation; update example S..." | Re-trigger Greptile

Comment thread examples/sarbp/sarbp.cu Outdated
Comment thread examples/sarbp/sarbp.cu
Comment thread examples/sarbp/cphd_to_sarbp_input.py
Comment thread examples/sarbp/cphd_to_sarbp_input.py
Signed-off-by: Thomas Benson <tbenson@nvidia.com>
Comment thread examples/sarbp/cphd_to_sarbp_input.py
@tbensonatl
Copy link
Copy Markdown
Collaborator Author

/build

@tbensonatl tbensonatl requested a review from cliffburdick April 19, 2026 21:29
@coveralls
Copy link
Copy Markdown

coveralls commented Apr 20, 2026

Coverage Status

Coverage is 91.805%add-sarbp-real-data-example into main. No base build found for main.

Comment thread examples/sarbp/README.md Outdated
Comment thread examples/sarbp/sarbp.cu
Comment thread examples/sarbp/sarbp.cu Outdated
Signed-off-by: Thomas Benson <tbenson@nvidia.com>
@tbensonatl
Copy link
Copy Markdown
Collaborator Author

/build

Signed-off-by: Thomas Benson <tbenson@nvidia.com>
Comment thread examples/sarbp/sarbp.cu
Signed-off-by: Thomas Benson <tbenson@nvidia.com>
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 21, 2026

Want your agent to iterate on Greptile's feedback? Try greploops.

@tbensonatl
Copy link
Copy Markdown
Collaborator Author

/build

Signed-off-by: Thomas Benson <tbenson@nvidia.com>
@tbensonatl
Copy link
Copy Markdown
Collaborator Author

/build

@tbensonatl tbensonatl merged commit ddfecba into main Apr 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants