decipher.diversity

Hill-number diversity family with coverage standardisation and bootstrap confidence intervals.

function decipher.diversity.hill_numbers
def hill_numbers(counts: Sequence[int], q: float) -> float

Asymptotic estimator for Hill number of order q. q = 0 → Chao1 richness; q = 1 → Chao-Shen Shannon effective number; q = 2 → unbiased inverse Simpson.

function decipher.diversity.coverage_estimator
def coverage_estimator(counts: Sequence[int]) -> float

Good-Turing sample coverage in [0, 1]: 1 − f₁ / N, with appropriate handling of edge cases.

function decipher.diversity.estimate_d_at_coverage
def estimate_d_at_coverage(
    counts: Sequence[int],
    q: float,
    coverage: float,
) -> float

Hill number of order q at a target sample coverage. Interpolates (rarefaction) or extrapolates as needed — the iNEXT recipe in pure NumPy.

function decipher.diversity.hill_bootstrap_ci
def hill_bootstrap_ci(
    counts: Sequence[int],
    q: float,
    coverage: float,
    n_boot: int = 1000,
    alpha: float = 0.05,
    rng_seed: int = 42,
) -> tuple[float, float]

Multinomial bootstrap CI for the coverage-standardised Hill number.