qiskit-documentation/docs/api/qiskit/0.24/qiskit.visualization.pulse....

166 lines
10 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: qcstyle
description: API reference for qiskit.visualization.pulse.qcstyle
in_page_toc_min_heading_level: 2
python_api_type: module
python_api_name: qiskit.visualization.pulse.qcstyle
---
<span id="module-qiskit.visualization.pulse.qcstyle" />
<span id="qiskit-visualization-pulse-qcstyle" />
# qiskit.visualization.pulse.qcstyle
Style sheets for pulse visualization.
**Classes**
| | |
| ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------- |
| [`ComplexColors`](#qiskit.visualization.pulse.qcstyle.ComplexColors "qiskit.visualization.pulse.qcstyle.ComplexColors")(real, imaginary) | Create new instance of ComplexColors(real, imaginary) |
| [`PulseStyle`](#qiskit.visualization.pulse.qcstyle.PulseStyle "qiskit.visualization.pulse.qcstyle.PulseStyle")(\[figsize, title\_font\_size, …]) | Style sheet for Qiskit-Pulse sample pulse drawer. |
| [`SchedStyle`](#qiskit.visualization.pulse.qcstyle.SchedStyle "qiskit.visualization.pulse.qcstyle.SchedStyle")(\[figsize, fig\_unit\_h\_table, …]) | Style sheet for Qiskit-Pulse schedule drawer. |
| [`SchedTableColors`](#qiskit.visualization.pulse.qcstyle.SchedTableColors "qiskit.visualization.pulse.qcstyle.SchedTableColors")(time, channel, event) | Create new instance of SchedTableColors(time, channel, event) |
### ComplexColors
<Class id="qiskit.visualization.pulse.qcstyle.ComplexColors" signature="ComplexColors(real, imaginary)" modifiers="class">
Create new instance of ComplexColors(real, imaginary)
#### count
<Function id="qiskit.visualization.pulse.qcstyle.ComplexColors.count" signature="count(value, /)">
Return number of occurrences of value.
</Function>
#### imaginary
<Attribute id="qiskit.visualization.pulse.qcstyle.ComplexColors.imaginary">
Alias for field number 1
</Attribute>
#### index
<Function id="qiskit.visualization.pulse.qcstyle.ComplexColors.index" signature="index(value, start=0, stop=9223372036854775807, /)">
Return first index of value.
Raises ValueError if the value is not present.
</Function>
#### real
<Attribute id="qiskit.visualization.pulse.qcstyle.ComplexColors.real">
Alias for field number 0
</Attribute>
</Class>
### PulseStyle
<Class id="qiskit.visualization.pulse.qcstyle.PulseStyle" github="https://github.com/qiskit/qiskit/tree/stable/0.16/qiskit/visualization/pulse/qcstyle.py" signature="PulseStyle(figsize=(7.0, 5.0), title_font_size=18, wave_color=('#ff0000', '#0000ff'), bg_color='#f2f3f4', num_points=1000, dpi=None)" modifiers="class">
Style sheet for Qiskit-Pulse sample pulse drawer.
Create new style sheet.
For any of the Optional fields, if that field is None then it will revert to its matplotlib.rcParams counterpart. See for usage on rcParams. Each argument that is optonal also describes its mapped rcParam key below.
**Parameters**
* **figsize** (`Optional`\[`Tuple`\[`float`, `float`]]) Size of the figure. If `None`, will default to the figure size of the drawing backend. If the output is `matplotlib`, the default parameter is `rcParams['figure.figsize']`.
* **title\_font\_size** (`Optional`\[`int`]) Font size of schedule name in title. If `None`, will default to the title font size of the drawing backend. If the output is `matplotlib`, the default parameter is `rcParams['figure.titlesize']`.
* **wave\_color** ([`ComplexColors`](#qiskit.visualization.pulse.qcstyle.ComplexColors "qiskit.visualization.pulse.qcstyle.ComplexColors")) Color code or name of colors for the real and imaginary parts of the waveform.
* **bg\_color** (`str`) Color code or name of color for pulse canvas background.
* **num\_points** (`int`) Number of points for interpolation.
* **dpi** (`Optional`\[`int`]) Resolution in the unit of dot per inch to save image. If `None`, will revert to the DPI setting of the drawing backend. If the output is `matplotlib`, the default parameter is `rcParams['figure.dpi']`.
</Class>
### SchedStyle
<Class id="qiskit.visualization.pulse.qcstyle.SchedStyle" github="https://github.com/qiskit/qiskit/tree/stable/0.16/qiskit/visualization/pulse/qcstyle.py" signature="SchedStyle(figsize=(10.0, 12.0), fig_unit_h_table=0.4, use_table=True, table_columns=2, table_font_size=10, axis_font_size=18, label_font_size=10, icon_font_size=18, title_font_size=25, label_ch_linestyle='--', label_ch_color='#222222', label_ch_alpha=0.3, d_ch_color=('#648fff', '#002999'), u_ch_color=('#ffb000', '#994A00'), m_ch_color=('#dc267f', '#760019'), s_ch_color='#7da781', s_ch_linestyle='-', table_color=('#e0e0e0', '#f6f6f6', '#f6f6f6'), bg_color='#f2f3f4', num_points=1000, dpi=150, remove_spacing=True, max_table_ratio=0.5, vertical_span=0.2, axis_formatter='%s')" modifiers="class">
Style sheet for Qiskit-Pulse schedule drawer.
Create new style sheet.
For any of the Optional fields, if that field is None then it will revert to its matplotlib.rcParams counterpart. See for usage on rcParams. Each argument that is optonal also describes its mapped rcParam key below.
**Parameters**
* **figsize** (`Optional`\[`Tuple`\[`float`, `float`]]) Size of the figure. If `None`, will default to the figure size of the drawing backend. If the output is `matplotlib`, the default parameter is `rcParams['figure.figsize']`.
* **fig\_unit\_h\_table** (`float`) Height of row of event table. See Example.
* **use\_table** (`bool`) When set True use event table.
* **table\_columns** (`int`) Number of event table columns.
* **table\_font\_size** (`int`) Font size of event table.
* **axis\_font\_size** (`int`) Font size of channel aliases. If `None`, will revert to the axis label size of the drawing backend. If the output is `matplotlib`, the default parameter is `rcParams['axes.titlesize']`.
* **label\_font\_size** (`int`) Font size of labels in canvas.
* **icon\_font\_size** (`int`) Size of symbols.
* **title\_font\_size** (`Optional`\[`int`]) Font size of schedule name in title. If `None`, will default to the title font size of the drawing backend. If the output is `matplotlib`, the default parameter is `rcParams['figure.titlesize']`.
* **label\_ch\_linestyle** (`str`) Line style for channel pulse label line.
* **label\_ch\_color** (`str`) Color code or name of color for channel pulse label line.
* **label\_ch\_alpha** (`float`) Transparency for channel pulse label line from 0 to 1.
* **d\_ch\_color** ([`ComplexColors`](#qiskit.visualization.pulse.qcstyle.ComplexColors "qiskit.visualization.pulse.qcstyle.ComplexColors")) Color code or name of colors for real and imaginary part of waveform at d channels.
* **u\_ch\_color** ([`ComplexColors`](#qiskit.visualization.pulse.qcstyle.ComplexColors "qiskit.visualization.pulse.qcstyle.ComplexColors")) Color code or name of colors for real and imaginary part of waveform at u channels.
* **m\_ch\_color** ([`ComplexColors`](#qiskit.visualization.pulse.qcstyle.ComplexColors "qiskit.visualization.pulse.qcstyle.ComplexColors")) Color code or name of colors for real and imaginary part of waveform at m channels.
* **s\_ch\_color** (`str`) Color code or name of color for snapshot channel line.
* **s\_ch\_linestyle** (`str`) Line style for snapshot line.
* **table\_color** ([`SchedTableColors`](#qiskit.visualization.pulse.qcstyle.SchedTableColors "qiskit.visualization.pulse.qcstyle.SchedTableColors")) Color code or name of color for event table columns of time, channel, event information.
* **bg\_color** (`str`) Color code or name of color for canvas background.
* **num\_points** (`int`) Number of points for interpolation of each channel.
* **dpi** (`Optional`\[`int`]) Resolution in the unit of dot per inch to save image. If `None`, will revert to the DPI setting of the drawing backend. If the output is `matplotlib`, the default parameter is `rcParams['figure.dpi']`.
* **remove\_spacing** (`bool`) Remove redundant spacing when the waveform has no negative values.
* **max\_table\_ratio** (`float`) Maximum portion of the plot the table can take up. Limited to range between 0 and 1.
* **vertical\_span** (`float`) Spacing on top and bottom of pulse canvas.
* **axis\_formatter** (`str`) Format of horizontal axis of the plot. This is convenient when you set `dt` option for the drawer. For example, formatter of `%.3e` gives you horizontal axis values in the scientific notation with 3 digits.
**Example**
Height of the event table is decided by multiple parameters.:
```python
figsize = (10.0, 12.0)
fig_unit_h_table = 0.4
table_columns = 2
max_table_ratio = 0.5
```
With this setup, events are shown in double-column style with each line height of 0.4 inch and the table cannot exceed 5 inch. Thus 12 lines are maximum and up to 24 events can be shown. If you want to show more events, increase figure height or reduce size of line height and table font size.
</Class>
### SchedTableColors
<Class id="qiskit.visualization.pulse.qcstyle.SchedTableColors" signature="SchedTableColors(time, channel, event)" modifiers="class">
Create new instance of SchedTableColors(time, channel, event)
#### channel
<Attribute id="qiskit.visualization.pulse.qcstyle.SchedTableColors.channel">
Alias for field number 1
</Attribute>
#### count
<Function id="qiskit.visualization.pulse.qcstyle.SchedTableColors.count" signature="count(value, /)">
Return number of occurrences of value.
</Function>
#### event
<Attribute id="qiskit.visualization.pulse.qcstyle.SchedTableColors.event">
Alias for field number 2
</Attribute>
#### index
<Function id="qiskit.visualization.pulse.qcstyle.SchedTableColors.index" signature="index(value, start=0, stop=9223372036854775807, /)">
Return first index of value.
Raises ValueError if the value is not present.
</Function>
#### time
<Attribute id="qiskit.visualization.pulse.qcstyle.SchedTableColors.time">
Alias for field number 0
</Attribute>
</Class>