Functions | |
| _drop_imported_package (str package_name) | |
| Remove a failed/partial import package tree from sys.modules. | |
| _prune_incompatible_python_site_paths (paths) | |
| Remove site-package paths for a different Python major/minor version. | |
| require_numpy () | |
| Import NumPy with the same compatibility retry used by the conductor. | |
| validate_spectral_grid (nodes, transform_axes=(0, 1, 2), subject="spectra require") | |
| Validate the uniform axis-aligned Cartesian grid an FFT on periodic axes requires. | |
| spectral_symbols (cells_kji, lengths_xyz) | |
| Build continuum and centered-discrete Fourier symbols. | |
| _resample_axis (values, storage_axis, target_count, length, shift) | |
| Move one periodic axis of an array of samples to another uniform resolution. | |
| filter_transfer (continuum_symbols, filter_spec) | |
| Transfer function of a resampling filter on the target grid's wavenumbers. | |
| fourier_resample (values, target_cells_kji, lengths_xyz, source_first_xyz, target_first_xyz, filter_spec=None) | |
| Resample a triply periodic vector field onto another uniform grid, optionally filtered. | |
Variables | |
| tuple | RESAMPLE_FILTERS = ("none", "sharp", "gaussian", "box") |
|
protected |
Remove a failed/partial import package tree from sys.modules.
| [in] | package_name | Top-level package name. |
Definition at line 16 of file periodic_spectral.py.
|
protected |
Remove site-package paths for a different Python major/minor version.
| [in] | paths | Candidate sys.path entries. |
Definition at line 27 of file periodic_spectral.py.
| periodic_spectral.require_numpy | ( | ) |
Import NumPy with the same compatibility retry used by the conductor.
Definition at line 53 of file periodic_spectral.py.
| periodic_spectral.validate_spectral_grid | ( | nodes, | |
transform_axes = (0, 1, 2), |
|||
subject = "spectra require" |
|||
| ) |
Validate the uniform axis-aligned Cartesian grid an FFT on periodic axes requires.
| [in] | nodes | PICGRID node-coordinate array shaped (KM, JM, IM, 3). |
| [in] | transform_axes | Cartesian axes that are transformed and so must be uniform; the remaining axes may stretch. |
| [in] | subject | What needs the grid and its verb, opening each error message. |
Definition at line 79 of file periodic_spectral.py.
| periodic_spectral.spectral_symbols | ( | cells_kji, | |
| lengths_xyz | |||
| ) |
Build continuum and centered-discrete Fourier symbols.
| [in] | cells_kji | Cell counts in storage order. |
| [in] | lengths_xyz | Physical box lengths in Cartesian order. |
Definition at line 107 of file periodic_spectral.py.
|
protected |
Move one periodic axis of an array of samples to another uniform resolution.
The samples are read as a truncated Fourier series, which is re-evaluated at the target points. Modes are kept only where both resolutions represent them unambiguously, |m| < min(N, M)/2, so each Nyquist mode is dropped and the result stays real.
| [in] | values | Real samples; storage_axis is the axis being moved. |
| [in] | storage_axis | Array axis to resample. |
| [in] | target_count | Number of target samples along that axis. |
| [in] | length | Physical period of the axis. |
| [in] | shift | Target first-sample position minus source first-sample position. |
target_count points along storage_axis. Definition at line 129 of file periodic_spectral.py.
| periodic_spectral.filter_transfer | ( | continuum_symbols, | |
| filter_spec | |||
| ) |
Transfer function of a resampling filter on the target grid's wavenumbers.
| [in] | continuum_symbols | Continuum (kx, ky, kz) from spectral_symbols(). |
| [in] | filter_spec | Mapping with type in RESAMPLE_FILTERS; sharp takes cutoff (a wavenumber), gaussian and box take width (the filter width Delta, a length). |
none. Definition at line 161 of file periodic_spectral.py.
| periodic_spectral.fourier_resample | ( | values, | |
| target_cells_kji, | |||
| lengths_xyz, | |||
| source_first_xyz, | |||
| target_first_xyz, | |||
filter_spec = None |
|||
| ) |
Resample a triply periodic vector field onto another uniform grid, optionally filtered.
Exact for band-limited data: every mode both grids resolve is carried over with its amplitude and phase, then the filter multiplies its transfer function. Each axis is moved separately, so memory stays at one array of the larger size.
| [in] | values | Real samples [k, j, i, component] of the source field. |
| [in] | target_cells_kji | Target sample counts in storage order. |
| [in] | lengths_xyz | Physical periods, shared by source and target, in Cartesian order. |
| [in] | source_first_xyz | Position of the first source sample on each axis, relative to the box origin. |
| [in] | target_first_xyz | Position of the first target sample on each axis. |
| [in] | filter_spec | Optional filter mapping for filter_transfer(). |
[k, j, i, component]. Definition at line 186 of file periodic_spectral.py.
| tuple periodic_spectral.RESAMPLE_FILTERS = ("none", "sharp", "gaussian", "box") |
Definition at line 126 of file periodic_spectral.py.