aub_htp.pdf.pdf#

Functions

alpha_stable_pdf_core(X, alpha, beta, gamma, ...)

Core density on the normalized grid (unit scale).

generate_alpha_stable_pdf(X, alpha, beta, ...)

generate_alpha_stable_pdf_wrap(X, alpha, ...)

Public pdf wrapper with boundary padding and spike cleanup.

generate_pdf_alpha_equal_1(X, beta)

α = 1 pdf via characteristic function integral (vectorized).

generate_pdf_alpha_greater_1(X, alpha, beta)

Piecewise pdf for 1 < alpha ≤ 2. - Choose among: • Skorohod tail series (formula 3) with N terms • S0 CF integral for mid and near-zero ranges • Optional Zolotarev region; near α≈1 prefer S0 for stability - For x<0 reflect with beta -> -beta and reuse logic.

generate_pdf_alpha_less_1(X, alpha, beta)

Piecewise pdf for 0 < alpha < 1. - Choose among: • Skorohod tail series (formula 1) for large |x| • Zolotarev integral (Type B) for mid range • CF integral in S0 for near zero - Thresholds (x_min) are read from pickled interpolators per (alpha,beta). - Handle x<0 by reflection with beta -> -beta. - Force pdf(0)=0 when beta is ±1 (one-sided support in the limit).

get_alpha_stable_pdf_interpolator(alpha, beta)

load_interpolator(name)

Load a RegularGridInterpolator from an npz file.

normalize_inputs(X, alpha, beta, gamma, delta)

Normalize to unit scale for S1-style behavior.

pad_grid(X[, left_pts, right_pts, growth])

Geometric padding for spike smoothing at boundaries. - Extend the grid on both sides using a geometric step growth. - Return: • X_pad: padded grid (ascending) • core_slice: slice to map back to original region.

remove_all_monotonicity_spikes(x_vals, pdf_vals)

Fix bumps on both sides of the mode.

remove_left_monotonicity_spikes(x_vals, pdf_vals)

Fix non-monotone bumps on the rising side (left of the mode). Strategy: - Find the mode index. - Scan leftwards. Whenever f[i] >= f[i+1] (violation of strict increase), locate a left boundary where the increase resumes and a right boundary where increase resumes after the bump. - Linearly interpolate between those two anchors.

aub_htp.pdf.pdf.alpha_stable_pdf_core(X, alpha, beta, gamma, delta)#

Core density on the normalized grid (unit scale). Steps: - Normalize inputs to S1-like domain. - Compute piecewise pdf by alpha regime. - Apply spike removal on the full normalized domain. - Zero-out the forbidden side for extreme skew in α<1. - Return scaled density (divide by gamma).

aub_htp.pdf.pdf.generate_alpha_stable_pdf(X, alpha, beta, gamma, delta)#
aub_htp.pdf.pdf.generate_alpha_stable_pdf_wrap(X, alpha, beta, gamma, delta, pad_left=10, pad_right=10, growth=1.05)#

Public pdf wrapper with boundary padding and spike cleanup. Pipeline: 1) Pad the query grid (stabilizes denoising near edges). 2) Evaluate normalized core density. 3) Remove monotonicity spikes on padded grid. 4) Slice back to the original grid. 5) Return density.

aub_htp.pdf.pdf.generate_pdf_alpha_equal_1(X, beta)#

α = 1 pdf via characteristic function integral (vectorized). f(x) = (1/π) ∫_0^∞ e^{-t} cos( x t + (2/π) β t log t ) dt

aub_htp.pdf.pdf.generate_pdf_alpha_greater_1(X, alpha, beta)#

Piecewise pdf for 1 < alpha ≤ 2. - Choose among:

  • Skorohod tail series (formula 3) with N terms

  • S0 CF integral for mid and near-zero ranges

  • Optional Zolotarev region; near α≈1 prefer S0 for stability

  • For x<0 reflect with beta -> -beta and reuse logic.

aub_htp.pdf.pdf.generate_pdf_alpha_less_1(X, alpha, beta)#

Piecewise pdf for 0 < alpha < 1. - Choose among:

  • Skorohod tail series (formula 1) for large |x|

  • Zolotarev integral (Type B) for mid range

  • CF integral in S0 for near zero

  • Thresholds (x_min) are read from pickled interpolators per (alpha,beta).

  • Handle x<0 by reflection with beta -> -beta.

  • Force pdf(0)=0 when beta is ±1 (one-sided support in the limit).

aub_htp.pdf.pdf.get_alpha_stable_pdf_interpolator(alpha, beta)#
aub_htp.pdf.pdf.load_interpolator(name: str) RegularGridInterpolator#

Load a RegularGridInterpolator from an npz file.

The npz file should contain: - grid_0, grid_1: 1D arrays defining the interpolation grid axes - values: 2D array of values on the grid - method: interpolation method (e.g. ‘linear’) - bounds_error: whether to raise error for out-of-bounds - fill_value: value for out-of-bounds points - fill_value_is_none: whether fill_value should be None

aub_htp.pdf.pdf.normalize_inputs(X, alpha, beta, gamma, delta)#

Normalize to unit scale for S1-style behavior. - When alpha==1, apply the log shift to preserve centering. - Return Z = (X - shift)/gamma and the shift used (for diagnostics).

aub_htp.pdf.pdf.pad_grid(X, left_pts=5, right_pts=5, growth=1.08)#

Geometric padding for spike smoothing at boundaries. - Extend the grid on both sides using a geometric step growth. - Return:

  • X_pad: padded grid (ascending)

  • core_slice: slice to map back to original region

aub_htp.pdf.pdf.remove_all_monotonicity_spikes(x_vals, pdf_vals)#

Fix bumps on both sides of the mode. - Clean the left side by direct scan. - Reverse, reuse the same routine, then flip back to fix the right side.

aub_htp.pdf.pdf.remove_left_monotonicity_spikes(x_vals, pdf_vals)#

Fix non-monotone bumps on the rising side (left of the mode). Strategy: - Find the mode index. - Scan leftwards. Whenever f[i] >= f[i+1] (violation of strict increase),

locate a left boundary where the increase resumes and a right boundary where increase resumes after the bump.

  • Linearly interpolate between those two anchors.