MCPcopy Create free account
hub / github.com/NanoComp/meep / __init__

Method __init__

python/source.py:41–133  ·  view source on GitHub ↗

Construct a `Source`. + **`src` [`SourceTime` class ]** — Specify the time-dependence of the source (see below). No default. + **`component` [`component` constant ]** — Specify the direction and type of the current component: e.g. `mp.Ex`, `mp.Ey`, etce

(
        self,
        src,
        component,
        center=None,
        volume=None,
        size=Vector3(),
        amplitude=1.0,
        amp_func=None,
        amp_func_file="",
        amp_data=None,
    )

Source from the content-addressed store, hash-verified

39 """
40
41 def __init__(
42 self,
43 src,
44 component,
45 center=None,
46 volume=None,
47 size=Vector3(),
48 amplitude=1.0,
49 amp_func=None,
50 amp_func_file="",
51 amp_data=None,
52 ):
53 """
54 Construct a `Source`.
55
56 + **`src` [`SourceTime` class ]** — Specify the time-dependence of the source (see
57 below). No default.
58
59 + **`component` [`component` constant ]** — Specify the direction and type of the
60 current component: e.g. `mp.Ex`, `mp.Ey`, etcetera for an electric-charge
61 current, and `mp.Hx`, `mp.Hy`, etcetera for a magnetic-charge current. Note that
62 currents pointing in an arbitrary direction are specified simply as multiple
63 current sources with the appropriate amplitudes for each component. No default.
64
65 + **`center` [`Vector3`]** — The location of the center of the current source in
66 the cell. No default.
67
68 + **`size` [`Vector3`]** — The size of the current distribution along each
69 direction of the cell. Default is `(0,0,0)`: a point-dipole source.
70
71 + **`volume` [`Volume`]** — A `meep.Volume` can be used to specify the source
72 region instead of a `center` and a `size`.
73
74 + **`amplitude` [`complex`]** — An overall complex amplitude multiplying the
75 current source. Default is 1.0. Note that specifying a complex `amplitude`
76 imparts a phase shift to the real part of the overall current and thus
77 does *not* require using complex fields for the entire simulation
78 (via `force_complex_fields=True`).
79
80 + **`amp_func` [`function`]** — A Python function of a single argument, that takes
81 a `Vector3` giving a position and returns a complex current amplitude for that
82 point. The position argument is *relative* to the `center` of the current
83 source, so that you can move your current around without changing your function.
84 Default is `None`, meaning that a constant amplitude of 1.0 is used. Note that
85 your amplitude function (if any) is *multiplied* by the `amplitude` property, so
86 both properties can be used simultaneously.
87
88 + **`amp_func_file` [`string`]** — String of the form
89 `path_to_h5_file.h5:dataset`. The `.h5` extension is optional. Meep will read
90 the HDF5 file and create an amplitude function that interpolates into the grid
91 specified by the file. Meep expects the data to be split into real and imaginary
92 parts, so in the above example it will look for `dataset.re` and `dataset.im` in
93 the file `path_to_h5_file.h5`. Defaults to the empty string.
94
95 + **`amp_data` [`numpy.ndarray with dtype=numpy.complex128`]** — Like
96 `amp_func_file` above, but instead of interpolating into an HDF5 file,
97 interpolates into a complex NumPy array. The array should be three dimensions.
98 For a 2d simulation, just pass 1 for the third dimension, e.g., `arr =

Callers 5

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 1

Vector3Class · 0.90

Tested by

no test coverage detected