quantity_field

Contents

quantity_field#

tollan.config.types.quantity_field(physical_types_allowed: str | Sequence[str] | None = None) type[Quantity][source]#

Create a pydantic field type for validating astropy Quantity.

Parameters:

physical_types_allowed (None | str | Sequence[str], optional) – Allowed physical types

Returns:

Pydantic-compatible quantity field

Return type:

Annotated[Quantity, QuantityValidator]

Examples

>>> Speed = quantity_field(physical_types_allowed='speed')