Browse Source

Add an option to defer showing plots when calling visualize_*

tags/v0.2
jan 4 years ago
parent
commit
b7ff35485e
1 changed files with 8 additions and 4 deletions
  1. +8
    -4
      gridlock/grid.py

+ 8
- 4
gridlock/grid.py View File

@@ -681,7 +681,8 @@ class Grid(object):
surface_normal: Direction or int,
center: float,
which_shifts: int=0,
sample_period: int=1):
sample_period: int=1,
finalize: bool=True):
"""
Visualize a slice of a grid.
Interpolates if given a position between two planes.
@@ -748,13 +749,15 @@ class Grid(object):
pyplot.gca().set_aspect('equal', adjustable='box')
pyplot.xlabel(x_label)
pyplot.ylabel(y_label)
pyplot.show()
if finalize:
pyplot.show()

def visualize_isosurface(self,
level: float=None,
which_shifts: int=0,
sample_period: int=1,
show_edges: bool=True):
show_edges: bool=True,
finalize: bool=True):
"""
Draw an isosurface plot of the device.

@@ -801,4 +804,5 @@ class Grid(object):
for xb, yb, zb in zip(xbs, ybs, zbs):
ax.plot([xb], [yb], [zb], 'w')

pyplot.show()
if finalize:
pyplot.show()

Loading…
Cancel
Save