Created
August 12, 2015 20:32
-
-
Save bmorris3/03ce3212416e25ca2b07 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from astroplan import Observer, FixedTarget | |
from astroplan.constraints import (is_observable, is_always_observable, | |
AltitudeConstraint, AirmassConstraint, | |
AtNight) | |
from astropy.time import Time | |
import astropy.units as u | |
import numpy as np | |
time_range = Time(["2015-01-01", "2015-01-03"]) | |
subaru = Observer.at_site("Subaru") | |
targets = [FixedTarget.from_name('Polaris'), | |
FixedTarget.from_name('Albireo'), | |
FixedTarget.from_name('Vega')] | |
observer = Observer.at_site("Subaru") | |
constraint_list = [AltitudeConstraint(10*u.deg, 80*u.deg), | |
AirmassConstraint(5), AtNight.twilight_civil()] | |
# Is target *ever* observable in the time range? | |
anys = is_observable(constraint_list, time_range, targets, observer) | |
# Is the target *always* observable in the time range? | |
alls = is_always_observable(constraint_list, time_range, targets, observer) | |
# Print results | |
observability_report = [] | |
justify = 15 | |
def prep_line(*data): | |
# For printing data in neat columns | |
return ''.join(["{}".format(i).ljust(justify) for i in data]) | |
headers = ['Star', 'ever obs-able', 'always obs-able'] | |
observability_report.append(prep_line(*headers)) | |
observability_report.append(prep_line(*['-'*len(header) for header in headers])) | |
for target, any, all in zip(targets, anys, alls): | |
observability_report.append(prep_line(target.name, any, all)) | |
print "\n".join(observability_report) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment