Skip to content
Snippets Groups Projects
Commit 2f078c26 authored by Joseph Weston's avatar Joseph Weston
Browse files

provide clearer error message when a Builder is passed to plot_2d_bands

Closes #196.
parent 4fcc45d7
No related branches found
No related tags found
No related merge requests found
Pipeline #19293 passed with warnings
...@@ -362,10 +362,14 @@ def plot_2d_bands(syst, k_x=31, k_y=31, params=None, ...@@ -362,10 +362,14 @@ def plot_2d_bands(syst, k_x=31, k_y=31, params=None,
if not hasattr(syst, '_wrapped_symmetry'): if not hasattr(syst, '_wrapped_symmetry'):
raise TypeError("Expecting a system that was produced by " raise TypeError("Expecting a system that was produced by "
"'kwant.wraparound.wraparound'.") "'kwant.wraparound.wraparound'.")
if not isinstance(syst, system.FiniteSystem): if isinstance(syst, system.InfiniteSystem):
msg = ("All symmetry directions must be wrapped around: specify " msg = ("All symmetry directions must be wrapped around: specify "
"'keep=None' when calling 'kwant.wraparound.wraparound'.") "'keep=None' when calling 'kwant.wraparound.wraparound'.")
raise TypeError(msg) 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 {} params = params or {}
lat_ndim, space_ndim = syst._wrapped_symmetry.periods.shape lat_ndim, space_ndim = syst._wrapped_symmetry.periods.shape
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment