§
    º³ÙgÍ  ã                   ó’   — d Z ddlmZmZmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZ  G d„ d	e
¦  «        Z G d
„ de
¦  «        ZdS )a  The phase instructions update the modulation phase of pulses played on a channel.
This includes ``SetPhase`` instructions which lock the modulation to a particular phase
at that moment, and ``ShiftPhase`` instructions which increase the existing phase by a
relative amount.
é    )ÚOptionalÚUnionÚTuple)ÚParameterExpression)ÚPulseChannel)ÚInstruction)Ú
PulseError)Údeprecate_pulse_funcc            	       óò   ‡ — e Zd ZdZe	 ddeeef         dede	e
         fˆ fd„¦   «         Zd„ Zedeeef         fd	„¦   «         Zedefd
„¦   «         Zedee         fd„¦   «         Zedefd„¦   «         Zˆ xZS )Ú
ShiftPhasea³  The shift phase instruction updates the modulation phase of proceeding pulses played on the
    same :py:class:`~qiskit.pulse.channels.Channel`. It is a relative increase in phase determined
    by the ``phase`` operand.

    In particular, a PulseChannel creates pulses of the form

    .. math::
        Re[\exp(i 2\pi f jdt + \phi) d_j].

    The ``ShiftPhase`` instruction causes :math:`\phi` to be increased by the instruction's
    ``phase`` operand. This will affect all pulses following on the same channel.

    The qubit phase is tracked in software, enabling instantaneous, nearly error-free Z-rotations
    by using a ShiftPhase to update the frame tracking the qubit state.
    NÚphaseÚchannelÚnamec                 óR   •— t          ¦   «                              ||f|¬¦  «         dS )a6  Instantiate a shift phase instruction, increasing the output signal phase on ``channel``
        by ``phase`` [radians].

        Args:
            phase: The rotation angle in radians.
            channel: The channel this instruction operates on.
            name: Display name for this instruction.
        ©Úoperandsr   N©ÚsuperÚ__init__©Úselfr   r   r   Ú	__class__s       €úU/granary/edev/quantum/lib/python3.11/site-packages/qiskit/pulse/instructions/phase.pyr   zShiftPhase.__init__,   ó-   ø€ õ 	‰Œ×Ò 5¨'Ð"2¸ÐÑ>Ô>Ð>Ð>Ð>ó    c                 ój   — t          | j        t          ¦  «        st          d| j        › d�¦  «        ‚dS ©z§Called after initialization to validate instruction data.

        Raises:
            PulseError: If the input ``channel`` is not type :class:`PulseChannel`.
        zExpected a pulse channel, got z	 instead.N©Ú
isinstancer   r   r	   ©r   s    r   Ú	_validatezShiftPhase._validate=   óA   € õ ˜$œ,­Ñ5Ô5ð 	WÝÐU¸d¼lÐUÐUÐUÑVÔVÐVð	Wð 	Wr   Úreturnc                 ó   — | j         d         S ©zAReturn the rotation angle enacted by this instruction in radians.r   ©r   r    s    r   r   zShiftPhase.phaseF   ó   € ð Œ}˜QÔÐr   c                 ó   — | j         d         S ©zmReturn the :py:class:`~qiskit.pulse.channels.Channel` that this instruction is
        scheduled on.
        é   r&   r    s    r   r   zShiftPhase.channelK   ó   € ð
 Œ}˜QÔÐr   c                 ó   — | j         fS ©z-Returns the channels that this schedule uses.©r   r    s    r   ÚchannelszShiftPhase.channelsR   ó   € ð ”ˆÐr   c                 ó   — dS ©zDuration of this instruction.r   © r    s    r   ÚdurationzShiftPhase.durationW   ó	   € ð ˆqr   ©N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__r
   r   Úcomplexr   r   r   Ústrr   r!   Úpropertyr   r   r   r/   Úintr4   Ú__classcell__©r   s   @r   r   r      sG  ø€ € € € € ðð ð  ð
 #ð	?ð ?à�WÐ1Ð1Ô2ð?ð ð?ð �sŒmð	?ð ?ð ?ð ?ð ?ñ Ôð?ð Wð Wð Wð ð �u˜WÐ&9Ð9Ô:ð  ð  ð  ñ „Xð ð ð ˜ð  ð  ð  ñ „Xð ð ð˜% Ô-ð ð ð ñ „Xðð ð˜#ð ð ð ñ „Xðð ð ð ð r   r   c            	       óò   ‡ — e Zd ZdZe	 ddeeef         dede	e
         fˆ fd„¦   «         Zd„ Zedeeef         fd	„¦   «         Zedefd
„¦   «         Zedee         fd„¦   «         Zedefd„¦   «         Zˆ xZS )ÚSetPhaseaD  The set phase instruction sets the phase of the proceeding pulses on that channel
    to ``phase`` radians.

    In particular, a PulseChannel creates pulses of the form

    .. math::

        Re[\exp(i 2\pi f jdt + \phi) d_j]

    The ``SetPhase`` instruction sets :math:`\phi` to the instruction's ``phase`` operand.
    Nr   r   r   c                 óR   •— t          ¦   «                              ||f|¬¦  «         dS )a1  Instantiate a set phase instruction, setting the output signal phase on ``channel``
        to ``phase`` [radians].

        Args:
            phase: The rotation angle in radians.
            channel: The channel this instruction operates on.
            name: Display name for this instruction.
        r   Nr   r   s       €r   r   zSetPhase.__init__j   r   r   c                 ój   — t          | j        t          ¦  «        st          d| j        › d�¦  «        ‚dS r   r   r    s    r   r!   zSetPhase._validate{   r"   r   r#   c                 ó   — | j         d         S r%   r&   r    s    r   r   zSetPhase.phase„   r'   r   c                 ó   — | j         d         S r)   r&   r    s    r   r   zSetPhase.channel‰   r+   r   c                 ó   — | j         fS r-   r.   r    s    r   r/   zSetPhase.channels�   r0   r   c                 ó   — dS r2   r3   r    s    r   r4   zSetPhase.duration•   r5   r   r6   r7   rA   s   @r   rC   rC   ]   sG  ø€ € € € € ð
ð 
ð ð
 #ð	?ð ?à�WÐ1Ð1Ô2ð?ð ð?ð �sŒmð	?ð ?ð ?ð ?ð ?ñ Ôð?ð Wð Wð Wð ð �u˜WÐ&9Ð9Ô:ð  ð  ð  ñ „Xð ð ð ˜ð  ð  ð  ñ „Xð ð ð˜% Ô-ð ð ð ñ „Xðð ð˜#ð ð ð ñ „Xðð ð ð ð r   rC   N)r;   Útypingr   r   r   Úqiskit.circuitr   Úqiskit.pulse.channelsr   Ú%qiskit.pulse.instructions.instructionr   Úqiskit.pulse.exceptionsr	   Úqiskit.utils.deprecate_pulser
   r   rC   r3   r   r   ú<module>rP      sè   ððð ð
 *Ð )Ð )Ð )Ð )Ð )Ð )Ð )Ð )Ð )à .Ð .Ð .Ð .Ð .Ð .Ø .Ð .Ð .Ð .Ð .Ð .Ø =Ð =Ð =Ð =Ð =Ð =Ø .Ð .Ð .Ð .Ð .Ð .Ø =Ð =Ð =Ð =Ð =Ð =ð?ð ?ð ?ð ?ð ?�ñ ?ô ?ð ?ðD;ð ;ð ;ð ;ð ;ˆ{ñ ;ô ;ð ;ð ;ð ;r   