qcheff.utils.pulses¶
Module Contents¶
Classes¶
Defines a control pulse. |
|
Pulse in the modulated Fourier basis. This creates a Pulse with the basis functions given in the Fourier basis. |
Functions¶
Compute a cosine ramp function. |
API¶
- cos_ramp(t, a=0.2)¶
Compute a cosine ramp function.
Parameters
t : array_like Time array. a : float, optional Ramp ratio. Default is 0.2.
Returns
array_like Cosine ramp function values.
- class ControlPulse¶
Defines a control pulse.
Contains an envelope in the form of PulseEnvelope or a derived class, carrier frequency and phase. The amplitude is assumed to be 1 if unspecified.
The carrier is assumed to be a cosine wave.
basis_funcs and ramp_func are defined so that the gate is active between t=0 and t=1. It is also assumed that they are all vectorized functions.
Parameters
coeffs : list of float Coefficients for the basis functions. basis_funcs : list of Callable[[float], float] Basis functions. frequency : float, optional Carrier frequency. Default is 1. phase : float, optional Phase of the pulse. Default is 0. amplitude : float, optional Amplitude of the pulse. Default is 1. name : str or None, optional Name of the pulse. Default is None.
Raises
ValueError If the lengths of coeffs and basis_funcs are not the same.
- coeffs: list[float]¶
None
- basis_funcs: list[collections.abc.Callable[[float], float]]¶
None
- frequency: float¶
1.0
- phase: float¶
0.0
- amplitude: float¶
1.0
- name: dataclasses.InitVar[str | None]¶
None
- envelope(tlist)¶
Generates a pulse array given a timelist.
Parameters
tlist : array_like List of time points.
Returns
array_like Pulse array.
- class FourierPulse(coeffs, gate_time, ramp_ratio=0.2, backend='cpu', **kwargs)¶
Bases:
qcheff.utils.pulses.ControlPulsePulse in the modulated Fourier basis. This creates a Pulse with the basis functions given in the Fourier basis.
The basis functions are:
s(t/T) * cos(pi * n* t / gate_time) for even n s(t/T) * sin(pi * n* t / gate_time) for odd n
and s(t/T) is the ramp function.
where n is the index of the basis function. n starts from 1.
Parameters
coeffs : list of float List of coefficients. gate_time : float Total time of Pulse. Used to scale the basis functions. ramp_ratio : float, optional Ratio of the ramp time to the total time. Default is 0.2. backend : str, optional “cpu” or “gpu”. Default is “cpu”. **kwargs : dict Additional keyword arguments to pass to ControlPulse.
Initialization
Initializes a FourierPulse object.
Parameters
coeffs : list of float List of coefficients. gate_time : float Total time of Pulse. Used to scale the basis functions. ramp_ratio : float, optional Ratio of the ramp time to the total time. Default is 0.2. backend : str, optional “cpu” or “gpu”. Default is “cpu”. **kwargs : dict Additional keyword arguments to pass to ControlPulse.
- envelope(tlist)¶
Generates a pulse array given a timelist.
Parameters
tlist : array_like List of time points.
Returns
array_like Pulse array.