class astroplan.TimeConstraint(min=None, max=None)[source]#

Bases: Constraint

Constrain the observing time to be within certain time limits.

An example use case for this class would be to associate an acceptable time range with a specific observing block. This can be useful if not all observing blocks are valid over the time limits used in calls to is_observable or is_always_observable.


Earliest time (inclusive). None indicates no limit.


Latest time (inclusive). None indicates no limit.


Constrain the observations to targets that are observable between 2016-03-28 and 2016-03-30:

>>> from astroplan import Observer
>>> from astropy.time import Time
>>> subaru = Observer.at_site("Subaru")
>>> t1 = Time("2016-03-28T12:00:00")
>>> t2 = Time("2016-03-30T12:00:00")
>>> constraint = TimeConstraint(t1,t2)

Methods Summary

compute_constraint(times, observer, targets)

Actually do the real work of computing the constraint.

Methods Documentation

compute_constraint(times, observer, targets)[source]#

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


The times to compute the constraint


the observaton location from which to apply the constraints

targetssequence of Target

The targets on which to apply the constraints.

constraint_result2D array of float or bool

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