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, cnc_n
  • end_time (float) – The time at which the Hann series ends, tendt_\mathrm{end}
  • start_time (float , optional) – The time at which the Hann series starts, tstartt_\mathrm{start}

Returns

The sampleable Hann window functions series.

Return type

Stf

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=1Ncnsin2(πn(ttstart)tendtstart), \mathop{\mathrm{Hann}}(t) = \sum_{n=1}^N c_n \sin^2 \left( \frac{\pi n (t - t_\mathrm{start})}{t_\mathrm{end} - t_\mathrm{start}} \right) ,

where NN

Note that the function values outside the (tstart,tend)(t_\mathrm{start}, t_\mathrm{end})

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=()>

Was this useful?