Skip to main content

GeoSol Research Logo

gri-iqp (IQ Pipeline)

Composable signal-processing primitives to support correlation-based processing of digitally sampled RF signal data ("IQ data"). Includes support for signal extraction (time-slicing, frequency-filtering, and sample-rate decimation) based on time-frequency boxes; Cross Ambiguity Function (CAF) implementations; CAF peak picking, grouping, ambiguity detection, and characterization; and wideband coherent combining of chunk-CAFs.

Written to run unchanged on CPU (numpy/scipy) or NVIDIA GPU (CuPy), dispatching on the array module applicable to where the data presides (see Status for what is tested). Primitives are designed to be used in a pipeline by your application such that the input data and intermediate data products (such as a time- sliced and decimated IQ stream, or a CAF surface) remains in memory on either the CPU (host) or GPU (device) with minimal host/device data transfers. The nearly-equivalent behavior on CPU and GPU (via cupy) enables development and testing on CPU-only machines while GPU is only required for performance testing.

MIT licensed.

Status

Alpha, pre-1.0. The CPU path is implemented and tested; the API may still change between releases. GPU code paths are written against the same backend dispatch but are not yet exercised in CI on CUDA hardware.

Install

pip install gri-iqp
# or, with CUDA GPU support:
pip install "gri-iqp[gpu]"

Requires Python >= 3.12.

Quick Start

Estimate TDOA between two sensors that saw the same emitter:

>>> import numpy as np
>>> from gri_nsepoch import Time
>>> from gri_iqp import CafSearchRange, Stream, caf_estimate

>>> fs_hz, fc_hz = 2e6, 1.2e9
>>> epoch = Time(s=1_700_000_000.0)
>>> rng = np.random.default_rng(0)

>>> # Stand-in for two real captures: the primary sees the emitter 12 us LATER
>>> # than the secondary, so tdoa = t_primary - t_secondary = +12 us. Each
>>> # receiver adds independent noise, as strong as the emitter.
>>> n, shift = 4096, 24
>>> emitter = rng.standard_normal(n + 64) + 1j * rng.standard_normal(n + 64)
>>> def receive(iq):
...     return iq + rng.standard_normal(n) + 1j * rng.standard_normal(n)
>>> primary_iq = receive(emitter[:n])
>>> secondary_iq = receive(emitter[shift : shift + n])

>>> def sensor(iq):
...     return Stream(
...         data=iq,
...         start_time=epoch,
...         fs=fs_hz,
...         fc=fc_hz,
...         f_min=fc_hz - 0.8e6,
...         f_max=fc_hz + 0.8e6,
...         phase_epoch=epoch,
...     )

>>> estimate = caf_estimate(
...     sensor(primary_iq),
...     sensor(secondary_iq),
...     CafSearchRange(tau_range=(-40e-6, 40e-6), tau_dot_range=(-5e-7, 5e-7)),
...     snr_threshold=100.0,
... )
>>> for group in estimate.detections:
...     peak = max(group.points, key=lambda p: p.snr)
...     lo, hi = peak.confidence_range(0.95).tau_range
...     print(f"tdoa {peak.tdoa * 1e6:.3f} us  (95%: {lo * 1e6:.3f}..{hi * 1e6:.3f})")
...     print(f"  snr {peak.snr:.0f}, points in this ambiguity group: {len(group.points)}")
tdoa 11.994 us  (95%: 11.975..12.012)
  snr 961, points in this ambiguity group: 1

caf_estimate is the top-level entry point: it checks whether the requested delay-rate range is narrowband enough for a plain CAF, pre-compensates by resampling when only the range ends fail, and raises with a pointer to the wideband path when even the midpoint does. Its result carries the detections, the search range that produced them, and the largest delay acceleration under which its linear-delay model holds.

Conventions

The following conventions are adopted by gri-iqp:

  • The two sensors are primary and secondary, and they do not enter symmetrically: the primary supplies the independent time-of-measurement variable: the time of arrival (TOA) at the primary sensor.
  • Both differences are primary minus secondary:
    • tdoa = t_primary - t_secondary,
    • fdoa = f_primary - f_secondary, and
    • tdoadot = -fdoa / f_secondary. The denominator is the frequency received at the secondary.
  • Surfaces carry a tdoadot axis rather than fdoa, because TDOA-Dot is carrier-independent, comparable across bands, and the geo-observable.
  • CafSurface.value is volts-like squared, but value_db is 20*log10(abs(value)), so a peak's height above the noise floor in dB is its SNR in dB (snr is the power ratio abs(value)**2 / noise_power).

What's Here

Piece What it does
Stream, StreamBatch, ExtractBox Sampled IQ plus metadata; slice/tune/filter/decimate (extract, extract_batch), resample (dilate). Single- or multi-channel, samples on the last axis. combined_residual_phase relates an extracted pair's deferred tune phases.
tune_filter_decimate, design_lowpass_taps The array-level form of extraction: tune, anti-alias filter and decimate in one polyphase step, returning the tune frequency actually realized.
caf_estimate The top-level measurement: checks the delay-rate range is narrowband enough, runs caf and find_caf_peaks, and groups the results; returns a CafEstimate.
caf Stream-aware CAF: two Streams + a CafSearchRange -> CafSurface, owning all unit conversion.
caf_batch, align_stream_batches The same for many chunks in one engine call: two row-paired StreamBatches (e.g. pulses from extract_batch) -> one CafSurface per row.
gri_iqp.caf_engines Three pure-array CAF engines: caf_direct (reference), caf_time_domain (Stein's), caf_freq_domain, each batching over any leading dimensions. caf_bytes_required sizes a call's peak memory before you commit to it.
find_caf_peaks, find_caf_peaks_batch Detects peaks on a surface and characterizes each: sub-cell location, fitted magnitude, curvature hessian, snr, and a PeakQuality flag. The batch form handles a list of same-shaped surfaces in one pass.
CafPoint.covariance / .confidence_range Curvature + SNR -> covariance -> a search range for the next stage ("range in, estimate out").
select_ambiguity_groups Groups grating-lobe replicas into AmbiguityGroups by detecting regular lattices along each axis.
cluster_caf_points, CrossChunkGroup Associates chunk peaks that lie on one (tdoa, tdoadot) trajectory, with a chi-square gate; a group's fused estimate gives confidence_range(level, at=...) for sizing an IWCAF search.
iwcaf_refine, recenter_to_centroid, recenter_to_centroid_batch Interferometric wideband CAF: coherently combines many chunk peaks into one aperture-level surface, resolving far finer than any single chunk.
iwcaf_phase_fit, IwcafFit Locates the IWCAF peak from the chunk phases directly, by weighted least squares rather than a grid, and fuses each chunk's (tdoa, tdoadot) measurement, which supplies any axis the aperture cannot resolve.
sic_components, SicComponent, reconstruct_composite, effective_beam_covariance Successive interference cancellation: attributes chunks to overlapping emitters with soft per-chunk weights.
gri_iqp.peak_detect Generic surface primitives: noise_floor, noise_floors, detect_peaks, extract_patches.
gri_iqp.gaussian_fusion Gaussian gate and fuse primitives (host-side): match_statistic, fuse, and their N-D forms match_statistic_nd, fuse_nd, generalized_variance.
gri_iqp.scalar_grouping Scalar clustering and lattice detection (host-side): cluster_1d, find_ladder.
gri_iqp.backend numpy/CuPy dispatch: get_array_module, get_signal_module, asarray, to_cpu, Device.

resample_poly and stft deliberately have no wrapper; call scipy.signal/cupyx.scipy.signal directly via backend.get_signal_module.

Not Yet Implemented

These exist as documented stubs and raise NotImplementedError:

  • gri_iqp.channelize.channelize: polyphase channelizer (designed, not scheduled; extract_batch covers non-uniform band placement today).
  • Stream.pairer: combinatorial primary/secondary pair filtering.

iwcaf_search (the detection-regime IWCAF, as opposed to iwcaf_refine's refinement regime) is designed but deliberately deferred.

CPU/GPU

Primitives infer their array module from their inputs, so a pipeline's intermediate data stays on one device end to end. Placement is explicit only at the boundaries:

from gri_iqp.backend import Device, asarray, to_cpu

gpu_iq = asarray(host_iq, device=Device.GPU)   # on the way in
result = to_cpu(surface.value)                 # on the way out

Operands must be co-located: CuPy raises on an operation that mixes a numpy and a CuPy array rather than copying silently (not yet exercised here, since CI has no GPU). The caller sets a memory budget (max_bytes) and the FFT engines split their work to stay under it; caf_bytes_required makes a call's peak footprint knowable in advance.

Documentation

The wheel ships its documentation inside the package, in gri_iqp/docs/, so it is available wherever the package is installed: overview.md (the sign conventions, an end-to-end measurement, a map of the pieces), a generated api_summary.md of every public signature, and the design references listed below except the notebook. Print the directory with python -c "import gri_iqp, pathlib; print(pathlib.Path(gri_iqp.__file__).parent / 'docs')". Every example in overview.md, the docstrings and this README's Quick Start is run by the test suite.

In the GitLab repository:

  • notebooks/tutorial.ipynb: an end-to-end tour of the pipeline on synthetic data with known truth: streams and the phase-epoch convention, CAF surfaces, peak uncertainty and the coarse-to-fine handoff, sign conventions, ambiguity groups, extraction and batching, IWCAF, SIC attribution of overlapping emitters, and CPU/GPU placement. Start here.
  • design.md: the architecture document, and the authority on what the implementation does and why.
  • glossary.md: what each domain term (chunk, aperture, tau vs. tdoa, the search range and its epoch, the SIC vocabulary, and more) means as this library uses it.
  • caf_variants.md: comparison table and signatures for the three CAF engines, and how they batch.
  • chunk_phase_reference.md: why a chunk's time/frequency origin is a free choice, and why the energy centroid is the right place to put it.
  • noise_estimator.md: bias/variance of the quantile noise-floor estimator.

Contributing

uv sync
uv run pytest --cov
uv run pre-commit run --all-files --hook-stage pre-push

uv sync also wires up the git hooks, so there is no separate pre-commit install step.

See CONTRIBUTING.md for the full setup, code style, and the project-specific conventions (the design document is binding, and the sign/phase conventions are easy to get silently wrong).

License

MIT. See LICENSE.

Metadata

Release files for gri-iqp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gri-iqp 0.1.0
File Size Uploaded Provenance Actions
gri_iqp-0.1.0.tar.gz 332.0 kB Without provenance Details for gri_iqp-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gri-iqp 0.1.0
File Interpreter ABI Platform Actions
gri_iqp-0.1.0-py3-none-any.whl Python 3 none any Details for gri_iqp-0.1.0-py3-none-any.whl

Total release size: 549.9 kB

Release files / gri_iqp-0.1.0.tar.gz

Download URL gri_iqp-0.1.0.tar.gz
Size 332.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2293c1703c09b4ab91a404dca0646e5651c5f68e12b8d46c9745f7101895b879
BLAKE2b-256 checksum
How to use checksums
f7daf6aa4243f4c0cac5623662467423c03420a05886e89a1f7f7c66f743db60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / gri_iqp-0.1.0-py3-none-any.whl

Download URL gri_iqp-0.1.0-py3-none-any.whl
Size 217.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
953140b28b170f175ae8abe095cc99ffce81d93b2ce0907725cf65794fbf63d1
BLAKE2b-256 checksum
How to use checksums
e69b8631e17de7a04b99c2c8fcb950a56becb614a7b977c6c9803d60b8b5951b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for gri-iqp 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page