across.tools.visibility.constraints.base

Classes

ConstraintABC

Base class for constraints. Constraints represent conditions that make a target

Functions

get_slice(time, ephemeris)

Return a slice for what the part of the ephemeris that we're using.

Module Contents

get_slice(time, ephemeris)[source]

Return a slice for what the part of the ephemeris that we’re using.

Parameters:
  • time (Time) – The time to calculate the slice for

  • ephemeris (Ephemeris) – The spacecraft ephemeris

Return type:

The slice for the ephemeris

class ConstraintABC(/, **data)[source]

Bases: across.tools.core.schemas.base.BaseSchema, abc.ABC

Base class for constraints. Constraints represent conditions that make a target NOT visible (blocked from observation). A constraint returns True when the target is constrained (NOT visible) and False when the target is visible.

When combining multiple constraints, the typical approach in visibility calculations is to use OR logic: the target is not visible if ANY constraint blocks it. AND and NOT logic are provided but are rarely used in practice.

Constraints can be combined using logical operators: - | (OR): Combined constraint violated if ANY sub-constraint is violated (typical usage) - & (AND): Combined constraint violated only if ALL sub-constraints are violated (rarely used) - ~ (NOT): Inverts the constraint’s logic (rarely used) - ^ (XOR): Combined constraint violated when an odd number of sub-constraints are violated (rarely used)

__call__(time, ephemeris, coord)[source]

Evaluates if a given coordinate is constrained at the given time.

__or__(other)[source]

Combines two constraints with OR logic using the | operator (typical usage).

__and__(other)[source]

Combines two constraints with AND logic using the & operator.

__invert__()[source]

Negates a constraint using the ~ operator.

__xor__(other)[source]

Combines two constraints with XOR logic using the ^ operator.

Examples

Typical usage: combine constraints with OR (if any constraint blocks, target not visible):

>>> from across.tools.visibility.constraints import (
...     SunAngleConstraint, MoonAngleConstraint, EarthLimbConstraint
... )
>>> sun = SunAngleConstraint(min_angle=45)      # Not visible if <45° from Sun
>>> moon = MoonAngleConstraint(min_angle=10)    # Not visible if <10° from Moon
>>> earth = EarthLimbConstraint(min_angle=33)   # Not visible if <33° above limb
>>> # Target not visible if ANY constraint blocks it
>>> all_constraints = sun | moon | earth
short_name: str[source]
name: across.tools.core.enums.ConstraintType[source]
computed_values: across.tools.core.schemas.visibility.VisibilityComputedValues = None[source]
abstract __call__(time, ephemeris, coordinate)[source]

Check for a given time, ephemeris and coordinate if positions given are inside the constraint.

Parameters:
  • time (Time) – The time to check.

  • ephemeris (Ephemeris) – The ephemeris object.

  • coordinate (SkyCoord) – The coordinate to check.

Returns:

Boolean array where True indicates the coordinate violates the constraint (is not visible).

Return type:

npt.NDArray[np.bool_]

__and__(other)[source]

Combine two constraints with AND logic using the & operator.

This creates a composite constraint that is violated only when BOTH component constraints are violated. This is rarely used in practice since the typical way to combine visibility constraints is with OR logic (use | instead).

Parameters:

other (ConstraintABC) – The constraint to combine with this one

Returns:

A new constraint that is violated only if both constraints are violated

Return type:

AndConstraint

Examples

>>> from across.tools.visibility.constraints import (
...     SunAngleConstraint, MoonAngleConstraint
... )
>>> sun = SunAngleConstraint(min_angle=45)
>>> moon = MoonAngleConstraint(min_angle=10)
>>> # Rarely used: target not visible only if BOTH block it
>>> combined = sun & moon
__or__(other)[source]

Combine two constraints with OR logic using the | operator.

This creates a composite constraint that is violated when ANY component constraint is violated. This is the typical and recommended way to combine visibility constraints: the target is not visible if ANY constraint blocks it.

Parameters:

other (ConstraintABC) – The constraint to combine with this one

Returns:

A new constraint that is violated if either constraint is violated

Return type:

OrConstraint

Examples

>>> from across.tools.visibility.constraints import (
...     SunAngleConstraint, MoonAngleConstraint
... )
>>> sun = SunAngleConstraint(min_angle=45)
>>> moon = MoonAngleConstraint(min_angle=10)
>>> # Typical usage: target not visible if Sun OR Moon blocks it
>>> combined = sun | moon
__invert__()[source]

Negate a constraint using the ~ operator.

This creates a composite constraint with inverted logic: where the original constraint is violated (target not visible), the negated constraint is not violated (target visible), and vice versa. This is rarely used in practice.

Returns:

A new constraint that is the logical negation of this constraint

Return type:

NotConstraint

Examples

>>> from across.tools.visibility.constraints import EarthLimbConstraint
>>> earth = EarthLimbConstraint(min_angle=33)
>>> # Violated when earth constraint is NOT violated
>>> not_earth = ~earth
__xor__(other)[source]

Combine two constraints with XOR logic using the ^ operator.

This creates a composite constraint that is violated when exactly one (but not both) of the component constraints is violated. For multiple constraints, it follows standard XOR behavior: violated when an odd number of constraints are violated. This is rarely used in practice.

Parameters:

other (ConstraintABC) – The constraint to combine with this one

Returns:

A new constraint that is violated when an odd number of constraints are violated

Return type:

XorConstraint

Examples

>>> from across.tools.visibility.constraints import (
...     SunAngleConstraint, MoonAngleConstraint
... )
>>> sun = SunAngleConstraint(min_angle=45)
>>> moon = MoonAngleConstraint(min_angle=10)
>>> # Rarely used: target not visible if exactly one (but not both) blocks it
>>> combined = sun ^ moon