Skip to content

ParameterWithSetpoints with DelegateParameter as setpoints #7637

@thangleiter

Description

@thangleiter

The following setup is disallowed by qcodes:

from qcodes.validators import Arrays
from qcodes.parameters import Parameter, ParameterWithSetpoints
from qcodes.dataset import Measurement

p=Parameter('p', vals=Arrays(shape=(10,)), get_cmd=lambda : np.arange(10))
ps1 = ParameterWithSetpoints('ps1', vals=p.vals, setpoints=(p,), get_cmd=lambda : np.linspace(0, 1, 10))
ps2 = ParameterWithSetpoints('ps2', vals=p.vals, setpoints=(ps1,), get_cmd=lambda : np.random.randn(10))

meas = Measurement()
meas.register_parameter(ps2)
# ValueError: Paramspec ps1 both depends on ['p'] and is depended upon by ['ps2'] 
# This was caused while adding these interdependencies {ParamSpecBase('ps1', 'array', 'ps1', ''): (ParamSpecBase('p', 'array', 'p', ''),)}

When instead ps2 has a DelegateParameter as setpoints that points to ps1, the measurement works (but probably shouldn't according to the current logic):

from qcodes.parameters import DelegateParameter
dp = DelegateParameter('dp', source=ps1)
ps2.setpoints = (dp,)

meas = Measurement()
meas.register_parameter(ps2)  # p is just forgotten about here

Finally, I'm wondering if the dual dependency should not indeed be allowed. Take a ParameterWithSetpoints whose setpoints are maybe some voltages that are being ramped. We could want to attach time stamp information to the voltage ramp (maybe the measurement of the ParameterWithSetpoints is not continuous, but only during certain windows of the ramp), the natural way of doing which would be to make the voltage ramp a ParameterWithSetpoints itself, with setpoints given by the time stamps. I.e., ps2 -> measured_data, ps1 -> voltage_ramp, p -> time_axis. Another conceivable option would be to define the time stamps also as setpoints of the measured data parameter (ps2), but this is also illegal (two setpoint params imply a 2d setpoint grid rather than two independent setpoints).

The first question here would be if this is even possible with the current dataset structure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions