WrightTools.diagrams.WMEL module

WMEL diagrams.

class WrightTools.diagrams.WMEL.Artist(size, energies, state_names=None, number_of_interactions=4, virtual=[None], state_font_size=8, state_text_buffer=0.5)[source]

Bases: object

Dedicated WMEL figure artist.

__init__(size, energies, state_names=None, number_of_interactions=4, virtual=[None], state_font_size=8, state_text_buffer=0.5)[source]

Initialize.

Parameters:
  • size ([columns, rows]) – Layout.

  • energies (list of numbers) – State energies.

  • state_names (list of strings (optional)) – State names. Default is None.

  • number_of_interactions (integer (optional)) – Number of interactions. Default is 4.

  • virtual (list of integers (optional)) – Indices of states which are virtual. Default is [None].

  • state_font_size (number (optional)) – State font size. Default is 8.

  • state_text_buffer (number (optional)) – Size of buffer around state text. Default is 0.5.

add_arrow(diagram, number, between, kind, label='', head_length=0.075, font_size=7, color='k')[source]

Add arrow.

Parameters:
  • diagram ([column, row]) – Diagram position.

  • number (integer) – Arrow position.

  • between ([start, stop]) – Arrow span.

  • kind ({'ket', 'bra', 'out'}) – Arrow style.

  • label (string (optional)) – Arrow label. Default is ‘’.

  • head_length (number (optional)) – Arrow head length. Default 0.075.

  • font_size (number (optional)) – Font size. Default is 7.

  • color (matplotlib color) – Arrow color. Default is ‘k’.

Returns:

[line, arrow_head, text]

Return type:

list

add_cascade(diagram, number, number_of_interactions=4, titles=[None], title_font_size=16, state_names=None, virtual=[None], state_font_size=14, state_text_buffer=0.5, label_side='left', bbox_adjust=[0.2, 0.9, 0.2, 0.78], transfer_arrow_linewidth=1.5, transfer_arrow_offset=[0.5, 5])[source]

Add cascading process as plot.

Parameters:
  • diagram ([row,column]) – row and column positions to place the cascade in the artist grid.

  • number (int) – number of cascading processes to add in series

  • number_of_interactions (int (optional)) – number of interactions for each sub process. Equal for all subprocesses. Default is 4.

  • titles (list of str (optional)) – list of title for each process. Default is [None]

  • title_font_size (int (optional)) – set the title font size. Default is 16

  • state_names (list of str (optional)) – list of state names. Default is None

  • virtal (list of int (optional)) – list of indices of virtual states. Default is [None]

  • state_font_size (int (optional)) – set the font size for the labels. Default is 14

  • state_text_buffer (float (optional)) – set the state text buffer. Default is 0.5

  • label_side (str (optional)) – set the side on which the state label will appear. Either ‘left’ or ‘right’. Default is ‘left’

  • bbox_adjust (list of floats (optional)) – adjusts the left, right, bottom, and top bounds of the cascade diagram. Default is bbox_adjust=[0.2, 0.9, 0.2, 0.78]

  • (ooptional) (transfer_arrow_linewidth = float) – adjusts the thickness of the arrow between cascading WMEL diagrams

  • [x_offset (transfer_arrow_offset =) – adjusts the label of the energy transfer arrow along the x and y axis

  • (optional) (y_offset]) – adjusts the label of the energy transfer arrow along the x and y axis

add_cascade_arrow(diagram, cascade_number, index, between, kind, label='', head_length=10, head_aspect=1, font_size=14, color='k')[source]

Add arrow to cascade subprocess.

Parameters:
  • diagram ([row,column]) – row and column indices location of the cascade in the figure.

  • cascade_number (int) – index of subprocess to add the arrow

  • index (int) – interaction index in the subprocess to which the arrow will be added

  • between ([start,stop]) – start and stop energy level indeces from which the arrow will point to

  • kind ({'bra', 'ket', 'out'}) – the kind of interaction to add

  • label (str (optional)) – interaction label. Default is “”

  • head_length (int (optional)) – interaction arrow head length. Default is 10

  • head_aspect (int (optional)) – set arrow head aspect ratio. Default is 1

  • font_size (int (optional)) – set label font size. Default is 14

  • color (str (optional)) – set arrow color. Default is black

clear_diagram(diagram)[source]

Clear diagram.

Parameters:

diagram ([column, row]) – Diagram to clear.

label_columns(labels, font_size=15, text_buffer=1.15)[source]

Label columns.

Parameters:
  • labels (list of strings) – Labels.

  • font_size (number (optional)) – Font size. Default is 15.

  • text_buffer (number) – Buffer around text. Default is 1.5.

label_rows(labels, font_size=15, text_buffer=1.5)[source]

Label rows.

Parameters:
  • labels (list of strings) – Labels.

  • font_size (number (optional)) – Font size. Default is 15.

  • text_buffer (number) – Buffer around text. Default is 1.5.

plot(save_path=None, close=False, bbox_inches='tight', pad_inches=1)[source]

Plot figure.

Parameters:
  • save_path (string (optional)) – Save path. Default is None.

  • close (boolean (optional)) – Toggle automatic figure closure after plotting. Default is False.

  • bbox_inches (number (optional)) – Bounding box size, in inches. Default is ‘tight’.

  • pad_inches (number (optional)) – Pad inches. Default is 1.

class WrightTools.diagrams.WMEL.Subplot(ax, energies, number_of_interactions=4, title='', title_font_size=16, state_names=None, virtual=[None], state_font_size=14, state_text_buffer=0.5, label_side='left')[source]

Bases: object

Subplot containing WMEL.

__init__(ax, energies, number_of_interactions=4, title='', title_font_size=16, state_names=None, virtual=[None], state_font_size=14, state_text_buffer=0.5, label_side='left')[source]

Subplot.

Parameters:
  • ax (matplotlib axis) – The axis.

  • energies (1D array-like) – Energies (scaled between 0 and 1)

  • number_of_interactions (integer) – Number of interactions in diagram.

  • title (string (optional)) – Title of subplot. Default is empty string.

  • state_names (list of str (optional)) – list of the names of the states

  • virtual (list of ints (optional)) – list of indexes of any vitual energy states

  • state_font_size (numtype (optional)) – font size for the state lables

  • state_text_buffer (numtype (optional)) – space between the energy level bars and the state labels

add_arrow(index, between, kind, label='', head_length=10, head_aspect=1, font_size=14, color='k')[source]

Add an arrow to the WMEL diagram.

Parameters:
  • index (integer) – The interaction, or start and stop interaction for the arrow.

  • between (2-element iterable of integers) – The inital and final state of the arrow

  • kind ({'ket', 'bra', 'outbra', 'outket'}) – The kind of interaction.

  • label (string (optional)) – Interaction label. Default is empty string.

  • head_length (number (optional)) – size of arrow head

  • font_size (number (optional)) – Label font size. Default is 14.

  • color (matplotlib color (optional)) – Arrow color. Default is black.

Return type:

[line,arrow_head,text]