hann_series_stf
signals.hann_series_stf(coefficients, end_time, start_time=0.0)
Create an Stf representing a sum of Hann window functions.
Parameters
- coefficients (np.ndarray or Tensor) – The coefficients for the different Hann window functions, cn. It must be a 1D array or Tensor.
- end_time (float) – The time at which the Hann series ends, tend.
- start_time (float , optional) – The time at which the Hann series starts, tstart. Defaults to 0.
Returns
The sampleable Hann window functions series.
Return type
SEE ALSO
boulderopal.signals.hann_series
: Create a Signal object representing a sum of Hann window functions.
Graph.signals.hann_series_pwc
: Corresponding operation with Pwc output.
Graph.signals.sinusoid_stf
: Create an Stf representing a sinusoidal oscillation.
Notes
The series is defined as
Hann(t)=n=1∑Ncnsin2(tend−tstartπn(t−tstart)),where N is the number of coefficients.
Note that the function values outside the (tstart,tend) range will not be zero.
Examples
Define a simple sampleable Hann series.
>>> hann = graph.signals.hann_series_stf(
... coefficients=np.array([0.5, 1, 0.25]), end_time=1.0
... )
>>> graph.discretize_stf(hann, duration=1, segment_count=5, name="hann")
<Pwc: name="hann", operation_name="discretize_stf", value_shape=(), batch_shape=()>
>>> result = bo.execute_graph(graph=graph, output_node_names="hann")
>>> result["output"]["hann"]
{'durations': array([0.2, 0.2, 0.2, 0.2, 0.2]),
'values': array([0.5568644 , 1.25563559, 0.75 , 1.25563569, 0.55686415]),
'time_dimension': 0}
Define a sampleable Hann series with optimizable coefficients.
>>> coefficients = graph.optimization_variable(
... count=8, lower_bound=-3.5e6, upper_bound=3.5e6, name="coefficients"
... )
>>> graph.signals.hann_series_stf(coefficients=coefficients, end_time=2.0e-6)
<Stf: operation_name="stf_sum", value_shape=(), batch_shape=()>