
    z	i*                         S r SSKJrJrJr  SSKJrJr   " S S\5      r	 " S S\5      r
 " S S	\5      r " S
 S\5      rS\\\4   4S jrg)a|  
Stylesheet for timeline drawer.

# TODO merge this docstring with pulse drawer.

The stylesheet `QiskitTimelineStyle` is initialized with the hard-corded default values in
`default_style`.

The `QiskitTimelineStyle` is a wrapper class of python dictionary with
the nested keys written such as `<type>.<group>.<item>` to represent a specific item
from many configuration options. This key representation is imitative of
`rcParams` of `matplotlib`.  However, the `QiskitTimelineStyle` does not need to be compatible
with the `rcParams` because the timeline stylesheet is heavily specialized to the context of
the scheduled circuit visualization.

Type of stylesheet is broadly separated into `formatter`, `generator` and `layout`.
The formatter is a nested dictionary of drawing parameters to control the appearance of
each visualization element. This data structure is similar to the `rcParams` of `matplotlib`.

The generator is a list of callback functions that generates drawings from
a given data source and the formatter. Each item can take multiple functions so that
several drawing data, for example, box, text, etc..., are generated from the single data source.
The layout is a callback function that determines the appearance of the output image.
Because a single stylesheet doesn't generate multiple images with different appearance,
only one layout function can be chosen for each stylesheet.
    )DictAnyMapping)
generatorslayoutsc                   ~   ^  \ rS rSrSrU 4S jrS\\\4   SS4U 4S jjr	\
S 5       r\
S	 5       r\
S
 5       rSrU =r$ )QiskitTimelineStyle-   zStylesheet for pulse drawer.c                 b   > [         TU ]  5         S U l        U R                  [	        5       5        g N)super__init__
stylesheetupdatedefault_style)self	__class__s    b/home/james-whalen/.local/lib/python3.13/site-packages/qiskit/visualization/timeline/stylesheet.pyr   QiskitTimelineStyle.__init__0   s#    MO$    _QiskitTimelineStyle__mreturnNc                    > [         TU ]  " U40 UD6  UR                  5        H  u  p4U R                  X45        M     UR                  R
                  U l        g r   )r   r   items__setitem__r   __name__r   )r   r   kwargskeyvaluer   s        r   r   QiskitTimelineStyle.update6   sE    s%f%))+JCS( &--00r   c                     0 nU R                  5        H7  u  p#UR                  S5      nUS   S:X  d  M!  X1SR                  USS 5      '   M9     U$ )z+Return formatter field of style dictionary..r   	formatter   Nr   splitjoinr   sub_dictr   r   sub_keyss        r   r#   QiskitTimelineStyle.formatter<   R     **,JCyy~H{k)38(12,/0 ' r   c                     0 nU R                  5        H7  u  p#UR                  S5      nUS   S:X  d  M!  X1SR                  USS 5      '   M9     U$ )z+Return generator field of style dictionary.r"   r   	generatorr$   Nr%   r(   s        r   r.   QiskitTimelineStyle.generatorF   r,   r   c                     0 nU R                  5        H7  u  p#UR                  S5      nUS   S:X  d  M!  X1SR                  USS 5      '   M9     U$ )z(Return layout field of style dictionary.r"   r   layoutr$   Nr%   r(   s        r   r1   QiskitTimelineStyle.layoutP   sR     **,JCyy~H{h&38(12,/0 ' r   )r   )r   
__module____qualname____firstlineno____doc__r   r   strr   r   propertyr#   r.   r1   __static_attributes____classcell__r   s   @r   r	   r	   -   sc    &%1'#s(+ 1$ 1      r   r	   c                   2   ^  \ rS rSrSrU 4S jrS rSrU =r$ )IQXStandard[   zStandard timeline stylesheet.

- Show time buckets.
- Show only operand name.
- Show bit name.
- Show barriers.
- Show idle timeline.
- Show gate link.
- Remove classical bits.
c                 n  > [         TU ]  5         SSSS[        R                  [        R                  /[        R
                  [        R                  /[        R                  /[        R                  /[        R                  [        R                  S.
nUR                  " S0 UD6  U R                  U5        g )NTF
formatter.control.show_idleformatter.control.show_clbitsformatter.control.show_barriersformatter.control.show_delaysgenerator.gatesgenerator.bitsgenerator.barriersgenerator.gate_linkslayout.bit_arrangelayout.time_axis_map )r   r   r   gen_sched_gategen_short_gate_namegen_bit_namegen_timeslotgen_barriergen_gate_linkr   qreg_creg_ascendingtime_map_in_dtr   r   r   styler   s      r   r   IQXStandard.__init__g   s    +/-2/3-2 * 9 9:;Y;YZ)66
8O8OP#-#9#9":%/%=%=$>")"="=$+$:$:
 	vEr   c                     g)NzStandard timeline style sheet.rK   r   s    r   __repr__IQXStandard.__repr__x   s    /r   rK   	r   r3   r4   r5   r6   r   rY   r9   r:   r;   s   @r   r=   r=   [   s    	"0 0r   r=   c                   2   ^  \ rS rSrSrU 4S jrS rSrU =r$ )	IQXSimple|   zSimple timeline stylesheet.

- Show time buckets.
- Show bit name.
- Show gate link.
- Remove idle timeline.
- Remove classical bits.
c                 P  > [         TU ]  5         SSSS[        R                  /[        R                  [        R
                  /[        R                  /[        R                  /[        R                  [        R                  S.
nUR                  " S0 UD6  U R                  U5        g )NFr@   rK   )r   r   r   rL   rN   rO   rP   rQ   r   rR   rS   r   rT   s      r   r   IQXSimple.__init__   s    +0-2/4-2 * 9 9:)66
8O8OP#-#9#9":%/%=%=$>")"="=$+$:$:
 	vEr   c                     g)Nz Simplified timeline style sheet.rK   rX   s    r   rY   IQXSimple.__repr__   s    1r   rK   r[   r;   s   @r   r]   r]   |   s    "2 2r   r]   c                   2   ^  \ rS rSrSrU 4S jrS rSrU =r$ )IQXDebugging   zTimeline stylesheet for programmers. Show details of instructions.

- Show time buckets.
- Show operand name, qubits, and parameters.
- Show barriers.
- Show delays.
- Show idle timeline.
- Show bit name.
- Show gate link.
c                 n  > [         TU ]  5         SSSS[        R                  [        R                  /[        R
                  [        R                  /[        R                  /[        R                  /[        R                  [        R                  S.
nUR                  " S0 UD6  U R                  U5        g )NTr@   rK   )r   r   r   rL   gen_full_gate_namerN   rO   rP   rQ   r   rR   rS   r   rT   s      r   r   IQXDebugging.__init__   s    +/-1/3-1 * 9 9:;X;XY)66
8O8OP#-#9#9":%/%=%=$>")"="=$+$:$:
 	vEr   c                     g)Nz.Timeline style sheet for timeline programmers.rK   rX   s    r   rY   IQXDebugging.__repr__   s    ?r   rK   r[   r;   s   @r   rd   rd      s    	"@ @r   rd   r   c                  L   0 SS_SS_SS_SS_S	S_S
S_SS_SS_SS_SS_SS_SS_SS_SS_SS_S0 SS_SS_S S_S!S_S"S#_S$S_S%S_S&S#_S'S#_S(S#_S)S*_S+S*_S,S*_S-S*_S.S*_S/S*_S0S*_S*S*S1S1S1S1S1SS2S2S3.
E_S4S1_0 S50 SS6_SS7_S S8_S!S9_S"S:_S&S;_S'S<_S(S=_S)S>_S+S?_S,S@_S-SA_S.SB_S/SC_S0SD_S$SE_S%SF_SGSHSISJSKSLSMSNSOSPS3.
E_SQSR_SSST_SUS_SVSW_SXSY_SZS[_S\S]_S^S]_S_S`_SaSb_ScSd_SeSf_SgSh_SiS_SjS_SkS[_E0 SlS[_SmSY_SnSY_SoSp_SqSp_SrSs_StSu_SvSw_SxSy_SzS{_S|S}_S~S}_SS}_SS}_S/ _S/ _S/ _E/ SSS.E$ )z1Define default values of the timeline stylesheet.zformatter.general.fig_width   z!formatter.general.fig_unit_heightg?zformatter.general.dpi   zformatter.margin.topg      ?zformatter.margin.bottomzformatter.margin.left_percentg{Gz?zformatter.margin.right_percentz&formatter.margin.link_interval_percentg{Gz?z!formatter.margin.minimum_duration2   zformatter.time_bucket.edge_dt
   zformatter.color.backgroundz#FFFFFFzformatter.color.timeslotz#DDDDDDzformatter.color.gate_namez#000000zformatter.color.bit_namezformatter.color.barrierz#222222zformatter.color.gatesu0z#FA74A6u1u2u3idz#05BAB6sxsxdgxyzhz#6FA4FFcxcyczswapssdgz#BB8BFFz#808080)
dcxiswapttdgrrxryrzresetmeasurezformatter.color.default_gatezformatter.latex_symbol.gatesz	{\rm U}_0z	{\rm U}_1z	{\rm U}_2z	{\rm U}_3z{\rm Id}z{\rm X}z{\rm Y}z{\rm Z}z{\rm H}z{\rm CX}z{\rm CY}z{\rm CZ}z
{\rm SWAP}z{\rm S}z{\rm S}^\daggeru
   {\rm √X}u   {\rm √X}^\daggerz	{\rm DCX}z{\rm iSWAP}z{\rm T}z{\rm T}^\daggerz{\rm R}z	{\rm R}_xz	{\rm R}_yz	{\rm R}_zz	|0\ranglez{\rm Measure}z#formatter.latex_symbol.frame_changez\circlearrowleftz%formatter.unicode_symbol.frame_changeu   ↺zformatter.box_height.gatezformatter.box_height.timeslotg333333?zformatter.layer.gate   zformatter.layer.timeslotr   zformatter.layer.gate_name   zformatter.layer.bit_namezformatter.layer.frame_change   zformatter.layer.barrierr$   zformatter.layer.gate_link   zformatter.alpha.gateg      ?zformatter.alpha.timeslotgffffff?zformatter.alpha.barrierzformatter.alpha.gate_linkzformatter.line_width.gatezformatter.line_width.timeslotzformatter.line_width.barrierzformatter.line_width.gate_linkzformatter.line_style.barrier-zformatter.line_style.gate_linkzformatter.text_size.gate_name   zformatter.text_size.bit_name   z formatter.text_size.frame_change   zformatter.text_size.axis_label   z#formatter.label_offset.frame_changeg      ?rA   TrB   rC   rD   rE   rF   rG   N)rH   rI   rJ   rK   rK   r   r   r   r      s   o%ro+So 	 o 		o
 	"3o 	(o 	)$o 	1$o 	,Ro 	(o 	%io 	#Io 	$Yo 	#Io 	"9o  	  "
)"
)"
 )"
 )	"

 )"
 )"
 I"
 "
 "
 "
 "
 )"
 )"
 )"
 I"
  !"
" 9#"
$  7"
!oZ 	'	[o\ 	' )
,)
,)
 ,)
 ,	)

 +)
 )
 )
 )
 )
 +)
 +)
 +)
 M)
 )
 %)
  -!)
" )#)
$  #%!'7)
]oV 	./BWoX 	0YoZ 	$S[o\ 	(]o^ 	_o` 	#Aaob 	$Qcod 	#Aeof 	'goh 	"1ioj 	$Qkol 	mon 	#Coop 	"3qor 	$Ssot 	$Quov 	(wox 	'yoz 	)!{o| 	'}o~ 	)#o@ 	(AoB 	'CoD 	+BEoF 	)"GoH 	.tIoJ 	&tKoL 	(MoN 	*4OoP 	(QoR 	2SoT 	"UoV 	bWoX !#" $]o or   N)r6   typingr   r   r   qiskit.visualization.timeliner   r   dictr	   r=   r]   rd   r7   r   rK   r   r   <module>r      s`   6 & % =+$ +\0$ 0B2 2>@4 @BqtCH~ qr   