Skip to main content
`Ctrl`+`K`

# Constraint

class astroplan.Constraint

  Bases: `object`

  Abstract class for objects defining observational constraints.

  Methods Summary

  `__call__`(observer, targets[, times, ...]) | Compute the constraint for this class
  `compute_constraint`(times, observer, targets) | Actually do the real work of computing the constraint.

  Methods Documentation

  __call__(observer, targets, times=None, time_range=None, time_grid_resolution=<Quantity 0.5 h>, grid_times_targets=False)

    Compute the constraint for this class

    Parameters:
      observer `Observer`

        the observation location from which to apply the constraints

      targets sequence of `Target`

        The targets on which to apply the constraints.

      times `Time`

        The times to compute the constraint. WHAT HAPPENS WHEN BOTH TIMES AND TIME_RANGE ARE SET?

      time_range `Time` (length = 2)

        Lower and upper bounds on time sequence.

      time_grid_resolution `quantity`

        Time-grid spacing

      grid_times_targets bool

        if True, grids the constraint result with targets along the first index and times along the second. Otherwise, we rely on broadcasting the shapes together using standard numpy rules.

      Returns
      ——-
      constraint_result 1D or 2D array of float or bool

        The constraints. If 2D with targets along the first index and times along the second.

  abstract compute_constraint(times, observer, targets)

    Actually do the real work of computing the constraint. Subclasses override this.

    Parameters:
      times `Time`

        The times to compute the constraint

      observer `Observer`

        the observaton location from which to apply the constraints

      targets sequence of `Target`

        The targets on which to apply the constraints.

    Returns:
      constraint_result 2D array of float or bool

        The constraints, with targets along the first index and times along the second.