|
2 | 2 |
|
3 | 3 | from __future__ import annotations
|
4 | 4 |
|
5 |
| -from typing import Dict, List, Optional, Set, Tuple, Union |
| 5 | +from typing import Dict, List, Literal, Optional, Set, Tuple, Union |
6 | 6 |
|
7 | 7 | import autograd.numpy as np
|
8 | 8 |
|
|
43 | 43 | from .material.multi_physics import MultiPhysicsMedium
|
44 | 44 | from .medium import (
|
45 | 45 | AbstractCustomMedium,
|
| 46 | + AbstractMedium, |
46 | 47 | AbstractPerturbationMedium,
|
47 | 48 | Medium,
|
48 | 49 | Medium2D,
|
@@ -850,7 +851,7 @@ def plot_structures_property(
|
850 | 851 | hlim: Tuple[float, float] = None,
|
851 | 852 | vlim: Tuple[float, float] = None,
|
852 | 853 | grid: Grid = None,
|
853 |
| - property: str = "eps", |
| 854 | + property: Literal["eps", "doping", "N_a", "N_d"] = "eps", |
854 | 855 | ) -> Ax:
|
855 | 856 | """Plot each of scene's structures on a plane defined by one nonzero x,y,z coordinate.
|
856 | 857 | The permittivity is plotted in grayscale based on its value at the specified frequency.
|
@@ -882,7 +883,7 @@ def plot_structures_property(
|
882 | 883 | The x range if plotting on xy or xz planes, y range if plotting on yz plane.
|
883 | 884 | vlim : Tuple[float, float] = None
|
884 | 885 | The z range if plotting on xz or yz planes, y plane if plotting on xy plane.
|
885 |
| - property: str = "eps" |
| 886 | + property: Literal["eps", "doping", "N_a", "N_d"] = "eps" |
886 | 887 | Indicates the property to plot for the structures. Currently supported properties
|
887 | 888 | are ["eps", "doping", "N_a", "N_d"]
|
888 | 889 |
|
@@ -1236,7 +1237,7 @@ def _get_structure_eps_plot_params(
|
1236 | 1237 | """Constructs the plot parameters for a given medium in scene.plot_eps()."""
|
1237 | 1238 |
|
1238 | 1239 | plot_params = plot_params_structure.copy(update={"linewidth": 0})
|
1239 |
| - if hasattr(medium, "viz_spec"): |
| 1240 | + if isinstance(medium, AbstractMedium): |
1240 | 1241 | if medium.viz_spec is not None:
|
1241 | 1242 | plot_params = plot_params.override_with_viz_spec(medium.viz_spec)
|
1242 | 1243 | if alpha is not None:
|
|
0 commit comments