qctrlopencontrols.new_walsh_sequence(duration, paley_order, pre_post_rotation=False, name=None)[source]

Creates the Walsh sequence.

  • duration (float) – Total duration of the sequence \(\tau\) (in seconds).

  • paley_order (int) – The paley order \(k\) of the Walsh sequence.

  • pre_post_rotation (bool, optional) – If True, a \(X_{\pi/2}\) rotation is added at the start and end of the sequence. Defaults to False.

  • name (string, optional) – Name of the sequence. Defaults to None.


The Walsh sequence.

Return type



The Walsh sequence is defined by the switching function \(y(t)\) given by a Walsh function. To define the Walsh sequence, we first introduce the Rademacher function 1, which is defined as

\[R_j(x) := {\rm sgn}\left[\sin(2^j \pi x)\right] \;, \quad\; x \in [0, 1]\;, \; j \geq 0 \;.\]

The \(j\)-th Rademacher function \(R_j(x)\) is thus a periodic square wave switching \(2^{j-1}\) times between \(\pm 1\) over the interval \([0, 1]\). The Walsh function of Paley order \(k\) is denoted \({\rm PAL}_k(x)\) and defined as

\[{\rm PAL}_k(x) = \Pi_{j = 1}^m R_j(x)^{b_j} \;, \quad\; x \in [0, 1] \;.\]

where \((b_m, b_{m-1}, \cdots, b_1)\) is the binary representation of \(k\). That is

\[k = b_m 2^{m-1} + b_{m-1}2^{m-2} + \cdots + b_12^0 \;,\]

where \(m = m(k)\) indexes the most significant binary bit of \(k\).

The \(k\)-th order Walsh sequence 2 is then defined by

\[y(t) = {\rm PAL}_k(t / \tau) \;\]

with offset times \(\{t_j / \tau\}\) defined at the switching times of the Walsh function.



H. Rademacher, Math. Ann. 87, 112–138 (1922).


H. Ball and M. J Biercuk, EPJ Quantum Technol. 2, 11 (2015).