Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 13 additions & 18 deletions qctrlopencontrols/driven_controls/predefined.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,9 +726,9 @@ def new_corpse_in_sk1_control(

def new_corpse_in_scrofulous_control(
rabi_rotation: float,
maximum_rabi_rate: float,
azimuthal_angle: float = 0.0,
maximum_rabi_rate: float = 2.0 * np.pi,
**kwargs
name: Optional[str] = None,
) -> DrivenControl:
r"""
Creates a CORPSE concatenated within SCROFULOUS (CORPSE in SCROFULOUS) driven control.
Expand All @@ -741,24 +741,18 @@ def new_corpse_in_scrofulous_control(
rabi_rotation : float
The total Rabi rotation :math:`\theta` to be performed by the driven control. Must be either
:math:`\pi/4`, :math:`\pi/2`, or :math:`\pi`.
maximum_rabi_rate : float, optional
maximum_rabi_rate : float
The maximum Rabi frequency :math:`\Omega_{\rm max}` for the driven control.
Defaults to :math:`2\pi`.
azimuthal_angle : float, optional
The azimuthal angle :math:`\phi` for the rotation. Defaults to 0.
kwargs : dict
Other keywords required to make a :py:obj:`DrivenControl`.
name : str, optional
An optional string to name the control. Defaults to ``None``.

Returns
-------
DrivenControl
The driven control :math:`\{(\delta t_n, \Omega_n, \phi_n, \Delta_n)\}`.

Raises
------
ArgumentsValueError
Raised when an argument is invalid.

See Also
--------
new_corpse_control, new_scrofulous_control
Expand Down Expand Up @@ -825,6 +819,12 @@ def new_corpse_in_scrofulous_control(
rabi_rotation=rabi_rotation, maximum_rabi_rate=maximum_rabi_rate
)

check_arguments(
np.any(np.isclose(rabi_rotation, [np.pi, np.pi / 2, np.pi / 4])),
"rabi_rotation angle must be either pi, pi/2 or pi/4",
{"rabi_rotation": rabi_rotation},
)

# Create a lookup table for rabi rotation and phase angles, taken from
# the Cummins paper. Note: values in the paper are in degrees.
def degrees_to_radians(angle_in_degrees):
Expand All @@ -842,17 +842,12 @@ def degrees_to_radians(angle_in_degrees):
-np.pi * np.cos(theta_1) / 2 / theta_1 / np.sin(rabi_rotation / 2)
)
phi_2 = phi_1 - np.arccos(-np.pi / 2 / theta_1)
elif np.isclose(rabi_rotation, 0.25 * np.pi):
else:
theta_1 = theta_3 = degrees_to_radians(96.7)
phi_1 = phi_3 = np.arccos(
-np.pi * np.cos(theta_1) / 2 / theta_1 / np.sin(rabi_rotation / 2)
)
phi_2 = phi_1 - np.arccos(-np.pi / 2 / theta_1)
else:
raise ArgumentsValueError(
"rabi_rotation angle must be either pi, pi/2 or pi/4",
{"rabi_rotation": rabi_rotation},
)

theta_2 = np.pi

Expand Down Expand Up @@ -885,7 +880,7 @@ def degrees_to_radians(angle_in_degrees):
azimuthal_angles=azimuthal_angles,
detunings=detunings,
durations=durations,
**kwargs,
name=name,
)


Expand Down