microsoft / microsoft/Qcodes

Feat: default parameter setup before loop

Open
#344 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Lately I've been having more and more often that parameters need to be setup first before they can be used in a loop. This is closely related to the functionality proposed in #274, but is in this case specifically related to parameters.

One example is when acquiring traces using an acquisition controller, the trace output array depends on properties such as the sampling rate and the acquisition time. The metadata of the parameter therefore needs to be set before starting a loop, otherwise it will not match the expected shape of the output array.
This is quite a simple example, and setup actions can be quite more complex, involving configuration of instruments.

My current solution is adding a parameter.setup() function for each parameter, and call them before starting the loop. However, since this setup seems such a common necessity, I was wondering if it would make sense to implement setup() as a default method in the Parameter class, which could then be overwritten. This function would then be called every time a Loop is started, before the actual loop. By having it automated, such that the Loop runs parameter.setup() for every parameter that is swept and detected, one wouldn't have to worry about manually performing a setup.

I think it would be a useful feature, and would make it less likely for people to forget to setup each parameter needed for a measurement.

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 by locating the Parameter and Loop implementations and review the related proposal in #274. Determine how swept and detected parameters are identified and where a loop starts; done should establish and verify a default setup hook that runs before the loop.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.