sinusoid_pwc
The Boulder Opal Toolkits are currently in beta phase of development. Breaking changes may be introduced.
- sinusoid_pwc(duration, segment_count, amplitude, angular_frequency, phase=0.0, *, name=None)
Create a Pwc representing a sinusoidal oscillation.
- Parameters:
duration (float) – The duration of the signal, \(T\).
segment_count (int) – The number of segments in the PWC.
amplitude (float or complex or Tensor) – The amplitude of the oscillation, \(A\). It must either be a scalar or contain a single element.
angular_frequency (float or Tensor) – The angular frequency of the oscillation, \(\omega\). It must either be a scalar or contain a single element.
phase (float or Tensor, optional) – The phase of the oscillation, \(\phi\). If passed, it must either be a scalar or contain a single element. Defaults to 0.
name (str, optional) – The name of the node.
- Returns:
The sampled sinusoid.
- Return type:
See also
signals.cosine_pulse_pwc()
Create a Pwc representing a cosine pulse.
signals.hann_series_pwc()
Create a Pwc representing a sum of Hann window functions.
signals.sinusoid()
Function to create a Signal object representing a sinusoidal oscillation.
signals.sinusoid_stf()
Corresponding operation with Stf output.
sin()
Calculate the element-wise sine of an object.
Notes
The sinusoid is defined as
\[\mathop{\mathrm{Sinusoid}}(t) = A \sin \left( \omega t + \phi \right) .\]Examples
Define a PWC oscillation.
>>> graph.signals.sinusoid_pwc( ... duration=5.0, ... segment_count=100, ... amplitude=1.0, ... angular_frequency=np.pi, ... phase=np.pi/2.0, ... name="oscillation" ... ) <Pwc: name="oscillation", operation_name="discretize_stf", value_shape=(), batch_shape=()> >>> result = qctrl.functions.calculate_graph(graph=graph, output_node_names=["oscillation"]) >>> result.output["oscillation"] [ {'value': 0.997, 'duration': 0.05}, {'value': 0.972, 'duration': 0.05}, ... {'value': -0.972, 'duration': 0.05}, {'value': -0.996, 'duration': 0.05}, ]
Define a sinusoid with optimizable parameters.
>>> amplitude = graph.optimization_variable( ... count=1, lower_bound=0, upper_bound=4e3, name="amplitude" ... ) >>> angular_frequency = graph.optimization_variable( ... count=1, lower_bound=5e6, upper_bound=20e6, name="angular_frequency" ... ) >>> phase = graph.optimization_variable( ... count=1, ... lower_bound=0, ... upper_bound=2*np.pi, ... is_lower_unbounded=True, ... is_upper_unbounded=True, ... name="phase", ... ) >>> graph.signals.sinusoid_pwc( ... duration=3e-6, ... segment_count=100, ... amplitude=amplitude, ... angular_frequency=angular_frequency, ... phase=phase, ... name="oscillation" ... ) <Pwc: name="oscillation", operation_name="discretize_stf", value_shape=(), batch_shape=()>