|
1 | 1 | using .PyPlot |
2 | 2 | import .PyPlot: plot, plot3D, plt |
3 | 3 | using Meshing |
| 4 | +using Statistics: quantile |
4 | 5 |
|
5 | 6 | # Defaults -------------------------------------------------------------------------------- |
6 | 7 |
|
@@ -76,23 +77,24 @@ function plot(flat::AbstractFourierLattice, Rs::DirectBasis{D}; |
76 | 77 | xyz = range(-.5, .5, length=N) |
77 | 78 | vals = calcfouriergridded(xyz, flat, N) |
78 | 79 | if isnothing(isoval) |
| 80 | + isnothing(filling) && error(ArgumentError("`filling` and `isoval` cannot both be `nothing`")) |
79 | 81 | # we don't want to "double count" the BZ edges - so to avoid that, exclude the last |
80 | | - # index of each dimension (same approach as in `filling2isoval`) |
| 82 | + # index of each dimension (same approach as in `MPBUtils.filling2isoval`) |
81 | 83 | isoidxs = OneTo(N-1) |
82 | 84 | vals′ = if D == 2; (@view vals[isoidxs, isoidxs]) |
83 | 85 | elseif D == 3; (@view vals[isoidxs, isoidxs, isoidxs]) |
84 | 86 | end |
85 | | - isoval = !isnothing(filling) ? quantile(Iterators.flatten(vals′), filling) : zero(Float64) |
| 87 | + isoval = quantile(Iterators.flatten(vals′), filling) |
86 | 88 | end |
87 | | - plotiso(xyz,vals,isoval,Rs,repeat,fig) |
| 89 | + plotiso(xyz, vals, isoval, Rs, repeat, fig) |
88 | 90 |
|
89 | | - return xyz,vals,isoval |
| 91 | + return xyz, vals, isoval |
90 | 92 | end |
91 | 93 |
|
92 | 94 | # plot isocontour of data |
93 | 95 | function plotiso(xyz, vals, isoval::Real, Rs::DirectBasis{D}, |
94 | | - repeat::Union{Integer, Nothing}=nothing, |
95 | | - fig=nothing) where D |
| 96 | + repeat::Union{Integer, Nothing}=nothing, |
| 97 | + fig=nothing) where D |
96 | 98 |
|
97 | 99 | if isnothing(fig) |
98 | 100 | fig = plt.figure() |
|
0 commit comments