§
    º³Ùg   ã                  ó²   — d 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 ddlmZ  G d„ d	e	j        e¦  «        Z G d
„ de¦  «        Z G d„ de¦  «        ZdS )zQDirectives are hints to the pulse compiler for how to process its input programs.é    )Úannotations)ÚABC)Úchannels)Úinstruction)Ú
PulseError)Údeprecate_pulse_funcc                  ó*   — e Zd ZdZedd„¦   «         ZdS )Ú	DirectivezeA compiler directive.

    This is a hint to the pulse compiler and is not loaded into hardware.
    ÚreturnÚintc                ó   — dS ©zDuration of this instruction.r   © ©Úselfs    úZ/granary/edev/quantum/lib/python3.11/site-packages/qiskit/pulse/instructions/directives.pyÚdurationzDirective.duration   s	   € ð ˆqó    N©r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úpropertyr   r   r   r   r
   r
      s>   € € € € € ðð ð
 ðð ð ñ „Xðð ð r   r
   c                  óZ   ‡ — e Zd ZdZeddœdˆ fd„¦   «         Zedd„¦   «         Zdd„Zˆ xZ	S )ÚRelativeBarrierz$Pulse ``RelativeBarrier`` directive.N)Únamer   úchans.Channelr   ú
str | Nonec               óh   •— t          ¦   «                              t          |¦  «        |¬¦  «         dS )aw  Create a relative barrier directive.

        The barrier directive blocks instructions within the same schedule
        as the barrier on channels contained within this barrier from moving
        through the barrier in time.

        Args:
            channels: The channel that the barrier applies to.
            name: Name of the directive for display purposes.
        ©Úoperandsr   N)ÚsuperÚ__init__Útuple)r   r   r   Ú	__class__s      €r   r$   zRelativeBarrier.__init__'   s.   ø€ õ 	‰Œ×Ò¥%¨¡/¤/¸ÐÑ=Ô=Ð=Ð=Ð=r   r   útuple[chans.Channel, ...]c                ó   — | j         S ©z-Returns the channels that this schedule uses.©r"   r   s    r   r   zRelativeBarrier.channels5   s   € ð Œ}Ðr   ÚotherÚobjectÚboolc                ó�   — t          |t          | ¦  «        ¦  «        o)t          | j        ¦  «        t          |j        ¦  «        k    S )z#Verify two barriers are equivalent.)Ú
isinstanceÚtypeÚsetr   )r   r+   s     r   Ú__eq__zRelativeBarrier.__eq__:   s6   € å˜%¥ d¡¤Ñ,Ô,ÐZµ°T´]Ñ1CÔ1CÅsÈ5Ì>ÑGZÔGZÒ1ZÐZr   )r   r   r   r   )r   r'   )r+   r,   r   r-   )
r   r   r   r   r   r$   r   r   r2   Ú__classcell__©r&   s   @r   r   r   $   s—   ø€ € € € € Ø.Ð.àØDHð >ð >ð >ð >ð >ð >ð >ñ Ôð>ð ðð ð ñ „Xðð[ð [ð [ð [ð [ð [ð [ð [r   r   c                  ó†   ‡ — e Zd ZdZe	 ddˆ fd	„¦   «         Zd
„ Zedd„¦   «         Zedd„¦   «         Z	edd„¦   «         Z
ˆ xZS )ÚTimeBlockadea  Pulse ``TimeBlockade`` directive.

    This instruction is intended to be used internally within the pulse builder,
    to convert :class:`.Schedule` into :class:`.ScheduleBlock`.
    Because :class:`.ScheduleBlock` cannot take an absolute instruction time interval,
    this directive helps the block representation to find the starting time of an instruction.

    Example:

        This schedule plays constant pulse at t0 = 120.

        .. code-block:: python

            from qiskit.pulse import Schedule, Play, Constant, DriveChannel

            schedule = Schedule()
            schedule.insert(120, Play(Constant(10, 0.1), DriveChannel(0)))

        This schedule block is expected to be identical to above at a time of execution.

        .. code-block:: python

            from qiskit.pulse import ScheduleBlock, Play, Constant, DriveChannel
            from qiskit.pulse.instructions import TimeBlockade

            block = ScheduleBlock()
            block.append(TimeBlockade(120, DriveChannel(0)))
            block.append(Play(Constant(10, 0.1), DriveChannel(0)))

        Such conversion may be done by

        .. code-block:: python

            from qiskit.pulse.transforms import block_to_schedule, remove_directives

            schedule = remove_directives(block_to_schedule(block))


    .. note::

        The TimeBlockade instruction behaves almost identically
        to :class:`~qiskit.pulse.instructions.Delay` instruction.
        However, the TimeBlockade is just a compiler directive and must be removed before execution.
        This may be done by :func:`~qiskit.pulse.transforms.remove_directives` transform.
        Once these directives are removed, occupied timeslots are released and
        user can insert another instruction without timing overlap.
    Nr   r   Úchannelr   r   r   c                óR   •— t          ¦   «                              ||f|¬¦  «         dS )zþCreate a time blockade directive.

        Args:
            duration: Length of time of the occupation in terms of dt.
            channel: The channel that will be the occupied.
            name: Name of the time blockade for display purposes.
        r!   N)r#   r$   )r   r   r7   r   r&   s       €r   r$   zTimeBlockade.__init__p   s-   ø€ õ 	‰Œ×Ò 8¨WÐ"5¸DÐÑAÔAÐAÐAÐAr   c                óX   — t          | j        t          ¦  «        st          d¦  «        ‚dS )z›Called after initialization to validate instruction data.

        Raises:
            PulseError: If the input ``duration`` is not integer value.
        zQTimeBlockade duration cannot be parameterized. Specify an integer duration value.N)r/   r   r   r   r   s    r   Ú	_validatezTimeBlockade._validate€   s7   € õ ˜$œ-­Ñ-Ô-ð 	ÝØcñô ð ð	ð 	r   r   c                ó   — | j         d         S )zmReturn the :py:class:`~qiskit.pulse.channels.Channel` that this instruction is
        scheduled on.
        é   r*   r   s    r   r7   zTimeBlockade.channel‹   s   € ð
 Œ}˜QÔÐr   útuple[chans.Channel]c                ó   — | j         fS r)   )r7   r   s    r   r   zTimeBlockade.channels’   s   € ð ”ˆÐr   c                ó   — | j         d         S r   r*   r   s    r   r   zTimeBlockade.duration—   s   € ð Œ}˜QÔÐr   )N)r   r   r7   r   r   r   )r   r   )r   r=   r   )r   r   r   r   r   r$   r:   r   r7   r   r   r3   r4   s   @r   r6   r6   ?   sÕ   ø€ € € € € ð.ð .ð` ð
  ð	Bð Bð Bð Bð Bð Bñ ÔðBð	ð 	ð 	ð ð ð  ð  ñ „Xð ð ðð ð ñ „Xðð ð ð  ð  ñ „Xð ð  ð  ð  ð  r   r6   N)r   Ú
__future__r   Úabcr   Úqiskit.pulser   ÚchansÚqiskit.pulse.instructionsr   Úqiskit.pulse.exceptionsr   Úqiskit.utils.deprecate_pulser   ÚInstructionr
   r   r6   r   r   r   ú<module>rH      s  ðð XÐ WØ "Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ð Ð à *Ð *Ð *Ð *Ð *Ð *Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1Ø .Ð .Ð .Ð .Ð .Ð .Ø =Ð =Ð =Ð =Ð =Ð =ð	ð 	ð 	ð 	ð 	�Ô'¨ñ 	ô 	ð 	ð[ð [ð [ð [ð [�iñ [ô [ð [ð6[ ð [ ð [ ð [ ð [ �9ñ [ ô [ ð [ ð [ ð [ r   