ParameterBase converts between a value and its raw value by zipping the value with an iterable scale/offset:
tuple(val * sub_scale for val, sub_scale in zip(raw_value, scale))
in _scale_raw_value, _offset_raw_value, _unoffset_value and _unscale_value in src/qcodes/parameters/parameter_base.py.
Since zip is not strict, a length mismatch is silently truncated. Setting a parameter with scale = [2, 4] to [10, 20, 30] silently drops the third element rather than telling the user that the scale does not match the value.
We should decide whether to use zip(..., strict=True) (or an explicit length check raising a clear ValueError) so that a mismatch is reported instead of silently producing a shorter value. This is a behaviour change for anyone relying on the truncation, so it needs a breaking-change newsfragment.
Follow up from #8449.
ParameterBaseconverts between a value and its raw value by zipping the value with an iterablescale/offset:in
_scale_raw_value,_offset_raw_value,_unoffset_valueand_unscale_valueinsrc/qcodes/parameters/parameter_base.py.Since
zipis not strict, a length mismatch is silently truncated. Setting a parameter withscale = [2, 4]to[10, 20, 30]silently drops the third element rather than telling the user that the scale does not match the value.We should decide whether to use
zip(..., strict=True)(or an explicit length check raising a clearValueError) so that a mismatch is reported instead of silently producing a shorter value. This is a behaviour change for anyone relying on the truncation, so it needs a breaking-change newsfragment.Follow up from #8449.