@@ -2745,20 +2745,22 @@ This module provides basic visualization functionality for the simulation domain
27452745
27462746``` python
27472747def plot2D (self ,
2748- ax = None ,
2749- output_plane = None ,
2750- fields = None ,
2751- labels = False ,
2752- eps_parameters = None ,
2753- boundary_parameters = None ,
2754- source_parameters = None ,
2755- monitor_parameters = None ,
2756- field_parameters = None ,
2757- frequency = None ,
2758- plot_eps_flag = True ,
2759- plot_sources_flag = True ,
2760- plot_monitors_flag = True ,
2761- plot_boundaries_flag = True ,
2748+ ax : Optional[matplotlib.axes._axes.Axes] = None ,
2749+ output_plane : Optional[meep.simulation.Volume] = None ,
2750+ fields : Optional = None ,
2751+ labels : Optional[bool ] = False ,
2752+ eps_parameters : Optional[dict ] = None ,
2753+ boundary_parameters : Optional[dict ] = None ,
2754+ source_parameters : Optional[dict ] = None ,
2755+ monitor_parameters : Optional[dict ] = None ,
2756+ field_parameters : Optional[dict ] = None ,
2757+ colorbar_parameters : Optional[dict ] = None ,
2758+ frequency : Optional[float ] = None ,
2759+ plot_eps_flag : bool = True ,
2760+ plot_sources_flag : bool = True ,
2761+ plot_monitors_flag : bool = True ,
2762+ plot_boundaries_flag : bool = True ,
2763+ nb : bool = False ,
27622764 ** kwargs ):
27632765```
27642766
@@ -2814,6 +2816,7 @@ to be called on all processes, but only generates a plot on the master process.
28142816 plot. Defaults to the ` frequency ` parameter of the [ Source] ( #source ) object.
28152817 - ` resolution=None ` : the resolution of the $\varepsilon$ grid. Defaults to the
28162818 ` resolution ` of the ` Simulation ` object.
2819+ - ` colorbar=False ` : whether to add a colorbar to the plot's parent Figure based on epsilon values.
28172820* ` boundary_parameters ` : a ` dict ` of optional plotting parameters that override
28182821 the default parameters for the boundary layers.
28192822 - ` alpha=1.0 ` : transparency of boundary layers
@@ -2850,6 +2853,21 @@ to be called on all processes, but only generates a plot on the master process.
28502853 - ` alpha=0.6 ` : transparency of fields
28512854 - ` post_process=np.real ` : post processing function to apply to fields (must be
28522855 a function object)
2856+ - ` colorbar=False ` : whether to add a colorbar to the plot's parent Figure based on field values.
2857+ * ` colorbar_parameters ` : a ` dict ` of optional plotting parameters that override the default parameters for
2858+ the colorbar.
2859+ - ` label=None ` : an optional label for the colorbar, defaults to '$\epsilon_r$' for epsilon and
2860+ 'field values' for fields.
2861+ - ` orientation='vertical' ` : the orientation of the colorbar gradient
2862+ - ` extend=None ` : make pointed end(s) for out-of-range values. Allowed values are:
2863+ [ 'neither', 'both', 'min', 'max']
2864+ - ` format=None ` : formatter for tick labels. Can be an fstring (i.e. "{x:.2e}") or a
2865+ [ matplotlib.ticker.ScalarFormatter] ( https://matplotlib.org/stable/api/ticker_api.html#matplotlib.ticker.ScalarFormatter ) .
2866+ - ` position='right' ` : position of the colorbar with respect to the Axes
2867+ - ` size='5%' ` : size of the colorbar in the dimension perpendicular to its ` orientation `
2868+ - ` pad='2%' ` : fraction of original axes between colorbar and image axes
2869+ * ` nb ` : set this to True if plotting in a Jupyter notebook to use ipympl for plotting. Note: this requires
2870+ ipympl to be installed.
28532871
28542872</div >
28552873
@@ -6241,7 +6259,7 @@ def __init__(self,
62416259 side : int = - 1 ,
62426260 R_asymptotic : float = 1e-15 ,
62436261 mean_stretch : float = 1.0 ,
6244- pml_profile : Callable[[float ], float ] = < function < lambda > at 0x7f0880782ca0 >):
6262+ pml_profile : Callable[[float ], float ] = < function < lambda > at 0x7f41474eeb00 >):
62456263```
62466264
62476265< div class = " method_docstring" markdown= " 1" >
@@ -7147,14 +7165,12 @@ class Animate2D(object):
71477165<div class =" class_docstring " markdown =" 1 " >
71487166
71497167A class used to record the fields during timestepping (i.e., a [ ` run ` ] ( #run-functions )
7150- function). The object is initialized prior to timestepping by specifying the
7151- simulation object and the field component. The object can then be passed to any
7152- [ step-function modifier] ( #step-function-modifiers ) . For example, one can record the
7153- $E_z$ fields at every one time unit using:
7168+ function). The object is initialized prior to timestepping by specifying the field component.
7169+ The object can then be passed to any [ step-function modifier] ( #step-function-modifiers ) .
7170+ For example, one can record the $E_z$ fields at every one time unit using:
71547171
71557172``` py
7156- animate = mp.Animate2D(sim,
7157- fields = mp.Ez,
7173+ animate = mp.Animate2D(fields = mp.Ez,
71587174 realtime = True ,
71597175 field_parameters = {' alpha' :0.8 , ' cmap' :' RdBu' , ' interpolation' :' none' },
71607176 boundary_parameters = {' hatch' :' o' , ' linewidth' :1.5 , ' facecolor' :' y' , ' edgecolor' :' b' , ' alpha' :0.3 })
@@ -7183,7 +7199,9 @@ track different volume locations (using `mp.in_volume`) or field components.
71837199<div class =" class_members " markdown =" 1 " >
71847200
71857201``` python
7186- def __call__ (self , sim , todo ):
7202+ def __call__ (self ,
7203+ sim : meep.simulation.Simulation,
7204+ todo : str ):
71877205```
71887206
71897207<div class =" method_docstring " markdown =" 1 " >
@@ -7201,12 +7219,12 @@ Call self as a function.
72017219
72027220``` python
72037221def __init__ (self ,
7204- fields ,
7205- sim = None ,
7206- f = None ,
7207- realtime = False ,
7208- normalize = False ,
7209- plot_modifiers = None ,
7222+ sim : Optional[meep.simulation.Simulation] = None ,
7223+ fields : Optional = None ,
7224+ f : Optional[matplotlib.figure.Figure] = None ,
7225+ realtime : bool = False ,
7226+ normalize : bool = False ,
7227+ plot_modifiers : Optional[ list ] = None ,
72107228 update_epsilon : bool = False ,
72117229 nb : bool = False ,
72127230 ** customization_args ):
@@ -7216,9 +7234,9 @@ def __init__(self,
72167234
72177235Construct an ` Animate2D ` object.
72187236
7219- + ** ` sim ` ** — Simulation object.
7237+ + ** ` sim=None ` ** — Optional Simulation object (this has no effect, and is included for backwards compatibility) .
72207238
7221- + ** ` fields ` ** — Field component to record at each time instant.
7239+ + ** ` fields=None ` ** — Optional Field component to record at each time instant.
72227240
72237241+ ** ` f=None ` ** — Optional ` matplotlib ` figure object that the routine will update
72247242 on each call. If not supplied, then a new one will be created upon
@@ -7261,7 +7279,7 @@ Construct an `Animate2D` object.
72617279<div class =" class_members " markdown =" 1 " >
72627280
72637281``` python
7264- def to_gif (self , fps , filename ) :
7282+ def to_gif (self , fps : int , filename : str ) -> None :
72657283```
72667284
72677285<div class =" method_docstring " markdown =" 1 " >
@@ -7282,7 +7300,8 @@ format only supports 256 colors from a _predefined_ color palette. Requires
72827300<div class =" class_members " markdown =" 1 " >
72837301
72847302``` python
7285- def to_jshtml (self , fps ):
7303+ def to_jshtml (self ,
7304+ fps : int ):
72867305```
72877306
72887307<div class =" method_docstring " markdown =" 1 " >
@@ -7301,7 +7320,7 @@ playback. User must specify a frame rate `fps` in frames per second.
73017320<div class =" class_members " markdown =" 1 " >
73027321
73037322``` python
7304- def to_mp4 (self , fps , filename ) :
7323+ def to_mp4 (self , fps : int , filename : str ) -> None :
73057324```
73067325
73077326<div class =" method_docstring " markdown =" 1 " >
0 commit comments