This page was generated from docs/examples/Parameters/Scaled_Parameter.ipynb. Interactive online version: Binder badge.

ScaledParameter

Sometimes the values that we set/get on the computer are not the physical value that reach/originate from the sample. The ScaledParameter can be used to convert quantities with a simple linear relationship without offset.

[1]:
from qcodes import ManualParameter, ScaledParameter
[2]:
dac0 = ManualParameter('dac0', unit = 'V')
dac1 = ManualParameter('dac1', unit = 'V')
amplitude = ManualParameter('amplitude', initial_value=3.14, unit = 'V')

Resistive voltage divider

The simplest case is a resistive divider, where the set voltage is divided by a fixed amount.

[3]:
vd = ScaledParameter(dac0, division = 10)
[4]:
vd(10)
[5]:
print('Vd =',vd(), vd.unit,', real setted value =', dac0(), dac0.unit)
Vd = 10.0 V , real setted value = 100 V

Voltage multiplier

If the voltage is amplified, we can specify a gain value instead of division.

[6]:
vb = ScaledParameter(dac1, gain = 30, name = 'Vb')
[7]:
vb(5)
[8]:
print('Vb =',vd(), vb.unit,', Original_value =', dac1(), dac1.unit)
Vb = 10.0 V , Original_value = 0.16666666666666666 V

Transimpedance amplifier

The ScaledParameter can be used also for quantities that are read, like a current read by a transimpedance amplifier, digitized by a multimeter. We can also specify a different unit from the wrapped parameter. The semantic of gain/division is inverted compared to the previous cases, since it is a value that we read.

[9]:
Id = ScaledParameter(amplitude, division = 1e6, name = 'Id', unit = 'A')
[10]:
print('Id =',Id(), Id.unit,', Read_value =', amplitude(), amplitude.unit)
Id = 3.14e-06 A , Read_value = 3.14 V

The gain can be manually changed at any time

[11]:
Id.division = 1e8
print('Id =',Id(), Id.unit,', Read_value =', amplitude(), amplitude.unit)
Id = 3.14e-08 A , Read_value = 3.14 V

The gain/division can be itself a Qcodes paramter, for example if is a gain set by a remote instrument

[12]:
remote_gain = ManualParameter('remote_gain', initial_value=1e6, unit = 'V/A')
[13]:
Id.division = remote_gain
print('Id =',Id(), Id.unit,', Read_value =', amplitude(), amplitude.unit)
Id = 3.14e-06 A , Read_value = 3.14 V
[14]:
remote_gain(1e8)
print('Id =',Id(), Id.unit,', Read_value =', amplitude(), amplitude.unit)
Id = 3.14e-08 A , Read_value = 3.14 V