`add_energy(fcen, df, nfreq, freq, EnergyRegions, decimation_factor=0)` ##sig Add a bunch of `EnergyRegion`s to the current simulation (initializing the fields if they have not yet been initialized), telling Meep to accumulate the appropriate field Fourier transfor
(self, *args, **kwargs)
| 3120 | ) |
| 3121 | |
| 3122 | def add_energy(self, *args, **kwargs): |
| 3123 | """ |
| 3124 | `add_energy(fcen, df, nfreq, freq, EnergyRegions, decimation_factor=0)` ##sig |
| 3125 | |
| 3126 | Add a bunch of `EnergyRegion`s to the current simulation (initializing the fields |
| 3127 | if they have not yet been initialized), telling Meep to accumulate the appropriate |
| 3128 | field Fourier transforms for `nfreq` equally spaced frequencies covering the |
| 3129 | frequency range `fcen-df/2` to `fcen+df/2` or an array/list `freq` for arbitrarily |
| 3130 | spaced frequencies. Return an *energy object*, which you can pass to the functions |
| 3131 | below to get the energy spectrum, etcetera. To reduce the memory-bandwidth burden of |
| 3132 | accumulating DFT fields, an integer `decimation_factor` can be specified for updating the DFT |
| 3133 | fields at every `decimation_factor` timesteps. If `decimation_factor` is 0 (the default), |
| 3134 | this value is automatically determined from the |
| 3135 | [Nyquist rate](https://en.wikipedia.org/wiki/Nyquist_rate) of the bandwidth-limited |
| 3136 | sources and this DFT monitor. It can be turned off by setting it to 1. Use this feature |
| 3137 | with care, as the decimated timeseries may be corrupted by |
| 3138 | [aliasing](https://en.wikipedia.org/wiki/Aliasing) of high frequencies. |
| 3139 | """ |
| 3140 | args = fix_dft_args(args, 0) |
| 3141 | freq = args[0] |
| 3142 | energys = args[1:] |
| 3143 | decimation_factor = kwargs.get("decimation_factor", 0) |
| 3144 | en = DftEnergy(self._add_energy, [freq, energys, decimation_factor]) |
| 3145 | self.dft_objects.append(en) |
| 3146 | return en |
| 3147 | |
| 3148 | def _add_energy(self, freq, energys, decimation_factor): |
| 3149 | if self.fields is None: |