def __init__(self, src_func, start_time=-1.0e20, end_time=1.0e20): super(CustomSource, self).__init__() self.src_func = src_func self.start_time = start_time self.end_time = end_time self.swigobj = mp.custom_src_time(src_func, start_time, end_time) self.swigobj.is_integrated = self.is_integrated
def __init__(self, src_func, start_time=-1.0e20, end_time=1.0e20, center_frequency=0, **kwargs): """ Construct a `CustomSource`. + **`src_func` [`function`]** — The function $f(t)$ specifying the time-dependence of the source. It should take one argument (the time in Meep units) and return a complex number. + **`start_time` [`number`]** — The starting time for the source. Default is -10<sup>20</sup>: turn on at $t=-\\infty$. Note, however, that the simulation normally starts at $t=0$ with zero fields as the initial condition, so there is implicitly a sharp turn-on at $t=0$ whether you specify it or not. + **`end_time` [`number`]** — The end time for the source. Default is 10<sup>20</sup> (never turn off). + **`is_integrated` [`boolean`]** — If `True`, the source is the integral of the current (the [dipole moment](https://en.wikipedia.org/wiki/Electric_dipole_moment)) which is guaranteed to be zero after the current turns off. In practice, there is little difference between integrated and non-integrated sources *except* for [planewaves extending into PML](Perfectly_Matched_Layer.md#planewave-sources-extending-into-pml). Default is `False`. + **`center_frequency` [`number`]** — Optional center frequency so that the `CustomSource` can be used within an `EigenModeSource`. Defaults to 0. """ super(CustomSource, self).__init__(**kwargs) self.src_func = src_func self.start_time = start_time self.end_time = end_time self.center_frequency = center_frequency self.swigobj = mp.custom_src_time(src_func, start_time, end_time, center_frequency) self.swigobj.is_integrated = self.is_integrated
def __init__(self, src_func, start_time=-1.0e20, end_time=1.0e20, **kwargs): super(CustomSource, self).__init__(**kwargs) self.src_func = src_func self.start_time = start_time self.end_time = end_time self.swigobj = mp.custom_src_time(src_func, start_time, end_time) self.swigobj.is_integrated = self.is_integrated
def __init__(self, src_func, start_time=-1.0e20, end_time=1.0e20, center_frequency=0, **kwargs): super(CustomSource, self).__init__(**kwargs) self.src_func = src_func self.start_time = start_time self.end_time = end_time self.center_frequency = center_frequency self.swigobj = mp.custom_src_time(src_func, start_time, end_time, center_frequency) self.swigobj.is_integrated = self.is_integrated
def __init__(self, src_func, start_time=float('-inf'), end_time=float('inf')): super(CustomSource, self).__init__() self.src_func = src_func self.start_time = start_time self.end_time = end_time self.swigobj = mp.custom_src_time(src_func, start_time, end_time) self.swigobj.is_integrated = self.is_integrated