PolarDecomposition#
Input: callable or sampled 2D transition field. QUARTIC2D exposes PETAL2D’s polar-harmonic decomposition directly through its public API:
from quartic2d import PolarDecomposition
dec = PolarDecomposition(
rho_xy, x, y, Nr=181, Ntheta=256,
rmax=5.5, origin=(0.0, 0.0),
recon_err_tol=1e-4,
)
print(dec.report())
print(dec.report(level="full"))
recon_err_tol is a percentage, not a fractional error tolerance.
The decomposition class inherits its numerical implementation, constructor
parameters, reconstruction methods, and plotting from PETAL2D. Its numerical
behavior is unchanged. An object constructed with the original
petal2d.PolarDecomposition remains a valid input to QUARTIC2D transforms.
- class quartic2d.PolarDecomposition(f_xy, x, y, Nr=None, Ntheta=512, rmax=None, m_abs_max=None, recon_err_tol=1.0, radial_power_tail_fraction=1e-06, radial_relative_amplitude_threshold=0.001, origin='centroid', normalize=False, interp_method='cubic')#
Represent a real or complex 2D field using PETAL2D angular harmonics.
This class inherits the full
petal2d.PolarDecompositionconstructor and numerical API, including callable or sampled-array inputs, reconstruction, and plotting. QUARTIC2D addsreport()andto_dict()for concise inspection and numerical-method metadata. Existing PETAL2D decomposition instances remain valid inputs toquartic2d.HarmonicTransform.The
recon_err_tolconstructor argument is a percentage, unlike the fractionalrtolused in downstream convergence calibration.- Parameters:
x (np.ndarray)
y (np.ndarray)
Nr (int | None)
Ntheta (int)
rmax (float | None)
m_abs_max (int | None)
recon_err_tol (float)
radial_power_tail_fraction (float)
radial_relative_amplitude_threshold (float)
normalize (bool)
interp_method (str)
Reporting methods#
- PolarDecomposition.report(*, level='summary')#
Format the decomposition and its reconstruction diagnostics.
level='summary'shows the retained harmonics and actual measured reconstruction error.level='full'also includes input-grid ranges, decomposition settings, mode cutoffs, and recorded software versions. This does not assess the accuracy of the original supplied field.- Parameters:
level (str)
- Return type:
str
- PolarDecomposition.to_dict()#
Return JSON-serializable decomposition settings and diagnostics.
This is a numerical-method metadata record, not an export of the full input field or every radial harmonic profile. Those remain accessible on the decomposition object itself.
- Return type:
dict[str, Any]
The summary report shows retained harmonics, the harmonic-selection target,
and measured reconstruction error. The full report includes available grid
information, input settings, per-harmonic cutoff radii, and software versions.
to_dict() saves JSON-compatible numerical-method metadata, not the
original field or all radial profiles.
The accuracy of an upstream sampled field is outside the scope of the
harmonic-selection test. Downstream convergence is performed separately with
HarmonicTransform.converge_parameters().