hann_series_pwc

signals.hann_series_pwc(duration, segment_count, coefficients, *, name=None)

Create a Pwc representing a sum of Hann window functions.

The piecewise-constant function is sampled from Hann functions that start and end at zero.

Parameters

  • duration (float) – The duration of the signal, TT
  • segment_count (int) – The number of segments in the PWC.
  • coefficients (np.ndarray or Tensor) – The coefficients for the different Hann window functions, cnc_n
  • name (str or None , optional) – The name of the node.

Returns

The sampled Hann window functions series.

Return type

Pwc

SEE ALSO

Graph.signals.cosine_pulse_pwc : Create a Pwc representing a cosine pulse.

Graph.signals.sinusoid_pwc : Create a Pwc representing a sinusoidal oscillation.

boulderopal.signals.hann_series : Create a Signal object representing a sum of Hann window functions.

Graph.signals.hann_series_stf : Corresponding operation with Stf output.

Notes

The series is defined as

Hann(t)=n=1Ncnsin2(πntT), \mathop{\mathrm{Hann}}(t) = \sum_{n=1}^N c_n \sin^2 \left( \frac{\pi n t}{T} \right) ,

where NN

Examples

Define a simple Hann series.

>>> graph.signals.hann_series_pwc(
...     duration=5.0,
...     segment_count=50,
...     coefficients=np.array([0.5, 1, 0.25]),
...     name="hann_series",
... )
<Pwc: name="hann_series", operation_name="pwc_signal", value_shape=(), batch_shape=()>
>>> result = bo.execute_graph(graph=graph, output_node_names="hann_series")
>>> result["output"]["hann_series"]
{
    'durations': array([0.1, 0.1, ..., 0.1, 0.1]),
    'values': array([0.00665006, 0.05899895, ..., 0.05899895, 0.00665006]),
    'time_dimension': 0
}

Define a 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_pwc(
...     duration=2.0e-6,
...     segment_count=128,
...     coefficients=coefficients,
...     name="hann_series",
... )
<Pwc: name="hann_series", operation_name="pwc_signal", value_shape=(), batch_shape=()>

Was this useful?