healpix_analyse.divcurl#
Local, gauge-aware divergence and curl on multiscale HEALPix maps.
The differential stencil is evaluated by HealPixConv. Horizontal
east/north components are first embedded in a global Cartesian tangent vector.
This makes the sampled channels independent of the local coordinate frame.
Two fixed derivative-of-Gaussian kernels then estimate directional derivatives
along the gauge axes, which are contracted to the intrinsic surface divergence
and outward-normal scalar curl.
Classes#
List-like divergence/curl maps returned for a HEALPix pyramid. |
|
Estimate divergence and curl at one HEALPix resolution. |
|
Apply |
Module Contents#
- class healpix_analyse.divcurl.HealPixDivCurlPyramid[source]#
Bases:
Sequence[ArrayLike]List-like divergence/curl maps returned for a HEALPix pyramid.
Every band has shape
[..., 2, N_j]after gauge reduction, with channel zero containing divergence and channel one containing curl. Withgauge_reduce="none", the shape is[..., G, 2, N_j].- cell_ids: tuple[numpy.ndarray, ...]#
- class healpix_analyse.divcurl.HealPixDivCurl(level: int, cell_ids=None, *, kernel_sz: int = 3, sigma_pix: float | None = None, n_gauges: int = 1, gauge_type: str = 'phi', gauge_reduce: str = 'mean', radius_m: float = 6371008.8, singularity_lonlat=None, ref_direction=None, ellipsoid: str = 'sphere', dtype: torch.dtype = torch.float32, device: str | torch.device | None = None, cache_dir=_DEFAULT_CACHE_DIR)[source]#
Bases:
torch.nn.ModuleEstimate divergence and curl at one HEALPix resolution.
- Parameters:
level (
int) – Grid4Earth/HEALPix level, withnside = 2**level.cell_ids (
array-like, optional) – NESTED identifiers in the same order as the input velocity samples.Noneselects the full sphere.kernel_sz (
int, default3) – Odd derivative-of-Gaussian stencil size. Must be at least three.sigma_pix (
float, optional) – Gaussian width in native pixels. The default iskernel_sz / 3.n_gauges (
int, default1) – Number of rotated HealPixConv gauges. Multiple gauges provide orientation-averaged estimates whengauge_reduce="mean".gauge_type (
str, default"phi") – Gauge convention passed directly toHealPixConv.gauge_reduce (
{"mean", "none"}, default"mean") – Average the gauge estimates or retain an explicit gauge dimension.radius_m (
float, default6371008.8) – Sphere radius used to convert the angular native-pixel spacing to metres. Velocity in m/s then produces divergence and curl in 1/s.
Notes
Input channels are eastward
uand northwardv. They are embedded as a three-component Cartesian tangent vector before convolution. Ifaandbare the two oriented gauge axes andVis this vector, the returned scalars arediv = a . d_a(V) + b . d_b(V)curl = b . d_a(V) - a . d_b(V).This contraction includes the change of the local vector basis implicitly and is invariant to a simultaneous rotation of the derivative stencil and gauge frame, apart from interpolation/discretisation errors.
- level#
- nside#
- kernel_sz = 3#
- sigma_pix#
- n_gauges = 1#
- gauge_type = ''#
- gauge_reduce = 'mean'#
- radius_m#
- ellipsoid = ''#
- dtype = Ellipsis#
- partial#
- n_pixels#
- pixel_spacing_rad#
- pixel_spacing_m#
- conv#
- property device: torch.device#
- property cell_ids: numpy.ndarray#
- property derivative_kernels: tuple[torch.Tensor, torch.Tensor]#
Fixed physical derivative kernels along the two gauge axes.
- class healpix_analyse.divcurl.HealPixMultiScaleDivCurl(decomp: healpix_analyse.decomp.HealPixDecomp, *, kernel_sz: int = 3, sigma_pix: float | None = None, n_gauges: int = 1, gauge_type: str = 'phi', gauge_reduce: str = 'mean', radius_m: float = 6371008.8, singularity_lonlat=None, ref_direction=None, ellipsoid: str | None = None, dtype: torch.dtype | None = None, device: str | torch.device | None = None, cache_dir=_DEFAULT_CACHE_DIR)[source]#
Bases:
torch.nn.ModuleApply
HealPixDivCurlto every band of a decomposition.The native pixel spacing doubles approximately at every Down operation. Each derivative kernel is divided by its own physical spacing, making the returned values comparable and expressed in the same physical units.
- levels#
- cell_ids_per_scale#
- n_bands#
- gauge_reduce = 'mean'#
- layers#
- pixel_spacing_m#
- forward(pyramid: healpix_analyse.decomp.HealPixPyramid | Sequence[ArrayLike]) HealPixDivCurlPyramid[source]#
Return one divergence/curl map for every native-resolution band.
- compute(pyramid: healpix_analyse.decomp.HealPixPyramid | Sequence[ArrayLike]) HealPixDivCurlPyramid[source]#
Alias for
forward().