Returns a slice of the materials or time-domain fields over a subregion of the cell at the current simulation time as a NumPy array. The materials/fields are centered on the Yee-grid voxels using a bilinear interpolation of the nearest Yee-grid points. + **`componen
(
self,
component: int = None,
vol: Volume = None,
center: Vector3Type = None,
size: Vector3Type = None,
cmplx: bool = None,
arr: Optional[np.ndarray] = None,
frequency: float = 0,
snap: bool = False,
)
| 3890 | return convert_h5(rm_h5, cmd, *step_funcs) |
| 3891 | |
| 3892 | def get_array( |
| 3893 | self, |
| 3894 | component: int = None, |
| 3895 | vol: Volume = None, |
| 3896 | center: Vector3Type = None, |
| 3897 | size: Vector3Type = None, |
| 3898 | cmplx: bool = None, |
| 3899 | arr: Optional[np.ndarray] = None, |
| 3900 | frequency: float = 0, |
| 3901 | snap: bool = False, |
| 3902 | ): |
| 3903 | """ |
| 3904 | Returns a slice of the materials or time-domain fields over a subregion of the cell at the |
| 3905 | current simulation time as a NumPy array. The materials/fields are centered on the Yee-grid voxels |
| 3906 | using a bilinear interpolation of the nearest Yee-grid points. |
| 3907 | |
| 3908 | + **`component` [ `component` constant ]** — The field or material component (e.g., `meep.Ex`, |
| 3909 | `meep.Hy`, `meep.Sz`, `meep.Dielectric`, etc) of the array data. No default. |
| 3910 | |
| 3911 | + **`vol` [ `Volume` ]** — The rectilinear subregion/slice of the cell volume. |
| 3912 | The return value of `get_array` has the same dimensions as the `Volume`'s `size` |
| 3913 | attribute. If `None` (default), then a `size` and `center` must be specified. |
| 3914 | |
| 3915 | + **`center`, `size` [ `Vector3` ]** — If both are specified, the method will construct |
| 3916 | an appropriate `Volume`. This is a convenience feature and alternative to |
| 3917 | supplying a `Volume`. |
| 3918 | |
| 3919 | + **`cmplx` [ `boolean` ]** — If `True`, return complex-valued data otherwise return |
| 3920 | real-valued data (default). |
| 3921 | |
| 3922 | + **`arr` [ `numpy.ndarray` ]** — Optional parameter to pass a pre-allocated NumPy array of the correct size and |
| 3923 | type (either `numpy.float32` or `numpy.float64` depending on the [floating-point precision |
| 3924 | of the fields and materials](Build_From_Source.md#floating-point-precision-of-the-fields-and-materials-arrays)) |
| 3925 | which will be overwritten with the field/material data instead of allocating a |
| 3926 | new array. Normally, this will be the array returned from a previous call to |
| 3927 | `get_array` for a similar slice, allowing one to re-use `arr` (e.g., when |
| 3928 | fetching the same slice repeatedly at different times). |
| 3929 | |
| 3930 | + **`frequency` [ `number` ]** — The frequency at which the average eigenvalue of the |
| 3931 | $\\varepsilon$ and $\\mu$ tensors are evaluated. Defaults to 0 which is the |
| 3932 | instantaneous $\\varepsilon$. |
| 3933 | |
| 3934 | + **`snap` [ `boolean` ]** — Empty dimensions of the grid slice are "collapsed" |
| 3935 | into a single element. However, if `snap` is set to `True`, this |
| 3936 | interpolation behavior is disabled and the grid slice is instead "snapped" |
| 3937 | everywhere to the nearest grid point. (Empty slice dimensions are still of size |
| 3938 | one.) This feature is mainly useful for comparing results with the |
| 3939 | [`output_` routines](#output-functions) (e.g., `output_epsilon`, `output_efield_z`, etc.). |
| 3940 | |
| 3941 | For convenience, the following wrappers for `get_array` over the entire cell are |
| 3942 | available: `get_epsilon()`, `get_mu()`, `get_hpwr()`, `get_dpwr()`, |
| 3943 | `get_tot_pwr()`, `get_Xfield()`, `get_Xfield_x()`, `get_Xfield_y()`, |
| 3944 | `get_Xfield_z()`, `get_Xfield_r()`, `get_Xfield_p()` where `X` is one of `h`, `b`, |
| 3945 | `e`, `d`, or `s`. The routines `get_Xfield_*` all return an array type consistent |
| 3946 | with the fields (real or complex). The routines `get_epsilon()` and `get_mu()` |
| 3947 | accept the optional argument `frequency` (defaults to 0) and all routines accept |
| 3948 | `snap` (defaults to `False`). |
| 3949 |