visualization
Visualization utils.
plot_cf(state, pts_x, pts_y=None, axs=None, contour=True, qp_type=WIGNER, cbar_label='', axis_scale_factor=1, plot_cbar=True, plot_grid=True, x_ticks=None, y_ticks=None, z_ticks=None, subtitles=None, figtitle=None, gif=False, gif_params=None)
Plot a characteristic function as paired real/imag subplots.
Each batch element produces two adjacent subplots — real part followed
by imaginary part — so the rendered grid has shape (rows, 2 * cols).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
state with arbitrary number of batch dimensions, result will be flattened to a 2d grid to allow for plotting |
required | |
pts_x
|
x points to evaluate the characteristic function at |
required | |
pts_y
|
y points to evaluate the characteristic function at |
None
|
|
axs
|
matplotlib axes to plot on |
None
|
|
contour
|
make the plot use contouring |
True
|
|
qp_type
|
type of characteristic function. Currently only
|
WIGNER
|
|
cbar_label
|
labels for the real and imaginary cbar (overridden
internally based on |
''
|
|
axis_scale_factor
|
scale of the axes labels relative |
1
|
|
plot_cbar
|
whether to plot cbar |
True
|
|
plot_grid
|
whether to draw gridlines on each subplot |
True
|
|
x_ticks
|
tick position for the x-axis |
None
|
|
y_ticks
|
tick position for the y-axis |
None
|
|
z_ticks
|
tick position for the z-axis |
None
|
|
subtitles
|
subtitles for the subplots (shape must match |
None
|
|
figtitle
|
figure title |
None
|
|
gif
|
if True, render an animation over one batch axis instead of a
tiled grid. Returns a |
False
|
|
gif_params
|
dict of options for the gif path. Recognized keys:
|
None
|
Returns:
| Type | Description |
|---|---|
|
|
|
|
|
Source code in jaxquantum/core/visualization.py
703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 | |
plot_cf_wigner(state, pts_x, pts_y=None, axs=None, contour=True, cbar_label='', axis_scale_factor=1, plot_cbar=True, plot_grid=True, x_ticks=None, y_ticks=None, z_ticks=None, subtitles=None, figtitle=None, gif=False, gif_params=None)
Plot the Wigner characteristic function of the state.
Thin wrapper around :func:plot_cf with qp_type='wigner'. Each batch
element is rendered as two subplots side-by-side: real then imaginary
part of the characteristic function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
state with arbitrary number of batch dimensions, result will be flattened to a 2d grid to allow for plotting |
required | |
pts_x
|
x points to evaluate the characteristic function at |
required | |
pts_y
|
y points to evaluate the characteristic function at |
None
|
|
axs
|
matplotlib axes to plot on |
None
|
|
contour
|
make the plot use contouring |
True
|
|
cbar_label
|
label for the cbar |
''
|
|
axis_scale_factor
|
scale of the axes labels relative |
1
|
|
plot_cbar
|
whether to plot cbar |
True
|
|
plot_grid
|
whether to draw gridlines on each subplot |
True
|
|
x_ticks
|
tick position for the x-axis |
None
|
|
y_ticks
|
tick position for the y-axis |
None
|
|
z_ticks
|
tick position for the z-axis |
None
|
|
subtitles
|
subtitles for the subplots |
None
|
|
figtitle
|
figure title |
None
|
|
gif
|
if True, render an animation over one batch axis instead of a
tiled subplot grid. See :func: |
False
|
|
gif_params
|
dict of options for the gif path. Recognized keys:
|
None
|
Returns:
| Type | Description |
|---|---|
|
|
|
|
when |
Source code in jaxquantum/core/visualization.py
1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 | |
plot_qfunc(state, pts_x, pts_y=None, g=2, axs=None, contour=True, cbar_label='', axis_scale_factor=1, plot_cbar=True, x_ticks=None, y_ticks=None, z_ticks=None, subtitles=None, figtitle=None, gif=False, gif_params=None)
Plot the husimi (Q) function of the state.
Thin wrapper around :func:plot_qp with qp_type='husimi'.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
state with arbitrary number of batch dimensions, result will be flattened to a 2d grid to allow for plotting |
required | |
pts_x
|
x points to evaluate quasi-probability distribution at |
required | |
pts_y
|
y points to evaluate quasi-probability distribution at |
None
|
|
g
|
float, default 2. Scaling factor for |
2
|
|
axs
|
matplotlib axes to plot on |
None
|
|
contour
|
make the plot use contouring |
True
|
|
cbar_label
|
label for the cbar |
''
|
|
axis_scale_factor
|
scale of the axes labels relative |
1
|
|
plot_cbar
|
whether to plot cbar |
True
|
|
x_ticks
|
tick position for the x-axis |
None
|
|
y_ticks
|
tick position for the y-axis |
None
|
|
z_ticks
|
tick position for the z-axis |
None
|
|
subtitles
|
subtitles for the subplots |
None
|
|
figtitle
|
figure title |
None
|
|
gif
|
if True, render an animation over one batch axis instead of a
tiled subplot grid. See :func: |
False
|
|
gif_params
|
dict of options for the gif path. Recognized keys:
|
None
|
Returns:
| Type | Description |
|---|---|
|
|
|
|
when |
Source code in jaxquantum/core/visualization.py
551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 | |
plot_qp(state, pts_x, pts_y=None, g=2, axs=None, contour=True, qp_type=WIGNER, cbar_label='', axis_scale_factor=1, plot_cbar=True, x_ticks=None, y_ticks=None, z_ticks=None, subtitles=None, figtitle=None, gif=False, gif_params=None)
Plot a quasi-probability distribution (Wigner or Husimi-Q).
The state may carry an arbitrary number of batch dimensions; they are
flattened to a 2D (rows, cols) grid of subplots. With gif=True,
one batch axis is animated instead and the remaining batch dims form
the per-frame subplot grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
state with arbitrary number of batch dimensions; result will be flattened to a 2d grid to allow for plotting |
required | |
pts_x
|
x points to evaluate the quasi-probability distribution at |
required | |
pts_y
|
y points to evaluate the quasi-probability distribution at;
defaults to |
None
|
|
g
|
float, default 2. Scaling factor for |
2
|
|
axs
|
matplotlib axes to plot on (created if None) |
None
|
|
contour
|
use |
True
|
|
qp_type
|
type of quasi-probability distribution
( |
WIGNER
|
|
cbar_label
|
label for the cbar (overridden internally based on
|
''
|
|
axis_scale_factor
|
multiplicative scale applied to the axis tick positions and labels |
1
|
|
plot_cbar
|
whether to draw a colorbar on each subplot |
True
|
|
x_ticks
|
tick positions for the x-axis (auto if None) |
None
|
|
y_ticks
|
tick positions for the y-axis (auto if None) |
None
|
|
z_ticks
|
tick positions for the colorbar (auto if None) |
None
|
|
subtitles
|
subtitles for the subplots; shape must match
|
None
|
|
figtitle
|
figure title |
None
|
|
gif
|
if True, render an animation over one batch axis instead of a
tiled subplot grid. Returns a
|
False
|
|
gif_params
|
dict of options for the gif path (ignored if
|
None
|
Returns:
| Type | Description |
|---|---|
|
|
|
|
|
Source code in jaxquantum/core/visualization.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | |
plot_wigner(state, pts_x, pts_y=None, g=2, axs=None, contour=True, cbar_label='', axis_scale_factor=1, plot_cbar=True, x_ticks=None, y_ticks=None, z_ticks=None, subtitles=None, figtitle=None, gif=False, gif_params=None)
Plot the wigner function of the state.
Thin wrapper around :func:plot_qp with qp_type='wigner'.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
state with arbitrary number of batch dimensions, result will be flattened to a 2d grid to allow for plotting |
required | |
pts_x
|
x points to evaluate quasi-probability distribution at |
required | |
pts_y
|
y points to evaluate quasi-probability distribution at |
None
|
|
g
|
float, default 2. Scaling factor for |
2
|
|
axs
|
matplotlib axes to plot on |
None
|
|
contour
|
make the plot use contouring |
True
|
|
cbar_label
|
label for the cbar |
''
|
|
axis_scale_factor
|
scale of the axes labels relative |
1
|
|
plot_cbar
|
whether to plot cbar |
True
|
|
x_ticks
|
tick position for the x-axis |
None
|
|
y_ticks
|
tick position for the y-axis |
None
|
|
z_ticks
|
tick position for the z-axis |
None
|
|
subtitles
|
subtitles for the subplots |
None
|
|
figtitle
|
figure title |
None
|
|
gif
|
if True, render an animation over one batch axis instead of a
tiled subplot grid. See :func: |
False
|
|
gif_params
|
dict of options for the gif path. Recognized keys:
|
None
|
Returns:
| Type | Description |
|---|---|
|
|
|
|
when |
Source code in jaxquantum/core/visualization.py
478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 | |