Skip to main content
`Ctrl`+`K`

# AtNightConstraint

class astroplan.AtNightConstraint(max_solar_altitude=<Quantity 0. deg>, force_pressure_zero=True)

  Bases: `Constraint`

  Constrain the Sun to be below `horizon`.

  Parameters:
    max_solar_altitude `Quantity`

      The altitude of the sun below which it is considered to be “night” (inclusive).

    force_pressure_zero bool (optional)

      Force the pressure to zero for solar altitude calculations. This avoids errors in the altitude of the Sun that can occur when the Sun is below the horizon and the corrections for atmospheric refraction return nonsense values.

  Methods Summary

  `compute_constraint`(times, observer, targets) | Actually do the real work of computing the constraint.
  `twilight_astronomical`(**kwargs) | Consider nighttime as time between astronomical twilights (-18 degrees).
  `twilight_civil`(**kwargs) | Consider nighttime as time between civil twilights (-6 degrees).
  `twilight_nautical`(**kwargs) | Consider nighttime as time between nautical twilights (-12 degrees).

  Methods Documentation

  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.

  classmethod twilight_astronomical(**kwargs)

    Consider nighttime as time between astronomical twilights (-18 degrees).

  classmethod twilight_civil(**kwargs)

    Consider nighttime as time between civil twilights (-6 degrees).

  classmethod twilight_nautical(**kwargs)

    Consider nighttime as time between nautical twilights (-12 degrees).