Commit 2f078c26 authored by Joseph Weston's avatar Joseph Weston

provide clearer error message when a Builder is passed to plot_2d_bands

Closes #196.
parent 4fcc45d7
Pipeline #20074 passed with stages
in 39 minutes and 8 seconds
......@@ -362,10 +362,14 @@ def plot_2d_bands(syst, k_x=31, k_y=31, params=None,
if not hasattr(syst, '_wrapped_symmetry'):
raise TypeError("Expecting a system that was produced by "
if not isinstance(syst, system.FiniteSystem):
if isinstance(syst, system.InfiniteSystem):
msg = ("All symmetry directions must be wrapped around: specify "
"'keep=None' when calling 'kwant.wraparound.wraparound'.")
raise TypeError(msg)
if isinstance(syst, builder.Builder):
msg = ("Expecting a finalized system: remember to finalize your "
"system with 'syst.finalized()'.")
raise TypeError(msg)
params = params or {}
lat_ndim, space_ndim = syst._wrapped_symmetry.periods.shape
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment