{"action":"created","comment":{"url":"https://api.github.com/repos/lsst/obs_lsstSim/pulls/comments/85885684","pull_request_review_id":6572745,"id":85885684,"diff_hunk":"@@ -0,0 +1,97 @@\n+#!/usr/bin/env python\n+from __future__ import absolute_import, division, print_function\n+#\n+# LSST Data Management System\n+# Copyright 2008-2013 LSST Corporation.\n+#\n+# This product includes software developed by the\n+# LSST Project (http://www.lsst.org/).\n+#\n+# This program is free software: you can redistribute it and/or modify\n+# it under the terms of the GNU General Public License as published by\n+# the Free Software Foundation, either version 3 of the License, or\n+# (at your option) any later version.\n+#\n+# This program is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+# GNU General Public License for more details.\n+#\n+# You should have received a copy of the LSST License Statement and\n+# the GNU General Public License along with this program.  If not,\n+# see <http://www.lsstcorp.org/LegalNotices/>.\n+#\n+\"\"\"Test ability to get an eimage from the butler.\n+\"\"\"\n+import os\n+import unittest\n+\n+import numpy as np\n+\n+import lsst.utils\n+import lsst.afw.geom as afwGeom\n+import lsst.utils.tests\n+import lsst.daf.persistence as dafPersistence\n+from lsst.afw.coord import Coord, IcrsCoord, Observatory, Weather\n+from lsst.daf.base import DateTime\n+\n+obsLsstSimDir = lsst.utils.getPackageDir('obs_lsstSim')\n+InputDir = os.path.join(obsLsstSimDir, 'tests', 'data')\n+\n+\n+class GetEimageTestCase(lsst.utils.tests.TestCase):\n+\n+    def testGetEimage(self):\n+        \"\"\"Test getting a eimage from the butler.  Mostly we want to test whether the proper metadata\n+        gets attached.  Specifically, we'll check for a Wcs and that the VisitInfo is populated.\n+        \"\"\"\n+        # For lsstSim specific reasons, we need to specify the raft and sensor\n+        dataId = dict(visit=840, raft='2,2', sensor='1,1')\n+        butler = dafPersistence.Butler(InputDir)\n+        exposure = butler.get('eimage', dataId=dataId)\n+\n+        # Test for a Wcs object\n+        self.assertIsNotNone(exposure.getWcs())\n+\n+        # Test VisitInfo for known values for this piece of test data\n+        methods_to_test = ['getBoresightAirmass', 'getBoresightAzAlt', 'getBoresightRaDec',\n+                           'getBoresightRotAngle', 'getDarkTime', 'getDate', 'getExposureId',\n+                           'getExposureTime', 'getObservatory', 'getRotType', 'getWeather']\n+\n+        test_values = [1.00015190967402, Coord(afwGeom.Point2D(0.0, 89.0), afwGeom.degrees, 2000.),\n+                       IcrsCoord(afwGeom.Point2D(53.0091385, -27.4389488), afwGeom.degrees),\n+                       afwGeom.Angle(-2.5653486740055484, afwGeom.radians), 30.0,\n+                       DateTime(\"1994-01-02T01:46:59.520000913\", DateTime.TAI), 430204, 30.0,\n+                       Observatory(afwGeom.Angle(-70.749417, afwGeom.degrees),\n+                                   afwGeom.Angle(-30.244633, afwGeom.degrees), 2663), 1,\n+                       Weather(20, 69327.64145580001, np.nan)]\n+\n+        def test_weather(w1, w2):\n+            \"\"\"Test equality of two Weather objects\n+            @param[in] w1  First Weather object\n+            @param[in] w2  Second Weather object\n+            \"\"\"\n+            humid_bool = np.isnan(w1.getHumidity()) and np.isnan(w2.getHumidity())\n+            if not humid_bool:\n+                humid_bool = (w1.getHumidity() == w2.getHumidity())\n+            self.assertTrue(w1.getAirPressure() == w2.getAirPressure() and w1.getAirTemperature() ==\n+                            w2.getAirTemperature() and humid_bool)\n+\n+        ae = self.assertEqual\n+        test_with = [ae, ae, ae, self.assertAnglesNearlyEqual, ae, ae, ae, ae, ae, ae, test_weather]\n+\n+        vi = exposure.getInfo().getVisitInfo()","path":"tests/testGetEimage.py","position":85,"original_position":83,"commit_id":"aceb269f24db090fa9e4aa2676edf4e0244f6994","original_commit_id":"d2ab059d34cf5dd17191aab9ab557a9d7a737fd9","user":{"login":"parejkoj","id":1606089,"avatar_url":"https://avatars.githubusercontent.com/u/1606089?v=3","gravatar_id":"","url":"https://api.github.com/users/parejkoj","html_url":"https://github.com/parejkoj","followers_url":"https://api.github.com/users/parejkoj/followers","following_url":"https://api.github.com/users/parejkoj/following{/other_user}","gists_url":"https://api.github.com/users/parejkoj/gists{/gist_id}","starred_url":"https://api.github.com/users/parejkoj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/parejkoj/subscriptions","organizations_url":"https://api.github.com/users/parejkoj/orgs","repos_url":"https://api.github.com/users/parejkoj/repos","events_url":"https://api.github.com/users/parejkoj/events{/privacy}","received_events_url":"https://api.github.com/users/parejkoj/received_events","type":"User","site_admin":false},"body":"Please don't use such short variable names. It makes it harder to find where they are used and more likely for them to be shadowed elsewhere.","created_at":"2016-11-01T07:37:09Z","updated_at":"2016-11-01T07:40:18Z","html_url":"https://github.com/lsst/obs_lsstSim/pull/25#discussion_r85885684","pull_request_url":"https://api.github.com/repos/lsst/obs_lsstSim/pulls/25","_links":{"self":{"href":"https://api.github.com/repos/lsst/obs_lsstSim/pulls/comments/85885684"},"html":{"href":"https://github.com/lsst/obs_lsstSim/pull/25#discussion_r85885684"},"pull_request":{"href":"https://api.github.com/repos/lsst/obs_lsstSim/pulls/25"}}},"pull_request":{"url":"https://api.github.com/repos/lsst/obs_lsstSim/pulls/25","id":90256992,"html_url":"https://github.com/lsst/obs_lsstSim/pull/25","diff_url":"https://github.com/lsst/obs_lsstSim/pull/25.diff","patch_url":"https://github.com/lsst/obs_lsstSim/pull/25.patch","issue_url":"https://api.github.com/repos/lsst/obs_lsstSim/issues/25","number":25,"state":"open","locked":false,"title":"Add VisitInfo the the eimages","user":{"login":"SimonKrughoff","id":945715,"avatar_url":"https://avatars.githubusercontent.com/u/945715?v=3","gravatar_id":"","url":"https://api.github.com/users/SimonKrughoff","html_url":"https://github.com/SimonKrughoff","followers_url":"https://api.github.com/users/SimonKrughoff/followers","following_url":"https://api.github.com/users/SimonKrughoff/following{/other_user}","gists_url":"https://api.github.com/users/SimonKrughoff/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonKrughoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonKrughoff/subscriptions","organizations_url":"https://api.github.com/users/SimonKrughoff/orgs","repos_url":"https://api.github.com/users/SimonKrughoff/repos","events_url":"https://api.github.com/users/SimonKrughoff/events{/privacy}","received_events_url":"https://api.github.com/users/SimonKrughoff/received_events","type":"User","site_admin":false},"body":"Make changes necessary to get VisitInfo attached to the calexp when using\nprocessEimage.py.\n\nThere are three related changes.  They are all in a single commit because\nthey are all needed for the solution to work.\n1. Move eimage from the datasets to the exposures section of the policy file and\n   change the datatype to be DecoratedImageU.  If it is ExposureF, some of the\n   header cards needed for the VisitInfo are stripped too early.\n2. Convert the input image to floating point.  It is unsigned int on input.  This\n   also fixes a bug in assigning the variance plane.\n3. Add the necessary boilerplate to the mapper.  This is in std_eimage and was\n   essentially cargoculted from std_raw in obs.base.CameraMapper.\n","created_at":"2016-10-20T18:38:05Z","updated_at":"2016-11-01T07:40:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"25188655a6c51353dc668c1d3c33fc185185f302","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/lsst/obs_lsstSim/pulls/25/commits","review_comments_url":"https://api.github.com/repos/lsst/obs_lsstSim/pulls/25/comments","review_comment_url":"https://api.github.com/repos/lsst/obs_lsstSim/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lsst/obs_lsstSim/issues/25/comments","statuses_url":"https://api.github.com/repos/lsst/obs_lsstSim/statuses/aceb269f24db090fa9e4aa2676edf4e0244f6994","head":{"label":"lsst:tickets/DM-8027","ref":"tickets/DM-8027","sha":"aceb269f24db090fa9e4aa2676edf4e0244f6994","user":{"login":"lsst","id":1134504,"avatar_url":"https://avatars.githubusercontent.com/u/1134504?v=3","gravatar_id":"","url":"https://api.github.com/users/lsst","html_url":"https://github.com/lsst","followers_url":"https://api.github.com/users/lsst/followers","following_url":"https://api.github.com/users/lsst/following{/other_user}","gists_url":"https://api.github.com/users/lsst/gists{/gist_id}","starred_url":"https://api.github.com/users/lsst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsst/subscriptions","organizations_url":"https://api.github.com/users/lsst/orgs","repos_url":"https://api.github.com/users/lsst/repos","events_url":"https://api.github.com/users/lsst/events{/privacy}","received_events_url":"https://api.github.com/users/lsst/received_events","type":"Organization","site_admin":false},"repo":{"id":23013415,"name":"obs_lsstSim","full_name":"lsst/obs_lsstSim","owner":{"login":"lsst","id":1134504,"avatar_url":"https://avatars.githubusercontent.com/u/1134504?v=3","gravatar_id":"","url":"https://api.github.com/users/lsst","html_url":"https://github.com/lsst","followers_url":"https://api.github.com/users/lsst/followers","following_url":"https://api.github.com/users/lsst/following{/other_user}","gists_url":"https://api.github.com/users/lsst/gists{/gist_id}","starred_url":"https://api.github.com/users/lsst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsst/subscriptions","organizations_url":"https://api.github.com/users/lsst/orgs","repos_url":"https://api.github.com/users/lsst/repos","events_url":"https://api.github.com/users/lsst/events{/privacy}","received_events_url":"https://api.github.com/users/lsst/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lsst/obs_lsstSim","description":"Configuration and tasks for the simulated LSST camera (lsstSim) for the LSST Data Management Stack","fork":false,"url":"https://api.github.com/repos/lsst/obs_lsstSim","forks_url":"https://api.github.com/repos/lsst/obs_lsstSim/forks","keys_url":"https://api.github.com/repos/lsst/obs_lsstSim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lsst/obs_lsstSim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lsst/obs_lsstSim/teams","hooks_url":"https://api.github.com/repos/lsst/obs_lsstSim/hooks","issue_events_url":"https://api.github.com/repos/lsst/obs_lsstSim/issues/events{/number}","events_url":"https://api.github.com/repos/lsst/obs_lsstSim/events","assignees_url":"https://api.github.com/repos/lsst/obs_lsstSim/assignees{/user}","branches_url":"https://api.github.com/repos/lsst/obs_lsstSim/branches{/branch}","tags_url":"https://api.github.com/repos/lsst/obs_lsstSim/tags","blobs_url":"https://api.github.com/repos/lsst/obs_lsstSim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lsst/obs_lsstSim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lsst/obs_lsstSim/git/refs{/sha}","trees_url":"https://api.github.com/repos/lsst/obs_lsstSim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lsst/obs_lsstSim/statuses/{sha}","languages_url":"https://api.github.com/repos/lsst/obs_lsstSim/languages","stargazers_url":"https://api.github.com/repos/lsst/obs_lsstSim/stargazers","contributors_url":"https://api.github.com/repos/lsst/obs_lsstSim/contributors","subscribers_url":"https://api.github.com/repos/lsst/obs_lsstSim/subscribers","subscription_url":"https://api.github.com/repos/lsst/obs_lsstSim/subscription","commits_url":"https://api.github.com/repos/lsst/obs_lsstSim/commits{/sha}","git_commits_url":"https://api.github.com/repos/lsst/obs_lsstSim/git/commits{/sha}","comments_url":"https://api.github.com/repos/lsst/obs_lsstSim/comments{/number}","issue_comment_url":"https://api.github.com/repos/lsst/obs_lsstSim/issues/comments{/number}","contents_url":"https://api.github.com/repos/lsst/obs_lsstSim/contents/{+path}","compare_url":"https://api.github.com/repos/lsst/obs_lsstSim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lsst/obs_lsstSim/merges","archive_url":"https://api.github.com/repos/lsst/obs_lsstSim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lsst/obs_lsstSim/downloads","issues_url":"https://api.github.com/repos/lsst/obs_lsstSim/issues{/number}","pulls_url":"https://api.github.com/repos/lsst/obs_lsstSim/pulls{/number}","milestones_url":"https://api.github.com/repos/lsst/obs_lsstSim/milestones{/number}","notifications_url":"https://api.github.com/repos/lsst/obs_lsstSim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lsst/obs_lsstSim/labels{/name}","releases_url":"https://api.github.com/repos/lsst/obs_lsstSim/releases{/id}","deployments_url":"https://api.github.com/repos/lsst/obs_lsstSim/deployments","created_at":"2014-08-16T07:48:02Z","updated_at":"2016-10-30T20:30:18Z","pushed_at":"2016-10-31T22:59:22Z","git_url":"git://github.com/lsst/obs_lsstSim.git","ssh_url":"git@github.com:lsst/obs_lsstSim.git","clone_url":"https://github.com/lsst/obs_lsstSim.git","svn_url":"https://github.com/lsst/obs_lsstSim","homepage":"","size":62662,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":4,"forks":4,"open_issues":4,"watchers":1,"default_branch":"master"}},"base":{"label":"lsst:master","ref":"master","sha":"49cb66e2fb604a8ba135bbaca3854d7f01f69d04","user":{"login":"lsst","id":1134504,"avatar_url":"https://avatars.githubusercontent.com/u/1134504?v=3","gravatar_id":"","url":"https://api.github.com/users/lsst","html_url":"https://github.com/lsst","followers_url":"https://api.github.com/users/lsst/followers","following_url":"https://api.github.com/users/lsst/following{/other_user}","gists_url":"https://api.github.com/users/lsst/gists{/gist_id}","starred_url":"https://api.github.com/users/lsst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsst/subscriptions","organizations_url":"https://api.github.com/users/lsst/orgs","repos_url":"https://api.github.com/users/lsst/repos","events_url":"https://api.github.com/users/lsst/events{/privacy}","received_events_url":"https://api.github.com/users/lsst/received_events","type":"Organization","site_admin":false},"repo":{"id":23013415,"name":"obs_lsstSim","full_name":"lsst/obs_lsstSim","owner":{"login":"lsst","id":1134504,"avatar_url":"https://avatars.githubusercontent.com/u/1134504?v=3","gravatar_id":"","url":"https://api.github.com/users/lsst","html_url":"https://github.com/lsst","followers_url":"https://api.github.com/users/lsst/followers","following_url":"https://api.github.com/users/lsst/following{/other_user}","gists_url":"https://api.github.com/users/lsst/gists{/gist_id}","starred_url":"https://api.github.com/users/lsst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsst/subscriptions","organizations_url":"https://api.github.com/users/lsst/orgs","repos_url":"https://api.github.com/users/lsst/repos","events_url":"https://api.github.com/users/lsst/events{/privacy}","received_events_url":"https://api.github.com/users/lsst/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lsst/obs_lsstSim","description":"Configuration and tasks for the simulated LSST camera (lsstSim) for the LSST Data Management Stack","fork":false,"url":"https://api.github.com/repos/lsst/obs_lsstSim","forks_url":"https://api.github.com/repos/lsst/obs_lsstSim/forks","keys_url":"https://api.github.com/repos/lsst/obs_lsstSim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lsst/obs_lsstSim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lsst/obs_lsstSim/teams","hooks_url":"https://api.github.com/repos/lsst/obs_lsstSim/hooks","issue_events_url":"https://api.github.com/repos/lsst/obs_lsstSim/issues/events{/number}","events_url":"https://api.github.com/repos/lsst/obs_lsstSim/events","assignees_url":"https://api.github.com/repos/lsst/obs_lsstSim/assignees{/user}","branches_url":"https://api.github.com/repos/lsst/obs_lsstSim/branches{/branch}","tags_url":"https://api.github.com/repos/lsst/obs_lsstSim/tags","blobs_url":"https://api.github.com/repos/lsst/obs_lsstSim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lsst/obs_lsstSim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lsst/obs_lsstSim/git/refs{/sha}","trees_url":"https://api.github.com/repos/lsst/obs_lsstSim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lsst/obs_lsstSim/statuses/{sha}","languages_url":"https://api.github.com/repos/lsst/obs_lsstSim/languages","stargazers_url":"https://api.github.com/repos/lsst/obs_lsstSim/stargazers","contributors_url":"https://api.github.com/repos/lsst/obs_lsstSim/contributors","subscribers_url":"https://api.github.com/repos/lsst/obs_lsstSim/subscribers","subscription_url":"https://api.github.com/repos/lsst/obs_lsstSim/subscription","commits_url":"https://api.github.com/repos/lsst/obs_lsstSim/commits{/sha}","git_commits_url":"https://api.github.com/repos/lsst/obs_lsstSim/git/commits{/sha}","comments_url":"https://api.github.com/repos/lsst/obs_lsstSim/comments{/number}","issue_comment_url":"https://api.github.com/repos/lsst/obs_lsstSim/issues/comments{/number}","contents_url":"https://api.github.com/repos/lsst/obs_lsstSim/contents/{+path}","compare_url":"https://api.github.com/repos/lsst/obs_lsstSim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lsst/obs_lsstSim/merges","archive_url":"https://api.github.com/repos/lsst/obs_lsstSim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lsst/obs_lsstSim/downloads","issues_url":"https://api.github.com/repos/lsst/obs_lsstSim/issues{/number}","pulls_url":"https://api.github.com/repos/lsst/obs_lsstSim/pulls{/number}","milestones_url":"https://api.github.com/repos/lsst/obs_lsstSim/milestones{/number}","notifications_url":"https://api.github.com/repos/lsst/obs_lsstSim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lsst/obs_lsstSim/labels{/name}","releases_url":"https://api.github.com/repos/lsst/obs_lsstSim/releases{/id}","deployments_url":"https://api.github.com/repos/lsst/obs_lsstSim/deployments","created_at":"2014-08-16T07:48:02Z","updated_at":"2016-10-30T20:30:18Z","pushed_at":"2016-10-31T22:59:22Z","git_url":"git://github.com/lsst/obs_lsstSim.git","ssh_url":"git@github.com:lsst/obs_lsstSim.git","clone_url":"https://github.com/lsst/obs_lsstSim.git","svn_url":"https://github.com/lsst/obs_lsstSim","homepage":"","size":62662,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":4,"forks":4,"open_issues":4,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lsst/obs_lsstSim/pulls/25"},"html":{"href":"https://github.com/lsst/obs_lsstSim/pull/25"},"issue":{"href":"https://api.github.com/repos/lsst/obs_lsstSim/issues/25"},"comments":{"href":"https://api.github.com/repos/lsst/obs_lsstSim/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/lsst/obs_lsstSim/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/lsst/obs_lsstSim/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lsst/obs_lsstSim/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/lsst/obs_lsstSim/statuses/aceb269f24db090fa9e4aa2676edf4e0244f6994"}}}}
{"actor":{"display_login":"parejkoj"}}