# real_fourier_pwc_signal¶

static OperationNamespace.real_fourier_pwc_signal(duration, segments_count, initial_coefficient_lower_bound=- 1, initial_coefficient_upper_bound=1, fixed_frequencies=None, optimizable_frequencies_count=None, randomized_frequencies_count=None, *, name=None)

Creates a piecewise-constant signal constructed from Fourier components.

Use this function to create a signal defined in terms of Fourier (sine/cosine) basis signals that can be optimized by varying their coefficients and, optionally, their frequencies.

This function supports three different modes: fixed frequencies (you directly provide the frequencies for the basis signals), optimizable frequencies (you provide the number of frequencies, and the frequency values can be tuned by the optimizer), and randomized frequencies (you provide the number of frequencies, and the frequency values are chosen at random at the start of each optimization and then held constant).

Parameters
• duration (float) – The total duration $$\tau$$ of the signal.

• segments_count (int) – The number of segments $$N$$ to use for the piecewise-constant approximation.

• initial_coefficient_lower_bound (float, optional) – The lower bound $$c_\mathrm{min}$$ on the initial coefficient values. Defaults to -1.

• initial_coefficient_upper_bound (float, optional) – The upper bound $$c_\mathrm{max}$$ on the initial coefficient values. Defaults to 1.

• fixed_frequencies (list[float], optional) – The fixed non-zero frequencies $$\{f_m\}$$ to use for the Fourier basis. Must be non-empty if provided. Must be specified in the inverse units of duration (for example if duration is in seconds, these values must be given in Hertz).

• optimizable_frequencies_count (int, optional) – The number of non-zero frequencies $$M$$ to use, if the frequencies can be optimized. Must be greater than zero if provided.

• randomized_frequencies_count (int, optional) – The number of non-zero frequencies $$M$$ to use, if the frequencies are to be randomized but fixed. Must be greater than zero if provided.

• name (str, optional) – The name of the node.

Returns

The optimizable, real-valued, piecewise-constant signal built from the appropriate Fourier components.

Return type

TensorPwc(1D, real)

Notes

This function sets the basis signal frequencies $$\{f_m\}$$ depending on the chosen mode:

• For fixed frequencies, you provide the frequencies directly.

• For optimizable frequencies, you provide the number of frequencies $$M$$, and this function creates $$M$$ unbounded optimizable variables $$\{f_m\}$$, with initial values in the ranges $$\{[(m-1)/\tau, m/\tau]\}$$.

• For randomized frequencies, you provide the number of frequencies $$M$$, and this function creates $$M$$ randomized constants $$\{f_m\}$$ in the ranges $$\{[(m-1)/\tau, m/\tau]\}$$.

After this function creates the $$M$$ frequencies $$\{f_m\}$$, it produces the signal

$\alpha^\prime(t) = v_0 + \sum_{m=1}^M [ v_m \cos(2\pi t f_m) + w_m \sin(2\pi t f_m) ],$

where $$\{v_m,w_m\}$$ are (unbounded) optimizable variables, with initial values bounded by $$c_\mathrm{min}$$ and $$c_\mathrm{max}$$. This function produces the final piecewise-constant signal $$\alpha(t)$$ by sampling $$\alpha^\prime(t)$$ at $$N$$ equally spaced points along the duration $$\tau$$, and using those sampled values as the constant segment values.

You can use the signals created by this function for chopped random basis (CRAB) optimization 1.

References

1

P. Doria, T. Calarco, and S. Montangero, Physical Review Letters 106, 190501 (2011).