{"action":"created","comment":{"url":"https://api.github.com/repos/astroplanners/astroplan/pulls/comments/30295746","id":30295746,"diff_hunk":"@@ -0,0 +1,265 @@\n+#!/usr/bin/python\n+# -*- coding: utf-8 -*-\n+\n+# ============================\n+# Observation Planning Toolbox\n+# ============================\n+\"\"\"\n+The observation planning toolbox consists of a number of entities that\n+simplify the planning and scheduling of observations by abstracting much\n+of the boilerplate code necessary to accomplish the same thing using\n+core astropy or ephemerides objects.  These can be thought of as common\n+idioms or convenience classes and functions that would be recreated over\n+and over by astronomers and or software engineers building telescope\n+scheduling software.\n+\n+Important assumptions:\n+\n+- It should be convenient to specify dates and times in the local timezone\n+  of the observer.\n+\n+- It should be convenient to do timezone conversions easily.\n+\n+  This means methods that can take dates can either take astropy\n+  dates (as used internally) or python datetime objects (not naive, but\n+  tagged with timezone).  So dates can be passed in as timezone-aware\n+  datetime objects and results can be easily converted between such.\n+\n+\"\"\"\n+\n+# ================\n+# Observer objects\n+# ================\n+\"\"\"\n+An observer defines a single terrestrial location and applicable\n+environmental attributes thereof that affect observation calculations\n+at that location.\n+\"\"\"\n+# Define an observer by full specification\n+#\n+# Because there may be many attributes for an observer, I suggest using\n+# keyword parameters for most of them.\n+from astroplan.entity import Observer\n+\n+obs = Observer(name='Subaru Telescope',\n+               longitude='-155:28:48.900',\n+               latitude='+19:49:42.600',\n+               elevation=4163,\n+               pressure=615,\n+               relative_humidity=0.11,\n+               temperature=0,\n+               timezone='US/Hawaii',\n+               description=\"Subaru Telescope on Mauna Kea, Hawaii\")\n+\n+# longitude and latitude would be represented internally by astropy\n+# angles.Longitude/Latitude.  So any value that can naturally initialize\n+# one of those objects could be passed as the parameter to Observer\n+# Other items are represented internally using the appropriate astropy\n+# Quantities and Units and so can be initialized similarly.\n+\n+# It's also possible to initialize using astropy objects and other\n+# direct entities\n+from astropy.coordinates.angles import Longitude, Latitude\n+import astropy.units as u\n+import pytz\n+\n+obs = entity.Observer(name='Keck 1',\n+                      longitude=Longitude(155.4750 * u.degree),\n+                      latitude=Latitude(19.8264 * u.degree)\n+                      elevation=4160 * u.m,\n+                      pressure=615 * u.hPa,\n+                      relative_humidity=0.11,\n+                      temperature=0.0 * u.C,\n+                      timezone=pytz.timezone('US/Hawaii'),\n+                      description=\"W.M. Keck 1 Telescope on Mauna Kea, Hawaii\")\n+\n+# It would also be desirable to be able to have a small database of\n+# common telescopes.  Maybe this can at first simply take the form of\n+# a python module:\n+from astroplan import sites\n+\n+obs = sites.get_observer('keck1')\n+\n+# Environmental conditions should be updatable.  Suggest using keyword\n+# parameters (this would make it easy to update an internal AltAz coordinate):\n+#\n+obs.set_env_conditions(pressure=600 * u.hPa, relative_humidity=0.2,\n+                       temperature=10 * u.C)\n+\n+# It's easy to construct date/times from the observer, since it knows about\n+# its timezone.  These dates can be passed directly to target check methods.\n+\n+# dates default to midnight if not otherwise specified\n+day = obs.get_date(\"2015-05-01\")\n+\n+# Can get more and more specific\n+t1 = obs.get_date(\"2015-05-01 21:00\")\n+t1 = obs.get_date(\"2015-05-01 21:33:41\")\n+\n+# default is current time\n+cur_time = obs.get_date()\n+\n+# Dates are assumed to be in the observer's time zone unless a time zone\n+# specifier is given\n+t2_utc = obs.get_date(\"2015-05-01 21:33:41 UTC\")\n+\n+\"\"\"\n+We can ask about typical times of interest at this observing position\n+Returned dates are assumed to be in the observer's time zone for convenience.\n+The date parameter, if given, can be an astropy Time or a datetime instance.\n+If no parameter is given, the current date/time is assumed.\n+\"\"\"\n+\n+# sunset\n+obs.sunset(date=day)\n+\n+# sunrise\n+obs.sunrise(date=day)\n+\n+# moon rise\n+obs.moon_rise(date=day)\n+\n+# moon set\n+obs.moon_set(date=day)\n+\n+# evening (nautical) twilight\n+obs.evening_twilight_12(date=day)\n+\n+# evening (civil) twilight\n+obs.evening_twilight_18(date=day)\n+\n+# morning (nautical) twilight\n+obs.morning_twilight_12(date=day)\n+\n+# morning (civil) twilight\n+obs.morning_twilight_18(date=day)\n+\n+# what is the moon illumination?\n+# returns a float, which is percentage of the moon illuminated\n+obs.moon_illumination(date=t1)\n+\n+# what is the moon altitude and azimuth?\n+# returns an altaz coordinate\n+obs.moon_position(date=t1)\n+\n+# ==============\n+# Target objects\n+# ==============\n+'''\n+A target object defines a single observation target, with coordinates\n+and an optional name.\n+'''\n+from astroplan.entity import SiderealTarget\n+\n+# Define a target.\n+t1 = SiderealTarget(name='Polaris', ra='02:31:49.09', dec='+89:15:50.8')\n+\n+# initializing from astropy entities directly\n+from astropy.coordinates import SkyCoord\n+\n+t1 = SiderealTarget(name='Polaris',\n+               coord=SkyCoord('02h31m49.09s', '+89d15m50.8s', frame='icrs'))\n+\n+# Leaves scope for NonSiderealTarget, etc.\n+\n+# Convenience methods for looking up/constructing targets by name via\n+# astroquery?\n+\n+\n+# ================================\n+# Condition objects, observability\n+# ================================\n+\n+\"\"\"\n+Q: Can I observe this target on the night of May 1, 2015 between 18:30\n+and 05:30 HST for 30 minutes somewhere between 15 degrees and 89 degrees\n+altitude?\n+\"\"\"\n+\n+# first we define the conditions\n+from astroplan.entity import Constraints","path":"dev/planning-example.py","position":180,"original_position":180,"commit_id":"abcfaa835bb2215305f61eee563b1fc82b350d23","original_commit_id":"abcfaa835bb2215305f61eee563b1fc82b350d23","user":{"login":"eteq","id":346587,"avatar_url":"https://avatars.githubusercontent.com/u/346587?v=3","gravatar_id":"","url":"https://api.github.com/users/eteq","html_url":"https://github.com/eteq","followers_url":"https://api.github.com/users/eteq/followers","following_url":"https://api.github.com/users/eteq/following{/other_user}","gists_url":"https://api.github.com/users/eteq/gists{/gist_id}","starred_url":"https://api.github.com/users/eteq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eteq/subscriptions","organizations_url":"https://api.github.com/users/eteq/orgs","repos_url":"https://api.github.com/users/eteq/repos","events_url":"https://api.github.com/users/eteq/events{/privacy}","received_events_url":"https://api.github.com/users/eteq/received_events","type":"User","site_admin":false},"body":"As above, it would be nicer if it were visible to users (although *not* necessarily actually organized) as ``astroplan.Constraints``","created_at":"2015-05-14T03:33:03Z","updated_at":"2015-05-14T03:33:03Z","html_url":"https://github.com/astroplanners/astroplan/pull/4#discussion_r30295746","pull_request_url":"https://api.github.com/repos/astroplanners/astroplan/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/astroplanners/astroplan/pulls/comments/30295746"},"html":{"href":"https://github.com/astroplanners/astroplan/pull/4#discussion_r30295746"},"pull_request":{"href":"https://api.github.com/repos/astroplanners/astroplan/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/astroplanners/astroplan/pulls/4","id":35048040,"html_url":"https://github.com/astroplanners/astroplan/pull/4","diff_url":"https://github.com/astroplanners/astroplan/pull/4.diff","patch_url":"https://github.com/astroplanners/astroplan/pull/4.patch","issue_url":"https://api.github.com/repos/astroplanners/astroplan/issues/4","number":4,"state":"open","locked":false,"title":"Adding straw-man API for discussion","user":{"login":"bmorris3","id":3497584,"avatar_url":"https://avatars.githubusercontent.com/u/3497584?v=3","gravatar_id":"","url":"https://api.github.com/users/bmorris3","html_url":"https://github.com/bmorris3","followers_url":"https://api.github.com/users/bmorris3/followers","following_url":"https://api.github.com/users/bmorris3/following{/other_user}","gists_url":"https://api.github.com/users/bmorris3/gists{/gist_id}","starred_url":"https://api.github.com/users/bmorris3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmorris3/subscriptions","organizations_url":"https://api.github.com/users/bmorris3/orgs","repos_url":"https://api.github.com/users/bmorris3/repos","events_url":"https://api.github.com/users/bmorris3/events{/privacy}","received_events_url":"https://api.github.com/users/bmorris3/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-05-08T21:22:18Z","updated_at":"2015-05-14T03:33:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a806771f4e158a2b7f0f1df3d3066a9dfc10b0d0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/astroplanners/astroplan/pulls/4/commits","review_comments_url":"https://api.github.com/repos/astroplanners/astroplan/pulls/4/comments","review_comment_url":"https://api.github.com/repos/astroplanners/astroplan/pulls/comments{/number}","comments_url":"https://api.github.com/repos/astroplanners/astroplan/issues/4/comments","statuses_url":"https://api.github.com/repos/astroplanners/astroplan/statuses/abcfaa835bb2215305f61eee563b1fc82b350d23","head":{"label":"bmorris3:master","ref":"master","sha":"abcfaa835bb2215305f61eee563b1fc82b350d23","user":{"login":"bmorris3","id":3497584,"avatar_url":"https://avatars.githubusercontent.com/u/3497584?v=3","gravatar_id":"","url":"https://api.github.com/users/bmorris3","html_url":"https://github.com/bmorris3","followers_url":"https://api.github.com/users/bmorris3/followers","following_url":"https://api.github.com/users/bmorris3/following{/other_user}","gists_url":"https://api.github.com/users/bmorris3/gists{/gist_id}","starred_url":"https://api.github.com/users/bmorris3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmorris3/subscriptions","organizations_url":"https://api.github.com/users/bmorris3/orgs","repos_url":"https://api.github.com/users/bmorris3/repos","events_url":"https://api.github.com/users/bmorris3/events{/privacy}","received_events_url":"https://api.github.com/users/bmorris3/received_events","type":"User","site_admin":false},"repo":{"id":34740000,"name":"astroplan","full_name":"bmorris3/astroplan","owner":{"login":"bmorris3","id":3497584,"avatar_url":"https://avatars.githubusercontent.com/u/3497584?v=3","gravatar_id":"","url":"https://api.github.com/users/bmorris3","html_url":"https://github.com/bmorris3","followers_url":"https://api.github.com/users/bmorris3/followers","following_url":"https://api.github.com/users/bmorris3/following{/other_user}","gists_url":"https://api.github.com/users/bmorris3/gists{/gist_id}","starred_url":"https://api.github.com/users/bmorris3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmorris3/subscriptions","organizations_url":"https://api.github.com/users/bmorris3/orgs","repos_url":"https://api.github.com/users/bmorris3/repos","events_url":"https://api.github.com/users/bmorris3/events{/privacy}","received_events_url":"https://api.github.com/users/bmorris3/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bmorris3/astroplan","description":"Observation planning package for astronomers","fork":true,"url":"https://api.github.com/repos/bmorris3/astroplan","forks_url":"https://api.github.com/repos/bmorris3/astroplan/forks","keys_url":"https://api.github.com/repos/bmorris3/astroplan/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bmorris3/astroplan/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bmorris3/astroplan/teams","hooks_url":"https://api.github.com/repos/bmorris3/astroplan/hooks","issue_events_url":"https://api.github.com/repos/bmorris3/astroplan/issues/events{/number}","events_url":"https://api.github.com/repos/bmorris3/astroplan/events","assignees_url":"https://api.github.com/repos/bmorris3/astroplan/assignees{/user}","branches_url":"https://api.github.com/repos/bmorris3/astroplan/branches{/branch}","tags_url":"https://api.github.com/repos/bmorris3/astroplan/tags","blobs_url":"https://api.github.com/repos/bmorris3/astroplan/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bmorris3/astroplan/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bmorris3/astroplan/git/refs{/sha}","trees_url":"https://api.github.com/repos/bmorris3/astroplan/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bmorris3/astroplan/statuses/{sha}","languages_url":"https://api.github.com/repos/bmorris3/astroplan/languages","stargazers_url":"https://api.github.com/repos/bmorris3/astroplan/stargazers","contributors_url":"https://api.github.com/repos/bmorris3/astroplan/contributors","subscribers_url":"https://api.github.com/repos/bmorris3/astroplan/subscribers","subscription_url":"https://api.github.com/repos/bmorris3/astroplan/subscription","commits_url":"https://api.github.com/repos/bmorris3/astroplan/commits{/sha}","git_commits_url":"https://api.github.com/repos/bmorris3/astroplan/git/commits{/sha}","comments_url":"https://api.github.com/repos/bmorris3/astroplan/comments{/number}","issue_comment_url":"https://api.github.com/repos/bmorris3/astroplan/issues/comments{/number}","contents_url":"https://api.github.com/repos/bmorris3/astroplan/contents/{+path}","compare_url":"https://api.github.com/repos/bmorris3/astroplan/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bmorris3/astroplan/merges","archive_url":"https://api.github.com/repos/bmorris3/astroplan/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bmorris3/astroplan/downloads","issues_url":"https://api.github.com/repos/bmorris3/astroplan/issues{/number}","pulls_url":"https://api.github.com/repos/bmorris3/astroplan/pulls{/number}","milestones_url":"https://api.github.com/repos/bmorris3/astroplan/milestones{/number}","notifications_url":"https://api.github.com/repos/bmorris3/astroplan/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bmorris3/astroplan/labels{/name}","releases_url":"https://api.github.com/repos/bmorris3/astroplan/releases{/id}","created_at":"2015-04-28T15:47:16Z","updated_at":"2015-04-28T15:47:16Z","pushed_at":"2015-05-08T21:22:00Z","git_url":"git://github.com/bmorris3/astroplan.git","ssh_url":"git@github.com:bmorris3/astroplan.git","clone_url":"https://github.com/bmorris3/astroplan.git","svn_url":"https://github.com/bmorris3/astroplan","homepage":"https://astroplan.readthedocs.org/","size":120,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"astroplanners:master","ref":"master","sha":"d75a31e0c56f0cd7167f5a1bf8e535d2bddcd751","user":{"login":"astroplanners","id":12143843,"avatar_url":"https://avatars.githubusercontent.com/u/12143843?v=3","gravatar_id":"","url":"https://api.github.com/users/astroplanners","html_url":"https://github.com/astroplanners","followers_url":"https://api.github.com/users/astroplanners/followers","following_url":"https://api.github.com/users/astroplanners/following{/other_user}","gists_url":"https://api.github.com/users/astroplanners/gists{/gist_id}","starred_url":"https://api.github.com/users/astroplanners/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astroplanners/subscriptions","organizations_url":"https://api.github.com/users/astroplanners/orgs","repos_url":"https://api.github.com/users/astroplanners/repos","events_url":"https://api.github.com/users/astroplanners/events{/privacy}","received_events_url":"https://api.github.com/users/astroplanners/received_events","type":"Organization","site_admin":false},"repo":{"id":34693515,"name":"astroplan","full_name":"astroplanners/astroplan","owner":{"login":"astroplanners","id":12143843,"avatar_url":"https://avatars.githubusercontent.com/u/12143843?v=3","gravatar_id":"","url":"https://api.github.com/users/astroplanners","html_url":"https://github.com/astroplanners","followers_url":"https://api.github.com/users/astroplanners/followers","following_url":"https://api.github.com/users/astroplanners/following{/other_user}","gists_url":"https://api.github.com/users/astroplanners/gists{/gist_id}","starred_url":"https://api.github.com/users/astroplanners/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astroplanners/subscriptions","organizations_url":"https://api.github.com/users/astroplanners/orgs","repos_url":"https://api.github.com/users/astroplanners/repos","events_url":"https://api.github.com/users/astroplanners/events{/privacy}","received_events_url":"https://api.github.com/users/astroplanners/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/astroplanners/astroplan","description":"Observation planning package for astronomers","fork":false,"url":"https://api.github.com/repos/astroplanners/astroplan","forks_url":"https://api.github.com/repos/astroplanners/astroplan/forks","keys_url":"https://api.github.com/repos/astroplanners/astroplan/keys{/key_id}","collaborators_url":"https://api.github.com/repos/astroplanners/astroplan/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/astroplanners/astroplan/teams","hooks_url":"https://api.github.com/repos/astroplanners/astroplan/hooks","issue_events_url":"https://api.github.com/repos/astroplanners/astroplan/issues/events{/number}","events_url":"https://api.github.com/repos/astroplanners/astroplan/events","assignees_url":"https://api.github.com/repos/astroplanners/astroplan/assignees{/user}","branches_url":"https://api.github.com/repos/astroplanners/astroplan/branches{/branch}","tags_url":"https://api.github.com/repos/astroplanners/astroplan/tags","blobs_url":"https://api.github.com/repos/astroplanners/astroplan/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/astroplanners/astroplan/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/astroplanners/astroplan/git/refs{/sha}","trees_url":"https://api.github.com/repos/astroplanners/astroplan/git/trees{/sha}","statuses_url":"https://api.github.com/repos/astroplanners/astroplan/statuses/{sha}","languages_url":"https://api.github.com/repos/astroplanners/astroplan/languages","stargazers_url":"https://api.github.com/repos/astroplanners/astroplan/stargazers","contributors_url":"https://api.github.com/repos/astroplanners/astroplan/contributors","subscribers_url":"https://api.github.com/repos/astroplanners/astroplan/subscribers","subscription_url":"https://api.github.com/repos/astroplanners/astroplan/subscription","commits_url":"https://api.github.com/repos/astroplanners/astroplan/commits{/sha}","git_commits_url":"https://api.github.com/repos/astroplanners/astroplan/git/commits{/sha}","comments_url":"https://api.github.com/repos/astroplanners/astroplan/comments{/number}","issue_comment_url":"https://api.github.com/repos/astroplanners/astroplan/issues/comments{/number}","contents_url":"https://api.github.com/repos/astroplanners/astroplan/contents/{+path}","compare_url":"https://api.github.com/repos/astroplanners/astroplan/compare/{base}...{head}","merges_url":"https://api.github.com/repos/astroplanners/astroplan/merges","archive_url":"https://api.github.com/repos/astroplanners/astroplan/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/astroplanners/astroplan/downloads","issues_url":"https://api.github.com/repos/astroplanners/astroplan/issues{/number}","pulls_url":"https://api.github.com/repos/astroplanners/astroplan/pulls{/number}","milestones_url":"https://api.github.com/repos/astroplanners/astroplan/milestones{/number}","notifications_url":"https://api.github.com/repos/astroplanners/astroplan/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/astroplanners/astroplan/labels{/name}","releases_url":"https://api.github.com/repos/astroplanners/astroplan/releases{/id}","created_at":"2015-04-27T22:00:00Z","updated_at":"2015-05-07T10:06:13Z","pushed_at":"2015-05-08T21:22:18Z","git_url":"git://github.com/astroplanners/astroplan.git","ssh_url":"git@github.com:astroplanners/astroplan.git","clone_url":"https://github.com/astroplanners/astroplan.git","svn_url":"https://github.com/astroplanners/astroplan","homepage":"https://astroplan.readthedocs.org/","size":332,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":1,"forks":4,"open_issues":1,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/astroplanners/astroplan/pulls/4"},"html":{"href":"https://github.com/astroplanners/astroplan/pull/4"},"issue":{"href":"https://api.github.com/repos/astroplanners/astroplan/issues/4"},"comments":{"href":"https://api.github.com/repos/astroplanners/astroplan/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/astroplanners/astroplan/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/astroplanners/astroplan/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/astroplanners/astroplan/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/astroplanners/astroplan/statuses/abcfaa835bb2215305f61eee563b1fc82b350d23"}}}}