Skip to content

Improve parameter scaling / offset - #8451

Merged
Jens Hedegaard Nielsen (jenshnielsen) merged 4 commits into
microsoft:mainfrom
jenshnielsen:parameter_list_testing
Aug 27, 2026
Merged

Improve parameter scaling / offset#8451
Jens Hedegaard Nielsen (jenshnielsen) merged 4 commits into
microsoft:mainfrom
jenshnielsen:parameter_list_testing

Conversation

@jenshnielsen

@jenshnielsen Jens Hedegaard Nielsen (jenshnielsen) commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator
  • Scale Sequence similar to numpy arrays
  • Error if scale/offset length is shorter than data length rather than truncating.

Closes #8450

@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.15%. Comparing base (3f2f690) to head (96a44ef).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8451      +/-   ##
==========================================
+ Coverage   71.14%   71.15%   +0.01%     
==========================================
  Files         305      305              
  Lines       31960    31976      +16     
==========================================
+ Hits        22737    22753      +16     
  Misses       9223     9223              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jenshnielsen Jens Hedegaard Nielsen (jenshnielsen) changed the title Improve parameter scaling Improve parameter scaling / offset Aug 27, 2026
Multiplying a sequence by a number repeats it rather than scaling its
elements, so setting a parameter to a list with a scalar scale silently
set a repeated raw value, and a scalar offset raised a TypeError. The
get path already falls back on element wise arithmetic; do the same on
the set path so that sequences round trip.

See microsoft#8450 for the remaining silent truncation on length mismatch.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e8c5964a-6418-4d35-b69c-bb44dd727a3c
Zipping the value with an iterable scale or offset silently dropped the
extra elements when their lengths differed. Apply the conversions via a
shared helper that zips strictly and reports the two lengths, so that a
mismatch is an error rather than a shorter value.

Closes microsoft#8450

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e8c5964a-6418-4d35-b69c-bb44dd727a3c
Both the scalar scale/offset sequence fix and the scale/offset length
mismatch ValueError are potentially breaking, so combine them into one
breaking newsfragment.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4dac2652-68f4-41a7-8e96-7c8130b845f0
@jenshnielsen
Jens Hedegaard Nielsen (jenshnielsen) marked this pull request as ready for review August 27, 2026 09:15
Comment thread src/qcodes/parameters/parameter_base.py Outdated
Rather than passing an explicit kind argument to _apply_elementwise,
map the arithmetic operator to the name used in the error message.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 08b47f6f-0b50-41ff-842b-ff42bbef4a0f
Merged via the queue into microsoft:main with commit 1ed52b7 Aug 27, 2026
17 checks passed
@jenshnielsen
Jens Hedegaard Nielsen (jenshnielsen) deleted the parameter_list_testing branch August 27, 2026 10:50
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.

Scale/offset silently truncate when their length does not match the value

2 participants