real_fourier_pwc_signal
Graph.real_fourier_pwc_signal(duration, segment_count, initial_coefficient_lower_bound=-1, initial_coefficient_upper_bound=1, fixed_frequencies=None, optimizable_frequency_count=None, randomized_frequency_count=None, *, name=None)
Create 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.
Parameters
- duration (float) – The total duration τ of the signal.
- segment_count (int) – The number of segments N to use for the piecewise-constant approximation.
- initial_coefficient_lower_bound (float , optional) – The lower bound cmin on the initial coefficient values. Defaults to -1.
- initial_coefficient_upper_bound (float , optional) – The upper bound cmax on the initial coefficient values. Defaults to 1.
- fixed_frequencies (np.ndarray or None , optional) – A 1D array object containing the fixed non-zero frequencies {fm} to use for the Fourier basis. If provided, must be non-empty and specified in the inverse units of duration (for example if duration is in seconds, these values must be given in Hertz).
- optimizable_frequency_count (int or None , optional) – The number of non-zero frequencies M to use, if the frequencies can be optimized. Defaults to 0.
- randomized_frequency_count (int or None , optional) – The number of non-zero frequencies M to use, if the frequencies are to be randomized but fixed. Defaults to 0.
- name (str or None , optional) – The name of the node.
Returns
The optimizable, real-valued, piecewise-constant signal built from the appropriate Fourier components.
Return type
WARNING
You must provide exactly one of fixed_frequencies, optimizable_frequency_count, or randomized_frequency_count.
SEE ALSO
Graph.real_fourier_stf_signal
: Corresponding operation for Stf.
Notes
This function sets the basis signal frequencies {fm} 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 {fm}, with initial values in the ranges {[(m−1)/τ,m/τ]}.
- For randomized frequencies, you provide the number of frequencies M, and this function creates M randomized constants {fm} in the ranges {[(m−1)/τ,m/τ]}.
After this function creates the M frequencies {fm}, it produces the signal
α′(t)=v0+m=1∑M[vmcos(2πtfm)+wmsin(2πtfm)],where {vm,wm} are (unbounded) optimizable variables, with initial values bounded by cmin and cmax. This function produces the final piecewise-constant signal α(t) by sampling α′(t) at N equally spaced points along the duration τ, 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
Examples
See the “Fourier-basis optimization on a qutrit” example in the How to optimize controls using arbitrary basis functions user guide.