check_interval_specs#

check_interval_specs(interval_specs: ArrayLike, n_cols: int, *, n_samples: int | None = None, check_sorted: bool = False, min_size: int | None = None, caller_name: str | None = None, arg_name: str = 'interval_specs') ndarray[source][source]#

Validate an interval_specs array.

Always checks that the input is a 2D integer array with exactly n_cols columns. Heavier checks are opt-in.

Parameters:
interval_specsarray-like of shape (n_interval_specs, n_cols)

Interval specifications to validate.

n_colsint

Required number of columns.

n_samplesint or None, default=None

If given, checks that all entries are in [0, n_samples].

check_sortedbool, default=False

If True, checks that each row is strictly increasing, i.e. interval_specs[i, 0] < interval_specs[i, 1] < ... for every row.

min_sizeint or None, default=None

If given, checks that adjacent entries in each row differ by at least min_size, i.e. interval_specs[i, j+1] - interval_specs[i, j] >= min_size for every row and column pair. Implies strict ordering when min_size >= 1.

caller_namestr or None, default=None

Name of the calling function or class. Used in error messages.

arg_namestr, default=”interval_specs”

Name of the argument being validated. Used in error messages.

Returns:
interval_specsndarray of shape (n_interval_specs, n_cols)

Validated array with dtype np.intp.

Raises:
ValueError

If any check fails.