Skip to content

Feat: default parameter setup before loop #344

@nulinspiratie

Description

@nulinspiratie

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions