Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Collapse a uniform per-transmit bandwidth to a scalar
  • Loading branch information
tristan-deep committed Sep 29, 2026
commit 3af0f66a6f8c989a8046aa95fe28c8916347f644
11 changes: 11 additions & 0 deletions tests/test_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,17 @@ def test_bandwidth_explicit_value_wins():
assert parameters.bandwidth == pytest.approx(4.2e6)


def test_bandwidth_per_transmit_center_frequency():
"""A per-transmit center_frequency that is the same everywhere gives a scalar bandwidth."""
uniform = Parameters(center_frequency=np.full(3, 5e6), probe_bandwidth_percent=60.0)
assert np.ndim(uniform.bandwidth) == 0
assert uniform.bandwidth == pytest.approx(3e6)

# Varying per transmit: the derived bandwidth stays per transmit.
varying = Parameters(center_frequency=np.array([4e6, 5e6]), probe_bandwidth_percent=50.0)
np.testing.assert_allclose(varying.bandwidth, [2e6, 2.5e6])


# --- distance_to_apex ---


Expand Down
12 changes: 11 additions & 1 deletion zea/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -859,11 +859,21 @@ def bandwidth(self):
``probe_bandwidth_percent``, its 200 % default makes this ``2 * center_frequency``,
Comment thread
tristan-deep marked this conversation as resolved.
Resolved
which may be too wide for these filters. Set ``bandwidth`` (or
``probe_bandwidth_percent``) explicitly in that case.

The filter operations design one set of taps, so they need a scalar. A per-transmit
``center_frequency`` that is the same for every transmit gives a scalar bandwidth; when
it varies across transmits, the derived bandwidth is per transmit as well, and
``bandwidth`` should be set explicitly for these filters.
"""
if self._params.get("bandwidth") is not None:
return self._params["bandwidth"]

return self.center_frequency * self.probe_bandwidth_percent / 100
bandwidth = self.center_frequency * self.probe_bandwidth_percent / 100
if np.ndim(bandwidth) > 0:
per_transmit = np.asarray(bandwidth)
if per_transmit.size > 0 and np.all(per_transmit == per_transmit.flat[0]):
return per_transmit.flat[0]
return bandwidth
Comment thread
tristan-deep marked this conversation as resolved.
Resolved

@cache_with_dependencies("selected_transmits")
def polar_angles(self):
Expand Down
Loading