`dft_ldos(fcen=None, df=None, nfreq=None, freq=None, ldos=None)` ##sig Compute the power spectrum of the sources (usually a single point dipole source), normalized to correspond to the LDOS, in either a frequency bandwidth `df` centered at `fcen` and `nfreq` equally spaced freque
(*args, **kwargs)
| 6005 | |
| 6006 | |
| 6007 | def dft_ldos(*args, **kwargs): |
| 6008 | """ |
| 6009 | `dft_ldos(fcen=None, df=None, nfreq=None, freq=None, ldos=None)` ##sig |
| 6010 | |
| 6011 | Compute the power spectrum of the sources (usually a single point dipole source), |
| 6012 | normalized to correspond to the LDOS, in either a frequency bandwidth `df` centered at |
| 6013 | `fcen` and `nfreq` equally spaced frequency points or an array/list `freq` for |
| 6014 | arbitrarily spaced frequencies. One can also pass in an `Ldos` object as |
| 6015 | `dft_ldos(ldos=my_Ldos)`. |
| 6016 | |
| 6017 | The resulting spectrum is outputted as comma-delimited text, prefixed by `ldos:,`, and |
| 6018 | is also stored in the `ldos_data` variable of the `Simulation` object after the `run` |
| 6019 | is complete. The Fourier-transformed electric field and current source are stored in |
| 6020 | the `ldos_Fdata` and `ldos_Jdata` of the `Simulation` object, respectively. |
| 6021 | """ |
| 6022 | ldos = kwargs.get("ldos", None) |
| 6023 | if ldos is None: |
| 6024 | args = fix_dft_args(args, 0) |
| 6025 | freq = args[0] |
| 6026 | if isinstance(freq, (np.ndarray, list)): |
| 6027 | ldos = mp._dft_ldos(freq) |
| 6028 | else: |
| 6029 | raise TypeError( |
| 6030 | "dft_ldos only accepts freq_min,freq_max,nfreq (3 numbers) or freq (array/list) or ldos (keyword argument)" |
| 6031 | ) |
| 6032 | |
| 6033 | def _ldos(sim, todo): |
| 6034 | if todo == "step": |
| 6035 | ldos.update(sim.fields) |
| 6036 | else: |
| 6037 | sim.ldos_data = mp._dft_ldos_ldos(ldos) |
| 6038 | sim.ldos_Fdata = mp._dft_ldos_F(ldos) |
| 6039 | sim.ldos_Jdata = mp._dft_ldos_J(ldos) |
| 6040 | sim.ldos_scale = ldos.overall_scale() |
| 6041 | if verbosity.meep > 0: |
| 6042 | display_csv(sim, "ldos", zip(mp.get_ldos_freqs(ldos), sim.ldos_data)) |
| 6043 | |
| 6044 | return _ldos |
| 6045 | |
| 6046 | |
| 6047 | def scale_flux_fields(s, flux): |
nothing calls this directly
no test coverage detected