traveler.JaxTable.validate#
- JaxTable.validate(sizes=None, verbose=0, sources=(), missing_fields='raise', coerce='safe')[source]#
Validate dataset fields against the class annotations.
- Parameters:
sizes (dict[str, int] or None, optional) – Known sizes for named dimensions.
verbose (int, optional) – Verbosity level for validation messages.
sources (collections.abc.Collection[str], optional) – Completed sources that make endogenous fields eligible for validation.
missing_fields ({"raise", "warn", "ignore"}, optional) – Policy for annotated fields that are absent.
coerce ({False, "safe"}, optional) – Whether safely coercible fields may be converted.
- Returns:
The validated dataset, or a safely coerced copy when coercion is enabled.
- Return type:
- Raises:
ValidationError – If a required field is missing or a value does not match its annotation.
ValueError – If a validation option or a named dimension size is invalid.
Notes
Extra, unannotated fields are permitted. Safe coercion is value based: a conversion is accepted only when converting back to the original dtype reproduces every value.