# real_fourier_stf_signal

Source: https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/real_fourier_stf_signal

```python
Graph.real_fourier_stf_signal(duration, initial_coefficient_lower_bound=-1, initial_coefficient_upper_bound=1, fixed_frequencies=None, optimizable_frequency_count=None, randomized_frequency_count=None)
```

Create a real sampleable 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 $\tau$ of the signal.
* **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** (*np.ndarray* *or* *None* *,* *optional*) – A 1D array containing the fixed non-zero frequencies $\{f_m\}$
  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.
### Returns
The optimizable, real-valued, sampleable signal built from the
appropriate Fourier components.
### Return type
[Stf](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Stf.md#boulderopal.graph.Stf)

### WARNING
You must provide exactly one of fixed_frequencies, optimizable_frequency_count,
or randomized_frequency_count.

### SEE ALSO
[`Graph.real_fourier_pwc_signal`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/real_fourier_pwc_signal.md#boulderopal.graph.Graph.real_fourier_pwc_signal)
: Corresponding operation for Pwc.

## 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 signal $\alpha(t)$.

You can use the signals created by this function for chopped random basis
(CRAB) optimization <sup>[1](#id2)</sup>.

## References

* <a id='id2'>**[1]**</a> [P. Doria, T. Calarco, and S. Montangero, Phys. Rev. Lett. 106, 190501 (2011).](https://doi.org/10.1103/PhysRevLett.106.190501)
