Skip to content

Commit

Permalink
plot geometry for dispersive materials without initializing structure…
Browse files Browse the repository at this point in the history
… object (NanoComp#1827)

* plot geometry without initializing structure class

* update docstrings

* rotate epsilon grid by 90 degrees to properly orient axes

* add support for dispersive ε

* update markdown pages from docstrings

* make frequency and resolution parameters of plot2D dictionary keys of eps_parameters

* reinstate frequency parameter of plot2D and add warning that it is deprecated

* fix order of frequency check
  • Loading branch information
oskooi authored and Mo Chen committed Feb 22, 2022
1 parent f3355f1 commit 0f17dc3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion doc/docs/Python_User_Interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -4416,7 +4416,7 @@ def __init__(self,
medium2,
weights=None,
grid_type='U_DEFAULT',
do_averaging=False,
do_averaging=True,
beta=0,
eta=0.5,
damping=0):
Expand Down
16 changes: 16 additions & 0 deletions python/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,14 @@ def plot_eps(sim, ax, output_plane=None, eps_parameters=None, frequency=None):
elif sim_size.y == 0:
# Plot x on x axis, z on y axis (XZ plane)
extent = [xmin, xmax, zmin, zmax]
<<<<<<< HEAD
if (sim.dimensions == mp.CYLINDRICAL) or sim.is_cylindrical:
xlabel = 'R'
else:
xlabel = "X"
=======
xlabel = 'X'
>>>>>>> plot geometry for dispersive materials without initializing structure object (#1827)
ylabel = 'Z'
xtics = np.linspace(xmin, xmax, Nx)
ytics = np.array([sim_center.y])
Expand Down Expand Up @@ -422,7 +426,11 @@ def plot_boundaries(sim, ax, output_plane=None, boundary_parameters=None):
# consolidate plotting parameters
boundary_parameters = default_boundary_parameters if boundary_parameters is None else dict(default_boundary_parameters, **boundary_parameters)

<<<<<<< HEAD
def get_boundary_volumes(thickness, direction, side, cylindrical=False):
=======
def get_boundary_volumes(thickness, direction, side):
>>>>>>> plot geometry for dispersive materials without initializing structure object (#1827)
from meep.simulation import Volume

thickness = boundary.thickness
Expand Down Expand Up @@ -555,10 +563,14 @@ def plot_fields(sim, ax=None, fields=None, output_plane=None, field_parameters=N
elif sim_size.y == 0:
# Plot x on x axis, z on y axis (XZ plane)
extent = [xmin, xmax, zmin, zmax]
<<<<<<< HEAD
if (sim.dimensions == mp.CYLINDRICAL) or sim.is_cylindrical:
xlabel = 'R'
else:
xlabel = "X"
=======
xlabel = 'X'
>>>>>>> plot geometry for dispersive materials without initializing structure object (#1827)
ylabel = 'Z'
elif sim_size.z == 0:
# Plot x on x axis, y on y axis (XY plane)
Expand Down Expand Up @@ -620,7 +632,11 @@ def plot2D(sim, ax=None, output_plane=None, fields=None, labels=False,
labels=labels, monitor_parameters=monitor_parameters)

# Plot fields
<<<<<<< HEAD
if fields is not None:
=======
if fields:
>>>>>>> plot geometry for dispersive materials without initializing structure object (#1827)
ax = plot_fields(sim, ax, fields, output_plane=output_plane,
field_parameters=field_parameters)

Expand Down

0 comments on commit 0f17dc3

Please sign in to comment.