2.15. Definition of Measurements

Many pulse templates allow us to declare measurements upon their creation. Each measurement declaration is a tuple that consists of the measurement’s name for later identification, the starting time in the pulse template and the measurement’s length. The idea behind measurement names is that you can put different types of measurements in one pulse and easily distinguish between the results. qupulse automatically configures the acquisition driver to measure at the defined measurement windows.

The following example creates a pulse template that contains two parameterized measurements named ‘M’ and ‘N’:

[1]:
from qupulse.pulses import PointPT

measured_pt = PointPT([(0, 'm'),
                      ('t_meas', 'm')],
                      channel_names=('RF_X', 'RF_Y'),
                      measurements=[('M', 0, 't_meas'), ('N', 0, 't_meas/2')])
print(measured_pt.measurement_names)
print(measured_pt.measurement_declarations)
{'N', 'M'}
[('M', 0, 't_meas'), ('N', 0, 't_meas/2')]

Our pulse template holds a constant voltage level defined by parameter m and has a duration defined by parameters t_meas. The measurement M starts at time 0, i.e. immediately when the pulse itself starts, and has a duration of t_meas, i.e., as long as the pulse itself. The measurement N starts at the same time but only lasts for the half duration of the pulse.

Note that measurement definitions may not exceed the duration of the pulse they are defined in. Doing so will result in an exception being raised during pulse instantiation. Note further that measurements for pulse templates that are empty, e.g. because their length as given by parameters turns out equal to zero, will be discarded during instantiation (without raising an exception).

When using non-atomic/composite pulse templates such as for example SequencePulseTemplate, they will “inherit” all the measurements from the subtemplates they are created with (see Combining PulseTemplates to learn more about composite pulse templates). To avoid name conflicts of measurements from different subtemplates, we can make use of mapping (via MappingPulseTemplate) to rename the measurements, as the example below demonstrates.

[2]:
from qupulse.pulses import SequencePT

my_complicated_pulse = SequencePT((measured_pt, {'M': 'charge_scan'}),
                                  (measured_pt, {'M': 'dbz_fid'}))
print(my_complicated_pulse.measurement_names)
{'dbz_fid', 'N', 'charge_scan'}