From a435e0362424b5ec672386109887a13a544d83df Mon Sep 17 00:00:00 2001 From: Li Li Date: Wed, 16 Dec 2020 16:08:36 +1100 Subject: [PATCH] remove default value --- .../driven_controls/predefined.py | 31 ++++++++----------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/qctrlopencontrols/driven_controls/predefined.py b/qctrlopencontrols/driven_controls/predefined.py index e2ab0657..3ba518df 100644 --- a/qctrlopencontrols/driven_controls/predefined.py +++ b/qctrlopencontrols/driven_controls/predefined.py @@ -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. @@ -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 @@ -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): @@ -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 @@ -885,7 +880,7 @@ def degrees_to_radians(angle_in_degrees): azimuthal_angles=azimuthal_angles, detunings=detunings, durations=durations, - **kwargs, + name=name, )