pyvale.validation.ecdftypes module

ECDF records, epistemic reductions and shifted support bounds.

class ECDF(quants, probs)[source]

Bases: object

Borrow support/probabilities, each shaped (n_support,).

Support and cumulative probabilities increase strictly; probabilities end at one. Arrays must remain unchanged while the ECDF is in use.

Variables:
  • quants (ndarray) – Strictly increasing observed support points of shape (n_support,), in observable units.

  • probs (ndarray) – Strictly increasing cumulative mass of shape (n_support,), ending at one and aligned with quants.

quants
probs
__init__(quants, probs)
class EECDFReduce(*values)[source]

Bases: Enum

Operations that reduce an epistemic axis at fixed cumulative probability.

KEEP = 1
MEAN = 2
MEDIAN = 3
QUANTILE = 4
class ECDFViewSel(trans_reduce=EECDFReduce.KEEP, nuis_reduce=EECDFReduce.KEEP, trans_quantile=None, nuis_quantile=None, trans_idxs=None, nuis_idxs=None)[source]

Bases: object

Select epistemic cases before nuisance-first quantile reduction.

None index selections retain every index. Offsets are selected separately.

Variables:
  • trans_reduce (EECDFReduce) – Reduction applied to the transferable axis after the nuisance reduction.

  • nuis_reduce (EECDFReduce) – Reduction applied first, separately within each transferable case.

  • trans_quantile (float or None) – Quantile level in [0, 1] for a transferable QUANTILE reduction.

  • nuis_quantile (float or None) – Quantile level in [0, 1] for a nuisance QUANTILE reduction.

  • trans_idxs (tuple[int, ] or None) – Transferable case indices in selection order. Use None for all cases.

  • nuis_idxs (tuple[int, ] or None) – Nuisance case indices in selection order. Use None for all cases.

trans_reduce
nuis_reduce
trans_quantile
nuis_quantile
trans_idxs
nuis_idxs
__init__(trans_reduce=EECDFReduce.KEEP, nuis_reduce=EECDFReduce.KEEP, trans_quantile=None, nuis_quantile=None, trans_idxs=None, nuis_idxs=None)
class ECDFView(probs, quants, orig_quants, orig_epis_offsets, samples, opts)[source]

Bases: object

Quantiles on a shared probability grid, retaining singleton reduced axes.

quants has axes (transferable, nuisance, offset, probability). orig_quants has the same axis order before reduction. orig_epis_offsets and samples follow the flattened (transferable, nuisance, offset) order.

Variables:
  • probs (ndarray) – Shared cumulative probability grid of shape (n_probs,).

  • quants (ndarray) – Reduced quantiles of shape (n_trans, n_nuis, n_offsets, n_probs); reduced axes have length one.

  • orig_quants (ndarray) – Quantiles before reduction, in the same axis order as quants.

  • orig_epis_offsets (tuple[tuple[int, int, EEpisOffset], ]) – Original (transferable index, nuisance index, offset) for each flattened original curve.

  • samples (tuple[ndarray, ]) – Original one-dimensional aleatory sample arrays, ordered like orig_epis_offsets.

  • opts (ECDFViewSel) – Selection and reduction settings used to produce the view.

probs
quants
orig_quants
orig_epis_offsets
samples
opts
__init__(probs, quants, orig_quants, orig_epis_offsets, samples, opts)
class ECDFEpisBounds(lower, upper, lower_indices, upper_indices, view)[source]

Bases: object

Pointwise quantile limits and their controlling epistemic indices.

Index columns are (transferable, nuisance, offset). A reduced axis has index -1. The source view retains inputs for confidence calculations.

Variables:
  • lower (ndarray) – Lowest quantile at each grid probability, with shape (n_probs,).

  • upper (ndarray) – Highest quantile at each grid probability, with shape (n_probs,).

  • lower_indices (ndarray) – Controlling lower-case labels of shape (n_probs, 3).

  • upper_indices (ndarray) – Controlling upper-case labels of shape (n_probs, 3).

  • view (ECDFView) – Source view, including original samples used for confidence calculations.

lower
upper
lower_indices
upper_indices
view
__init__(lower, upper, lower_indices, upper_indices, view)
class EECDFBoundAxis(*values)[source]

Bases: Enum

Identify the simulation and experiment bound choices in endpoint comparisons.

SIM_BOUND = 1
EXP_BOUND = 2
class ECDFMetricBounds(axes, probs, lower, upper, sim_lower, sim_upper, index_axes, lower_indices, upper_indices, selectors, metric_outputs=None, metric=None)[source]

Bases: object

Shifted quantile limits, with controlling original comparison indices.

lower/upper and unshifted limits have shape (*retained_axes, probability). Origin indices append an index_axes dimension; NaN limits have index -1. Probability grids exclude zero: the first quantile also applies down to zero.

Variables:
  • axes (tuple[EValidResAxis, ]) – Retained result axes leading the probability dimension.

  • probs (ndarray) – Shared cumulative probability grid of shape (n_probs,).

  • lower (ndarray) – Metric-shifted lower quantiles of shape (*retained_shape, n_probs).

  • upper (ndarray) – Metric-shifted upper quantiles with the same shape as lower.

  • sim_lower (ndarray) – Unshifted lower simulation quantiles with the same shape as lower.

  • sim_upper (ndarray) – Unshifted upper simulation quantiles with the same shape as upper.

  • index_axes (tuple[EValidResAxis or EECDFBoundAxis, ]) – Labels for the final dimension of the controlling-index arrays.

  • lower_indices (ndarray) – Controlling comparison indices of shape (*retained_shape, n_probs, n_index_axes) for lower.

  • upper_indices (ndarray) – Controlling comparison indices with the same shape as lower_indices, for upper.

  • selectors (dict[EValidResAxis, int]) – Fixed result indices used to construct the bounds.

  • metric_outputs (dict[EMetricOut, ndarray] or None) – Optional metric values for each simulation-bound and experimental-bound combination, of shape (2, 2).

  • metric (EMetricType or None) – Metric used to shift the simulation support, if available.

axes
probs
lower
upper
sim_lower
sim_upper
index_axes
lower_indices
upper_indices
selectors
metric_outputs
metric
__init__(axes, probs, lower, upper, sim_lower, sim_upper, index_axes, lower_indices, upper_indices, selectors, metric_outputs=None, metric=None)
class EECDFNuisanceScore(*values)[source]

Bases: Enum

Score widths by their total value or their increase over the simulation width.

TOTAL_WIDTH = 1
ADDED_WIDTH = 2
class ECDFNuisanceRank(axes, case_axes, cases, scores, order, valid_counts, score, selectors=<factory>)[source]

Bases: object

Whole-case ranking; widths never splice different nuisance cases together.

case_axes identifies columns in cases. Scores and order have shape (*retained_axes, n_cases). order contains row indices into cases, with -1 for missing ranks at the end. valid_counts gives the usable rank count per retained cell. Equal scores preserve canonical case order.

Variables:
  • axes (tuple[EValidResAxis, ]) – Retained result axes before the case or rank dimension.

  • case_axes (tuple[EValidResAxis, ]) – Reduced nuisance axes represented by the columns of cases.

  • cases (ndarray) – Indexed nuisance combinations of shape (n_cases, n_case_axes).

  • scores (ndarray) – Integrated widths of shape (*retained_shape, n_cases).

  • order (ndarray) – Case row indices in ascending score order, of shape (*retained_shape, n_cases).

  • valid_counts (ndarray) – Number of finite scores per retained cell, of shape retained_shape.

  • score (EECDFNuisanceScore) – Width definition used for the ranking.

  • selectors (dict[EValidResAxis, int]) – Fixed result indices used to construct the ranked bounds.

axes
case_axes
cases
scores
order
valid_counts
score
selectors
__init__(axes, case_axes, cases, scores, order, valid_counts, score, selectors=<factory>)