Add Wigner function computation and Makie visualization extension#227
Add Wigner function computation and Makie visualization extension#227Aniket-umass wants to merge 14 commits into
Conversation
c41d915 to
b2b44c3
Compare
|
FYI, currently this PR seems to be deleting what was added in the previous PR. Something was probably messed up when resolving the merge conflict |
Alright, I will look into it |
063704a to
f34fa71
Compare
f34fa71 to
338ae1c
Compare
|
All Wigner and Bloch sphere plotting tests pass (9/9 each). The remaining CI failures (sciml_broadcast_interfaces, aqua, apply, Documentation, Downgrade) are pre-existing on the master branch. |
Krastanov
left a comment
There was a problem hiding this comment.
Looks good, up to minor test clarification. Still outstanding need to make error hints that point out the need for Makie backends so that the method errors are more legible.
| # wigner is only defined for FockBasis states | ||
| b_spin = SpinBasis(1//2) | ||
| ψ_spin = spinup(b_spin) | ||
| @test_throws Exception wignerplot_axis(ψ_spin) |
There was a problem hiding this comment.
this test checks for ANY exception, so it is not actually validating that you are getting the exception you are expecting. @test_throws supports using a substring of the error message as a quick way to provide more specificity, use that instead.
Krastanov
left a comment
There was a problem hiding this comment.
the way the error messages are done is a step backwards -- use the approach we had discussed with error hints
Plot examples:

Coherent state:
Fock state:

Adds a Makie recipe for visualizing the Wigner quasi-probability distribution of quantum states as a 2D heatmap, following the same extension pattern as the existing Bloch sphere visualization.
Changes
ext/QuantumOpticsBaseMakieExt.jl: Adds WignerPlot recipe producing a heatmap with a diverging colormap (:RdBu) pinned to zero, so positive regions (blue) and negative regions (red) are visually distinct. Supports reactive
Observable state updates.
src/visualization.jl: Adds function stubs for wignerplot, wignerplot!, and wignerplot_axis.
src/QuantumOpticsBase.jl: Exports the three new visualization functions.
test/test_wigner_plotting.jl: Tests for return types, coherent/Fock state rendering, custom attributes (xrange, prange, npoints, colormap), Observable reactivity, and error handling for unsupported basis types.
test/Project.toml: Adds Makie as a test dependency (needed for using Makie: Observable in both Bloch sphere and Wigner tests).