Skip to content

Commit 74c9752

Browse files
authored
decimation option for remaining DFT functions (#1720)
* add decimation factor to add_dft_flux * some fixes * fixes * fixes, unit tests, docs * update markdown pages for user manual * increase tolerance of failing unit test in test_bend_flux.py * fix add_dft_near2far function header
1 parent 9509547 commit 74c9752

14 files changed

+311
-144
lines changed

doc/docs/Python_User_Interface.md

Lines changed: 84 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -534,10 +534,29 @@ def mean_time_spent_on(self, time_sink):
534534
<div class="method_docstring" markdown="1">
535535

536536
Return the mean time spent by all processes for a type of work `time_sink` which
537-
can be one of ten integer values `0`-`9`: (`0`) connecting chunks, (`1`) time stepping,
538-
(`2`) copying boundaries, (`3`) MPI all-to-all communication/synchronization,
539-
(`4`) MPI one-to-one communication, (`5`) field output, (`6`) Fourier transforming,
540-
(`7`) MPB mode solver, (`8`) near-to-far field transformation, and (`9`) other.
537+
can be one of the following integer constants:
538+
* meep.Stepping ("time stepping")
539+
* meep.Connecting ("connecting chunks")
540+
* meep.Boundaries ("copying boundaries")
541+
* meep.MpiAllTime ("all-all communication")
542+
* meep.MpiOneTime ("1-1 communication")
543+
* meep.FieldOutput ("outputting fields")
544+
* meep.FourierTransforming ("Fourier transforming")
545+
* meep.MPBTime ("MPB mode solver")
546+
* meep.GetFarfieldsTime ("far-field transform")
547+
* meep.FieldUpdateB ("updating B field")
548+
* meep.FieldUpdateH ("updating H field")
549+
* meep.FieldUpdateD ("updating D field")
550+
* meep.FieldUpdateE ("updating E field")
551+
* meep.BoundarySteppingB ("boundary stepping B")
552+
* meep.BoundarySteppingWH ("boundary stepping WH")
553+
* meep.BoundarySteppingPH ("boundary stepping PH")
554+
* meep.BoundarySteppingH ("boundary stepping H")
555+
* meep.BoundarySteppingD ("boundary stepping D")
556+
* meep.BoundarySteppingWE ("boundary stepping WE")
557+
* meep.BoundarySteppingPE ("boundary stepping PE")
558+
* meep.BoundarySteppingE ("boundary stepping E")
559+
* meep.Other ("everything else")
541560

542561
</div>
543562

@@ -726,16 +745,16 @@ fields for `nfreq` equally spaced frequencies covering the frequency range
726745
`fcen-df/2` to `fcen+df/2` or an array/list `freq` for arbitrarily spaced
727746
frequencies over the `Volume` specified by `where` (default to the entire cell).
728747
The volume can also be specified via the `center` and `size` arguments. The
729-
default routine interpolates the Fourier transformed fields at the center of each
730-
voxel within the specified volume. Alternatively, the exact Fourier transformed
748+
default routine interpolates the Fourier-transformed fields at the center of each
749+
voxel within the specified volume. Alternatively, the exact Fourier-transformed
731750
fields evaluated at each corresponding Yee grid point is available by setting
732-
`yee_grid` to `True`. To reduce the memory bandwidth burden of
751+
`yee_grid` to `True`. To reduce the memory-bandwidth burden of
733752
accumulating DFT fields, an integer `decimation_factor` >= 1 can be
734753
specified. DFT field values are updated every `decimation_factor`
735-
timesteps. Use this experimental feature with care, as the decimated
736-
timeseries may be corruped by aliasing of high frequencies. The choice
737-
of decimation factor should take the properties of all sources in the
738-
simulation and the frequency range of the DFT field monitor into account.
754+
timesteps. Use this feature with care, as the decimated timeseries may be
755+
corrupted by [aliasing](https://en.wikipedia.org/wiki/Aliasing) of high frequencies.
756+
The choice of decimation factor should take into account the properties of all sources
757+
in the simulation as well as the frequency range of the DFT field monitor.
739758

740759
</div>
741760

@@ -1009,7 +1028,9 @@ def reset_meep(self):
10091028
<div class="method_docstring" markdown="1">
10101029

10111030
Reset all of Meep's parameters, deleting the fields, structures, etcetera, from
1012-
memory as if you had not run any computations.
1031+
memory as if you had not run any computations. If the `num_chunks` or `chunk_layout`
1032+
attributes have been modified internally, they are reset to their original
1033+
values passed in at instantiation.
10131034

10141035
</div>
10151036

@@ -1094,8 +1115,8 @@ Given a bunch of [`FluxRegion`](#fluxregion) objects, you can tell Meep to accum
10941115
<div class="class_members" markdown="1">
10951116

10961117
```python
1097-
def add_flux(self, *args):
1098-
def add_flux(fcen, df, nfreq, freq, FluxRegions...):
1118+
def add_flux(self, *args, **kwargs):
1119+
def add_flux(fcen, df, nfreq, freq, FluxRegions, decimation_factor=1):
10991120
```
11001121

11011122
<div class="method_docstring" markdown="1">
@@ -1106,7 +1127,13 @@ they have not yet been initialized), telling Meep to accumulate the appropriate
11061127
field Fourier transforms for `nfreq` equally spaced frequencies covering the
11071128
frequency range `fcen-df/2` to `fcen+df/2` or an array/list `freq` for arbitrarily
11081129
spaced frequencies. Return a *flux object*, which you can pass to the functions
1109-
below to get the flux spectrum, etcetera.
1130+
below to get the flux spectrum, etcetera. To reduce the memory-bandwidth burden of
1131+
accumulating DFT fields, an integer `decimation_factor` >= 1 can be
1132+
specified. DFT field values are updated every `decimation_factor`
1133+
timesteps. Use this feature with care, as the decimated timeseries may be
1134+
corrupted by [aliasing](https://en.wikipedia.org/wiki/Aliasing) of high frequencies.
1135+
The choice of decimation factor should take into account the properties of all sources
1136+
in the simulation as well as the frequency range of the DFT field monitor.
11101137

11111138
</div>
11121139

@@ -1482,8 +1509,8 @@ The usage is similar to the flux spectra: you define a set of [`EnergyRegion`](#
14821509
<div class="class_members" markdown="1">
14831510

14841511
```python
1485-
def add_energy(self, *args):
1486-
def add_energy(fcen, df, nfreq, freq, EnergyRegions...):
1512+
def add_energy(self, *args, **kwargs):
1513+
def add_energy(fcen, df, nfreq, freq, EnergyRegions, decimation_factor=1):
14871514
```
14881515

14891516
<div class="method_docstring" markdown="1">
@@ -1494,7 +1521,13 @@ if they have not yet been initialized), telling Meep to accumulate the appropria
14941521
field Fourier transforms for `nfreq` equally spaced frequencies covering the
14951522
frequency range `fcen-df/2` to `fcen+df/2` or an array/list `freq` for arbitrarily
14961523
spaced frequencies. Return an *energy object*, which you can pass to the functions
1497-
below to get the energy spectrum, etcetera.
1524+
below to get the energy spectrum, etcetera. To reduce the memory-bandwidth burden of
1525+
accumulating DFT fields, an integer `decimation_factor` >= 1 can be
1526+
specified. DFT field values are updated every `decimation_factor`
1527+
timesteps. Use this feature with care, as the decimated timeseries may be
1528+
corrupted by [aliasing](https://en.wikipedia.org/wiki/Aliasing) of high frequencies.
1529+
The choice of decimation factor should take into account the properties of all sources
1530+
in the simulation as well as the frequency range of the DFT field monitor.
14981531

14991532
</div>
15001533

@@ -1708,8 +1741,8 @@ The usage is similar to the [flux spectra](Python_Tutorials/Basics.md#transmitta
17081741
<div class="class_members" markdown="1">
17091742

17101743
```python
1711-
def add_force(self, *args):
1712-
def add_force(fcen, df, nfreq, freq, ForceRegions...):
1744+
def add_force(self, *args, **kwargs):
1745+
def add_force(fcen, df, nfreq, freq, ForceRegions, decimation_factor=1):
17131746
```
17141747

17151748
<div class="method_docstring" markdown="1">
@@ -1720,7 +1753,13 @@ if they have not yet been initialized), telling Meep to accumulate the appropria
17201753
field Fourier transforms for `nfreq` equally spaced frequencies covering the
17211754
frequency range `fcen-df/2` to `fcen+df/2` or an array/list `freq` for arbitrarily
17221755
spaced frequencies. Return a `force`object, which you can pass to the functions
1723-
below to get the force spectrum, etcetera.
1756+
below to get the force spectrum, etcetera. To reduce the memory-bandwidth burden of
1757+
accumulating DFT fields, an integer `decimation_factor` >= 1 can be
1758+
specified. DFT field values are updated every `decimation_factor`
1759+
timesteps. Use this feature with care, as the decimated timeseries may be
1760+
corrupted by [aliasing](https://en.wikipedia.org/wiki/Aliasing) of high frequencies.
1761+
The choice of decimation factor should take into account the properties of all sources
1762+
in the simulation as well as the frequency range of the DFT field monitor.
17241763

17251764
</div>
17261765

@@ -1988,7 +2027,7 @@ There are three steps to using the near-to-far-field feature: first, define the
19882027

19892028
```python
19902029
def add_near2far(self, *args, **kwargs):
1991-
def add_near2far(fcen, df, nfreq, freq, Near2FarRegions..., nperiods=1):
2030+
def add_near2far(fcen, df, nfreq, freq, Near2FarRegions, nperiods=1, decimation_factor=1):
19922031
```
19932032

19942033
<div class="method_docstring" markdown="1">
@@ -1999,7 +2038,13 @@ fields if they have not yet been initialized), telling Meep to accumulate the
19992038
appropriate field Fourier transforms for `nfreq` equally spaced frequencies
20002039
covering the frequency range `fcen-df/2` to `fcen+df/2` or an array/list `freq`
20012040
for arbitrarily spaced frequencies. Return a `near2far` object, which you can pass
2002-
to the functions below to get the far fields.
2041+
to the functions below to get the far fields. To reduce the memory-bandwidth burden of
2042+
accumulating DFT fields, an integer `decimation_factor` >= 1 can be
2043+
specified. DFT field values are updated every `decimation_factor`
2044+
timesteps. Use this feature with care, as the decimated timeseries may be
2045+
corrupted by [aliasing](https://en.wikipedia.org/wiki/Aliasing) of high frequencies.
2046+
The choice of decimation factor should take into account the properties of all sources
2047+
in the simulation as well as the frequency range of the DFT field monitor.
20032048

20042049
</div>
20052050

@@ -7366,6 +7411,22 @@ of processes.
73667411

73677412
</div>
73687413

7414+
<a id="BinaryPartition.print"></a>
7415+
7416+
<div class="class_members" markdown="1">
7417+
7418+
```python
7419+
def print(self):
7420+
```
7421+
7422+
<div class="method_docstring" markdown="1">
7423+
7424+
Pretty-prints the tree structure of the BinaryPartition object.
7425+
7426+
</div>
7427+
7428+
</div>
7429+
73697430
Miscellaneous Functions Reference
73707431
---------------------------------
73717432

0 commit comments

Comments
 (0)