Skip to content

Commit

Permalink
⚰️ dead(vecs): remove unneeded checks
Browse files Browse the repository at this point in the history
  • Loading branch information
nstarman committed Jan 3, 2025
1 parent aa465a9 commit d56c232
Showing 1 changed file with 0 additions and 62 deletions.
62 changes: 0 additions & 62 deletions src/coordinax/_src/vectors/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,37 +137,6 @@ def check_non_negative_non_zero(
)


def check_less_than(
x: AbstractQuantity,
max_val: AbstractQuantity,
/,
*,
name: str = "",
comparison_name: str = "the specified maximum value",
) -> AbstractQuantity:
"""Check that the input value is less than the input maximum value.
Examples
--------
>>> import unxt as u
Pass through the input if the value is less than the max value:
>>> x = u.Quantity([1, 2, 3], "m")
>>> check_less_than(x, u.Quantity(4, "m"))
Quantity['length'](Array([1, 2, 3], dtype=int32), unit='m')
Raise an error if the input is larger than the maximum value.
>>> try: check_less_than(x, u.Quantity(1.5, "m"))
... except Exception: pass
"""
name = f" {name}" if name else name
msg = f"The input{name} must be less than {comparison_name}."
return eqx.error_if(x, jnp.any(x >= max_val), msg)


def check_less_than_equal(
x: AbstractQuantity,
max_val: AbstractQuantity,
Expand Down Expand Up @@ -199,37 +168,6 @@ def check_less_than_equal(
return eqx.error_if(x, jnp.any(x > max_val), msg)


def check_greater_than(
x: AbstractQuantity,
min_val: AbstractQuantity,
/,
*,
name: str = "",
comparison_name: str = "the specified minimum value",
) -> AbstractQuantity:
"""Check that the input value is greater than the input minimum value.
Examples
--------
>>> import unxt as u
Pass through the input if the value is greater than the min value:
>>> x = u.Quantity([1, 2, 3], "m")
>>> check_greater_than(x, u.Quantity(0, "m"))
Quantity['length'](Array([1, 2, 3], dtype=int32), unit='m')
Raise an error if the input is smaller than the minimum value.
>>> try: check_greater_than(x, u.Quantity(4, "m"))
... except Exception: pass
"""
name = f" {name}" if name else name
msg = f"The input{name} must be greater than {comparison_name}."
return eqx.error_if(x, jnp.any(x <= min_val), msg)


def check_greater_than_equal(
x: AbstractQuantity,
min_val: AbstractQuantity,
Expand Down

0 comments on commit d56c232

Please sign in to comment.