|
1 | 1 | """ |
2 | 2 | entanglementplot(state; site=0[, kwargs...]) |
3 | 3 |
|
4 | | -Plot the entanglement spectrum of a given InfiniteMPS. |
| 4 | +Plot the [entanglement spectrum](@ref entanglement_spectrum) of a given MPS `state`. |
5 | 5 |
|
6 | 6 | # Arguments |
7 | | -- `site::Int=0`: mps index for multisite unit cells. Spectrum is computed for the bond between `site` and `site + 1`. |
| 7 | +- `state`: the MPS for which to compute the entanglement spectrum. |
| 8 | +
|
| 9 | +# Keyword Arguments |
| 10 | +- `site::Int=0`: MPS index for multisite unit cells. The spectrum is computed for the bond |
| 11 | + between `site` and `site + 1`. |
8 | 12 | - `expand_symmetry::Logical=false`: add quantum dimension degeneracies. |
9 | 13 | - `sortby=maximum`: the method of sorting the sectors. |
10 | 14 | - `sector_margin=1//10`: the amount of whitespace between sectors. |
11 | 15 | - `sector_formatter=string`: how to convert sectors to strings. |
12 | 16 | - `kwargs...`: other kwargs are passed on to the plotting backend. |
| 17 | +
|
| 18 | +!!! note |
| 19 | + You will need to manually import [Plots.jl](https://github.com/JuliaPlots/Plots.jl) to |
| 20 | + be able to use this function. MPSKit.jl defines its plots based on |
| 21 | + [RecipesBase.jl](https://github.com/JuliaPlots/Plots.jl/tree/v2/RecipesBase), but the |
| 22 | + user still has to add `using Plots` to be able to actually produce the plots. |
| 23 | +
|
13 | 24 | """ |
14 | 25 | function entanglementplot end |
15 | 26 | @userplot EntanglementPlot |
16 | 27 |
|
17 | 28 | @recipe function f(h::EntanglementPlot; site=0, expand_symmetry=false, sortby=maximum, |
18 | 29 | sector_margin=1 // 10, sector_formatter=string) |
19 | 30 | mps = h.args[1] |
20 | | - site <= length(mps) || throw(ArgumentError("Not a valid site for the given mps.")) |
| 31 | + (site <= length(mps) && !(isa(mps, FiniteMPS) && site == 0)) || |
| 32 | + throw(ArgumentError("Invalid site $site for the given mps.")) |
21 | 33 |
|
22 | 34 | spectra = entanglement_spectrum(mps, site) |
23 | 35 | sectors = [] |
@@ -75,21 +87,31 @@ function entanglementplot end |
75 | 87 | end |
76 | 88 |
|
77 | 89 | """ |
78 | | - transferplot(above, below[, sectors[, transferkwargs[, kwargs]]]) |
| 90 | + transferplot(above, below=above; sectors=[], transferkwargs=(;)[, kwargs...]) |
79 | 91 |
|
80 | 92 | Plot the partial transfer matrix spectrum of two InfiniteMPS's. |
81 | 93 |
|
82 | 94 | # Arguments |
83 | 95 | - `above::InfiniteMPS`: above mps for [`transfer_spectrum`](@ref). |
84 | | -- `below::InfiniteMPS`: below mps for [`transfer_spectrum`](@ref). |
| 96 | +- `below::InfiniteMPS=above`: below mps for [`transfer_spectrum`](@ref). |
| 97 | +
|
| 98 | +# Keyword Arguments |
85 | 99 | - `sectors=[]`: vector of sectors for which to compute the spectrum. |
86 | 100 | - `transferkwargs`: kwargs for call to [`transfer_spectrum`](@ref). |
87 | 101 | - `kwargs`: other kwargs are passed on to the plotting backend. |
88 | 102 | - `thetaorigin=0`: origin of the angle range. |
89 | 103 | - `sector_formatter=string`: how to convert sectors to strings. |
| 104 | +
|
| 105 | +!!! note |
| 106 | + You will need to manually import [Plots.jl](https://github.com/JuliaPlots/Plots.jl) to |
| 107 | + be able to use this function. MPSKit.jl defines its plots based on |
| 108 | + [RecipesBase.jl](https://github.com/JuliaPlots/Plots.jl/tree/v2/RecipesBase), but the |
| 109 | + user still has to add `using Plots` to be able to actually produce the plots. |
| 110 | +
|
90 | 111 | """ |
91 | 112 | function transferplot end |
92 | 113 | @userplot TransferPlot |
| 114 | + |
93 | 115 | @recipe function f(h::TransferPlot; sectors=nothing, transferkwargs=(;), thetaorigin=0, |
94 | 116 | sector_formatter=string) |
95 | 117 | if sectors === nothing |
|
0 commit comments