[ell] validate spacing length

This commit is contained in:
Jan Petykiewicz 2026-04-01 21:58:56 -07:00
commit 20f37ea0f7
2 changed files with 28 additions and 1 deletions

View file

@ -132,8 +132,17 @@ def ell(
if spacing is None:
ch_offsets = numpy.zeros_like(y_order)
else:
spacing_arr = numpy.asarray(spacing, dtype=float).reshape(-1)
steps = numpy.zeros_like(y_order)
steps[1:] = spacing
if spacing_arr.size == 1:
steps[1:] = spacing_arr[0]
elif spacing_arr.size == len(ports) - 1:
steps[1:] = spacing_arr
else:
raise BuildError(
f'spacing must be scalar or have length {len(ports) - 1} for {len(ports)} ports; '
f'got length {spacing_arr.size}'
)
ch_offsets = numpy.cumsum(steps)[y_ind]
x_start = rot_offsets[:, 0]