Skip to content

Commit

Permalink
Add error handling for unavailable plotting libraries in plot_wigner …
Browse files Browse the repository at this point in the history
…function
  • Loading branch information
LorenzoFioroni committed Dec 9, 2024
1 parent 3429e7b commit f2a6789
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/visualization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,13 @@ plot_wigner(
kwargs...,
) where {T,OpType<:Union{BraQuantumObject,KetQuantumObject,OperatorQuantumObject}} =
plot_wigner(makeVal(library), state; kwargs...)

plot_wigner(
::Val{T},
state::QuantumObject{<:AbstractArray{T1},OpType};
kwargs...,
) where {T,T1,OpType<:Union{BraQuantumObject,KetQuantumObject,OperatorQuantumObject}} = throw(
ArgumentError(
"The specified plotting library $T is not available. Try running `using $T` first.",
),
)

0 comments on commit f2a6789

Please sign in to comment.