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

Method __init__

python/source.py:265–336  ·  view source on GitHub ↗

Construct a `GaussianSource`. + **`frequency` [`number`]** — The center frequency $f$ in units of $c$/distance (or $\\omega$ in units of $2\\pi c$/distance). See [Units](Introduction.md#units-in-meep). No default value. You can instead specify `wavelength=x` or

(
        self,
        frequency=None,
        width=0,
        fwidth=float("inf"),
        start_time=0,
        cutoff=5.0,
        is_integrated=False,
        wavelength=None,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

263 """
264
265 def __init__(
266 self,
267 frequency=None,
268 width=0,
269 fwidth=float("inf"),
270 start_time=0,
271 cutoff=5.0,
272 is_integrated=False,
273 wavelength=None,
274 **kwargs,
275 ):
276 """
277 Construct a `GaussianSource`.
278
279 + **`frequency` [`number`]** — The center frequency $f$ in units of $c$/distance
280 (or $\\omega$ in units of $2\\pi c$/distance). See [Units](Introduction.md#units-in-meep).
281 No default value. You can instead specify `wavelength=x` or `period=x`, which
282 are both a synonym for `frequency=1/x`; i.e. $1/\\omega$ in these units is the vacuum
283 wavelength or the temporal period.
284
285 + **`width` [`number`]** — The width $w$ used in the Gaussian. No default value.
286 You can instead specify `fwidth=x`, which is a synonym for `width=1/x` (i.e. the
287 frequency width is proportional to the inverse of the temporal width).
288
289 + **`start_time` [`number`]** — The starting time for the source; default is 0
290 (turn on at $t=0$). This is not the time of the peak. See below.
291
292 + **`cutoff` [`number`]** — How many `width`s the current decays for before it is
293 cut off and set to zero — this applies for both turn-on and turn-off of
294 the pulse. Default is 5.0. A larger value of `cutoff` will reduce the amount of
295 high-frequency components that are introduced by the start/stop of the source,
296 but will of course lead to longer simulation times. The peak of the Gaussian is
297 reached at the time $t_0$=`start_time + cutoff*width`.
298
299 + **`is_integrated` [`boolean`]** — If `True`, the source is the integral of the
300 current (the [dipole moment](https://en.wikipedia.org/wiki/Electric_dipole_moment))
301 which is guaranteed to be zero after the current turns off. In practice, there
302 is little difference between integrated and non-integrated sources *except* for
303 [planewaves extending into PML](Perfectly_Matched_Layer.md#planewave-sources-extending-into-pml).
304 Default is `False`.
305
306 + **`fourier_transform(f)`** — Returns the Fourier transform of the current
307 evaluated at frequency $f$ ($\\omega=2\\pi f$) given by:
308 $$
309 \\widetilde G(\\omega) \\equiv \\frac{1}{\\sqrt{2\\pi}}
310 \\int e^{i\\omega t}G(t)\\,dt \\equiv
311 \\frac{1}{\\Delta f}
312 e^{i\\omega t_0 -\\frac{(\\omega-\\omega_0)^2}{2\\Delta f^2}}
313 $$
314 where $G(t)$ is the current (not the dipole moment). In this formula, $\\Delta f$
315 is the `fwidth` of the source, $\\omega_0$ is $2\\pi$ times its `frequency,` and
316 $t_0$ is the peak time discussed above. Note that this does not include any
317 `amplitude` or `amp_func` factor that you specified for the source.
318 """
319 if frequency is None and wavelength is None:
320 raise ValueError(
321 f"Must set either frequency or wavelength in {self.__class__.__name__}."
322 )

Callers

nothing calls this directly

Calls 3

gaussian_src_timeMethod · 0.80
maxFunction · 0.50
__init__Method · 0.45

Tested by

no test coverage detected