microsoft / microsoft/Qcodes

Snapshot of ScaledParameter doesn't update when wrapped parameter is set

Open
#2,631 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
459
Forks
359
Avg merge
3d 6h
Merged PRs (30d)
73

Description

Steps to reproduce
  1. Create ScaledParameter
  2. Change value of wrapped parameter
  3. Take snapshot of ScaledParameter. => It contains the old value
Expected behaviour

It is expected that also the snapshot of the ScaledParameter reflects the latest value of the wrapped behavior.

Actual behaviour

Snapshot of ScaledParameter is not updated.

System

Windows
qcodes release 0.21

Example to reproduce:

import qcodes as qc
from qcodes.tests.instrument_mocks import DummyInstrument
from pprint import pprint

iv_converter = DummyInstrument('iv_converter', gates=('adc1',))

current1 = qc.ScaledParameter(output=iv_converter.adc1, gain=1/1e6, name='current1', unit='A')

# This works fine
current1(4e-6)
pprint(current1.snapshot()) # this snapshot is correct

# Set adc1 to 3
iv_converter.adc1(3)
pprint(current1.snapshot()) # this snapshot  "value" is not correct (old value)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ScaledParameter, its snapshot() method, and the wrapped DummyInstrument adc1 parameter shown in the reproduction. Reproduce the sequence of setting current1, changing adc1, and taking another snapshot; done means the second ScaledParameter snapshot reflects the wrapped parameter's latest value.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.