Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
Q: Can I observe this target on the night of May 1, 2015 between 18:30
and 05:30 HST, above airmass 1.2, on a telescope that can observe between
15 degrees and 89 degrees altitude?
"""
# first we define the conditions
from astroplan import TimeRange, AltitudeRange, AirmassRange, is_observable
# `is_observable` is a temporary function which will eventually be a method of
# something to support caching
# Times in TimeRange can be passed in as strings, will be passed to the
# Time constructor.
constraint_list = [TimeRange("2015-05-01 18:30", "2015-05-02 05:30"),
AirmassRange(1.2), AltitudeRange(15.0*u.deg, 89.0*u.deg)]
# (AboveAirmass will be a subclass of AltitudeWindow)
# Combine a list of constraints to run on Observer, FixedTarget, and time to
# determine the observability of target
constraints = is_observable(constraint_list, obs, t1, time_obs)
# Test only a single constraint:
constraints = is_observable(AirmassRange(1.2), obs, t1, time_obs)
# AirmassRange can accept two bounding airmasses, assumes single argument is
# an upper limit, lower limit = 1.
# `constraints` will be a boolean where True=observable. For a list of
# targets, observatories, or times, `constraints` may be a booleans array