2.13. Reversing a Pulse TemplateΒΆ

The TimeReversalPulseTemplate allows to reverse arbitrary pulse templates. Let us start with a pulse that has a clear time ordering.

[1]:
from qupulse.pulses import TimeReversalPT, FunctionPT, TablePT, plotting

forward_1 = FunctionPT('sin(2*pi*t / 10)', duration_expression='10', channel='A')
wait = TablePT({'A': [(0, 0), (3, 0)]}, measurements=[('M', 0.5, 1)])
forward_2 = FunctionPT('sin(2*pi*t / 5)', duration_expression='5', channel='A')

forward_all = forward_1 @ wait @ forward_2

_ = plotting.plot(forward_all, plot_measurements={'M'}, show=False)
../_images/examples_00TimeReversal_1_0.png

We can now easily create the same pulse backward

[2]:
backward_all = TimeReversalPT(forward_all)
_ = plotting.plot(backward_all, plot_measurements={'M'}, show=False)
../_images/examples_00TimeReversal_3_0.png

and use it in a composed template.

[3]:
intermediate = TablePT({'A': [(0, 0), (1, 0)]}, measurements=[('N', 0, 1)])
composed = forward_all @ intermediate @ backward_all
_ = plotting.plot(composed, plot_measurements={'M', 'N'}, show=False)
../_images/examples_00TimeReversal_5_0.png