§
    º³Ùgs  ã                   óÜ   — d Z ddlmZmZ ddlZddlmZ ddlm	Z	 dee	j
                 dee	j
                 fd„Zdee	j
                 dee	j
                 fd	„Zd
eeef         de	j        fd„ZdS )aN  
A collection of functions that decide the layout of an output image.
See :py:mod:`~qiskit.visualization.timeline.types` for more info on the required data.

There are 2 types of layout functions in this module.

1. layout.bit_arrange

In this stylesheet entry the input data is a list of `types.Bits` and returns a
sorted list of `types.Bits`.


The function signature of the layout is restricted to:

    ```python

    def my_layout(bits: List[types.Bits]) -> List[types.Bits]:

        # your code here: sort input bits and return list of bits
    ```

2. layout.time_axis_map

In this stylesheet entry the input data is `Tuple[int, int]` that represents horizontal
axis limit of the output image. The layout function returns `types.HorizontalAxis` data
which is consumed by the plotter API to make horizontal axis.

The function signature of the layout is restricted to:

    ```python

    def my_layout(time_window: Tuple[int, int]) -> types.HorizontalAxis:

        # your code here: create and return axis config
    ```

Arbitrary layout function satisfying the above format can be accepted.
é    )ÚListÚTupleN)Úcircuit)ÚtypesÚbitsÚreturnc                 ó4   — d„ | D ¦   «         d„ | D ¦   «         z   S )z¦Sort bits by ascending order.

    Bit order becomes Q0, Q1, ..., Cl0, Cl1, ...

    Args:
        bits: List of bits to sort.

    Returns:
        Sorted bits.
    c                 óF   — g | ]}t          |t          j        ¦  «        ¯|‘ŒS © ©Ú
isinstancer   ÚQubit©Ú.0Úxs     ú[/granary/edev/quantum/lib/python3.11/site-packages/qiskit/visualization/timeline/layouts.pyú
<listcomp>z'qreg_creg_ascending.<locals>.<listcomp>E   s)   € Ð<Ð<Ð<�!�z¨!­W¬]Ñ;Ô;Ð<ˆAÐ<Ð<Ð<ó    c                 óF   — g | ]}t          |t          j        ¦  «        ¯|‘ŒS r   ©r   r   ÚClbitr   s     r   r   z'qreg_creg_ascending.<locals>.<listcomp>E   s@   € ð @ð @ð @Ø�: a­¬Ñ7Ô7ð@Ø	ð@ð @ð @r   r   ©r   s    r   Úqreg_creg_ascendingr   :   s@   € ð =Ð<�tÐ<Ñ<Ô<ð @ð @Øð@ñ @ô @ñ ð r   c                 óX   — d„ | ddd…         D ¦   «         d„ | ddd…         D ¦   «         z   S )z¯Sort bits by descending order.

    Bit order becomes Q_N, Q_N-1, ..., Cl_N, Cl_N-1, ...

    Args:
        bits: List of bits to sort.

    Returns:
        Sorted bits.
    c                 óF   — g | ]}t          |t          j        ¦  «        ¯|‘ŒS r   r   r   s     r   r   z(qreg_creg_descending.<locals>.<listcomp>U   s)   € ÐBÐBÐB�!¥Z°µ7´=Ñ%AÔ%AÐBˆAÐBÐBÐBr   Néÿÿÿÿc                 óF   — g | ]}t          |t          j        ¦  «        ¯|‘ŒS r   r   r   s     r   r   z(qreg_creg_descending.<locals>.<listcomp>U   s@   € ð Fð Fð FØ¥¨A­w¬}Ñ!=Ô!=ðFØ	ðFð Fð Fr   r   r   s    r   Úqreg_creg_descendingr   J   sU   € ð CÐB�t˜D˜D˜b˜D”zÐBÑBÔBð Fð FØ˜˜˜"˜”:ðFñ Fô Fñ ð r   Útime_windowc           	      ó   — | \  }}t          j        t          |d¦  «        |d¦  «        }|                     ¦   «         }d}d„ |D ¦   «         }t	          j        ||ft          t          ||¦  «        ¦  «        |¬¦  «        S )zÚLayout function for the horizontal axis formatting.

    Generate equispaced 6 horizontal axis ticks.

    Args:
        time_window: Left and right edge of this graph.

    Returns:
        Axis formatter object.
    r   é   zSystem cycle time (dt)c                 ó   — g | ]}|d ›‘ŒS )z.0fr   )r   Úvals     r   r   z"time_map_in_dt.<locals>.<listcomp>o   s   € Ð:Ð:Ð:¨˜#�|�|Ð:Ð:Ð:r   )ÚwindowÚaxis_mapÚlabel)ÚnpÚlinspaceÚmaxÚcopyr   ÚHorizontalAxisÚdictÚzip)r   Út0Út1Úaxis_locÚ
axis_labelr&   Úformatted_labels          r   Útime_map_in_dtr3   Z   sˆ   € ð �F€Bˆõ Œ{�3˜r 1™:œ: r¨1Ñ-Ô-€HØ—’‘”€Jð %€Eà:Ð:¨zÐ:Ñ:Ô:€OåÔØ�Bˆx¥$¥s¨8°_Ñ'EÔ'EÑ"FÔ"FÈeðñ ô ð r   )Ú__doc__Útypingr   r   Únumpyr'   Úqiskitr   Úqiskit.visualization.timeliner   ÚBitsr   r   Úintr+   r3   r   r   r   ú<module>r;      sñ   ðð%ð %ðL Ð Ð Ð Ð Ð Ð Ð Ø Ð Ð Ð à Ð Ð Ð Ð Ð Ø /Ð /Ð /Ð /Ð /Ð /ð˜d 5¤:Ô.ð °4¸¼
Ô3Cð ð ð ð ð ˜t E¤JÔ/ð °D¸¼Ô4Dð ð ð ð ð   c¨3 h¤ð °EÔ4Hð ð ð ð ð ð r   