{"action":"created","comment":{"url":"https://api.github.com/repos/spacetelescope/mirage/pulls/comments/213521180","pull_request_review_id":150375015,"id":213521180,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMzUyMTE4MA==","diff_hunk":"@@ -0,0 +1,145 @@\n+\"\"\"SIAF interface module to support accessing SIAF information.\n+\n+This module provides ``mirage`` with functions to interface SIAF content via the pysiaf module.\n+\n+Authors\n+-------\n+\n+    - Johannes Sahlmann\n+\n+Use\n+---\n+\n+    This module can be imported and used with\n+\n+    ::\n+\n+        from mirage.utils import siaf_interface\n+\n+\"\"\"\n+\n+import numpy as np\n+\n+import pysiaf\n+from pysiaf import iando\n+from ..utils import rotations\n+from ..utils import set_telescope_pointing_separated as set_telescope_pointing\n+\n+\n+def get_siaf_information(instrument, aperture, ra, dec, telescope_roll):\n+    \"\"\"Use pysiaf to get aperture information\n+\n+    Parameters\n+    ----------\n+    instrument : str\n+        Instrument name.\n+\n+    aperture : str\n+        Aperture name (e.g. \"NRCA1_FULL\")\n+    \"\"\"\n+    siaf = pysiaf.Siaf(instrument)[aperture]\n+    local_roll = set_telescope_pointing.compute_local_roll(telescope_roll,\n+                                                           ra, dec, siaf.V2Ref,\n+                                                           siaf.V3Ref)\n+    # Create attitude_matrix\n+    att_matrix = rotations.attitude(siaf.V2Ref, siaf.V3Ref, ra, dec, local_roll)\n+\n+    # Get full frame size\n+    fullframesize = siaf.XDetSize\n+\n+    # Subarray boundaries in full frame coordinates\n+    xcorner, ycorner = sci_subarray_corners(instrument, aperture)\n+    subarray_boundaries = [xcorner[0], ycorner[0], xcorner[1], ycorner[1]]\n+    return siaf, local_roll, att_matrix, fullframesize, subarray_boundaries\n+\n+\n+def sci_subarray_corners(instrument, aperture_name, verbose=False):\n+    \"\"\"Return the two opposing aperture corners in the SIAF Science frame of the full-frame SCA.\n+\n+    This function serves as interface between the SIAF information accessible via the pysiaf package\n+    and the subarray information formatted for use by mirage.\n+\n+    Parameters\n+    ----------\n+    instrument : str\n+        JWST instrument name with correct capitalization\n+    aperture_name : str\n+        SIAF aperture name\n+    verbose : bool\n+        Verbose output on/off\n+\n+    Returns\n+    -------\n+    x_sci, y_sci : tuple of numpy arrays\n+        Subarray corner coordinates\n+\n+    \"\"\"\n+    # get SIAF\n+    siaf = pysiaf.Siaf(instrument)\n+\n+    # get master aperture names\n+    siaf_detector_layout = iando.read.read_siaf_detector_layout()\n+    master_aperture_names = siaf_detector_layout['AperName'].data\n+\n+    # read pysiaf aperture definition file containing DetRef and SciRef values\n+    siaf_aperture_definitions = iando.read.read_siaf_aperture_definitions(instrument)","path":"mirage/utils/siaf_interface.py","position":85,"original_position":85,"commit_id":"bb918a3a2750e6148bff3e4d418059ad40b2b7b1","original_commit_id":"bb918a3a2750e6148bff3e4d418059ad40b2b7b1","user":{"login":"bhilbert4","id":11775426,"node_id":"MDQ6VXNlcjExNzc1NDI2","avatar_url":"https://avatars3.githubusercontent.com/u/11775426?v=4","gravatar_id":"","url":"https://api.github.com/users/bhilbert4","html_url":"https://github.com/bhilbert4","followers_url":"https://api.github.com/users/bhilbert4/followers","following_url":"https://api.github.com/users/bhilbert4/following{/other_user}","gists_url":"https://api.github.com/users/bhilbert4/gists{/gist_id}","starred_url":"https://api.github.com/users/bhilbert4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhilbert4/subscriptions","organizations_url":"https://api.github.com/users/bhilbert4/orgs","repos_url":"https://api.github.com/users/bhilbert4/repos","events_url":"https://api.github.com/users/bhilbert4/events{/privacy}","received_events_url":"https://api.github.com/users/bhilbert4/received_events","type":"User","site_admin":false},"body":"Try updating your pysiaf installation. Johannes just released a new version with the FGS file last week.","created_at":"2018-08-29T01:33:38Z","updated_at":"2018-08-29T01:33:38Z","html_url":"https://github.com/spacetelescope/mirage/pull/156#discussion_r213521180","pull_request_url":"https://api.github.com/repos/spacetelescope/mirage/pulls/156","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/spacetelescope/mirage/pulls/comments/213521180"},"html":{"href":"https://github.com/spacetelescope/mirage/pull/156#discussion_r213521180"},"pull_request":{"href":"https://api.github.com/repos/spacetelescope/mirage/pulls/156"}},"in_reply_to_id":213479450},"pull_request":{"url":"https://api.github.com/repos/spacetelescope/mirage/pulls/156","id":211551128,"node_id":"MDExOlB1bGxSZXF1ZXN0MjExNTUxMTI4","html_url":"https://github.com/spacetelescope/mirage/pull/156","diff_url":"https://github.com/spacetelescope/mirage/pull/156.diff","patch_url":"https://github.com/spacetelescope/mirage/pull/156.patch","issue_url":"https://api.github.com/repos/spacetelescope/mirage/issues/156","number":156,"state":"open","locked":false,"title":"Pysiaf integration","user":{"login":"bhilbert4","id":11775426,"node_id":"MDQ6VXNlcjExNzc1NDI2","avatar_url":"https://avatars3.githubusercontent.com/u/11775426?v=4","gravatar_id":"","url":"https://api.github.com/users/bhilbert4","html_url":"https://github.com/bhilbert4","followers_url":"https://api.github.com/users/bhilbert4/followers","following_url":"https://api.github.com/users/bhilbert4/following{/other_user}","gists_url":"https://api.github.com/users/bhilbert4/gists{/gist_id}","starred_url":"https://api.github.com/users/bhilbert4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhilbert4/subscriptions","organizations_url":"https://api.github.com/users/bhilbert4/orgs","repos_url":"https://api.github.com/users/bhilbert4/repos","events_url":"https://api.github.com/users/bhilbert4/events{/privacy}","received_events_url":"https://api.github.com/users/bhilbert4/received_events","type":"User","site_admin":false},"body":"NOTE: Re-opening this PR. An error broke the previous PR before it was merged.\r\n\r\nThis PR introduces code to use pysiaf when calculating things like subarray sizes and positions, and for translating between detector pixels and RA, Dec. This will eliminate the dependence on the subarray definition file in the config directory except for 2 pieces of information: the number of amplifiers used to read out a particular aperture, as well as the OPGS (I think?) name for the aperture. This name is needed only to populate metadata in the output file. The number of amplifiers used is needed in order to get an accurate result for the calculation of the readout time. \r\n\r\nCRDS formatted distortion reference files will still be used for RA, Dec -> pixel space coordinate transforms. This is because in the future these files will be the only source for filter-dependent distortion solutions. If these files are not present, then the code will fall back onto `pysiaf` for these transformations. \r\n\r\nI think this is ready for a final review. Does anyone have time to grab the branch and run a test or two? Everything works for me, but it'd be nice to have confirmation. @KevinVolkSTScI? @laurenmarietta?","created_at":"2018-08-28T20:40:31Z","updated_at":"2018-08-29T01:33:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"84f68e30fe85fe9ee1b9809539c2e71ca07a2744","assignee":null,"assignees":[],"requested_reviewers":[{"login":"KevinVolkSTScI","id":37000208,"node_id":"MDQ6VXNlcjM3MDAwMjA4","avatar_url":"https://avatars3.githubusercontent.com/u/37000208?v=4","gravatar_id":"","url":"https://api.github.com/users/KevinVolkSTScI","html_url":"https://github.com/KevinVolkSTScI","followers_url":"https://api.github.com/users/KevinVolkSTScI/followers","following_url":"https://api.github.com/users/KevinVolkSTScI/following{/other_user}","gists_url":"https://api.github.com/users/KevinVolkSTScI/gists{/gist_id}","starred_url":"https://api.github.com/users/KevinVolkSTScI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KevinVolkSTScI/subscriptions","organizations_url":"https://api.github.com/users/KevinVolkSTScI/orgs","repos_url":"https://api.github.com/users/KevinVolkSTScI/repos","events_url":"https://api.github.com/users/KevinVolkSTScI/events{/privacy}","received_events_url":"https://api.github.com/users/KevinVolkSTScI/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/spacetelescope/mirage/pulls/156/commits","review_comments_url":"https://api.github.com/repos/spacetelescope/mirage/pulls/156/comments","review_comment_url":"https://api.github.com/repos/spacetelescope/mirage/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spacetelescope/mirage/issues/156/comments","statuses_url":"https://api.github.com/repos/spacetelescope/mirage/statuses/bb918a3a2750e6148bff3e4d418059ad40b2b7b1","head":{"label":"bhilbert4:pysiaf-integration","ref":"pysiaf-integration","sha":"bb918a3a2750e6148bff3e4d418059ad40b2b7b1","user":{"login":"bhilbert4","id":11775426,"node_id":"MDQ6VXNlcjExNzc1NDI2","avatar_url":"https://avatars3.githubusercontent.com/u/11775426?v=4","gravatar_id":"","url":"https://api.github.com/users/bhilbert4","html_url":"https://github.com/bhilbert4","followers_url":"https://api.github.com/users/bhilbert4/followers","following_url":"https://api.github.com/users/bhilbert4/following{/other_user}","gists_url":"https://api.github.com/users/bhilbert4/gists{/gist_id}","starred_url":"https://api.github.com/users/bhilbert4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhilbert4/subscriptions","organizations_url":"https://api.github.com/users/bhilbert4/orgs","repos_url":"https://api.github.com/users/bhilbert4/repos","events_url":"https://api.github.com/users/bhilbert4/events{/privacy}","received_events_url":"https://api.github.com/users/bhilbert4/received_events","type":"User","site_admin":false},"repo":{"id":142904924,"node_id":"MDEwOlJlcG9zaXRvcnkxNDI5MDQ5MjQ=","name":"mirage","full_name":"bhilbert4/mirage","owner":{"login":"bhilbert4","id":11775426,"node_id":"MDQ6VXNlcjExNzc1NDI2","avatar_url":"https://avatars3.githubusercontent.com/u/11775426?v=4","gravatar_id":"","url":"https://api.github.com/users/bhilbert4","html_url":"https://github.com/bhilbert4","followers_url":"https://api.github.com/users/bhilbert4/followers","following_url":"https://api.github.com/users/bhilbert4/following{/other_user}","gists_url":"https://api.github.com/users/bhilbert4/gists{/gist_id}","starred_url":"https://api.github.com/users/bhilbert4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhilbert4/subscriptions","organizations_url":"https://api.github.com/users/bhilbert4/orgs","repos_url":"https://api.github.com/users/bhilbert4/repos","events_url":"https://api.github.com/users/bhilbert4/events{/privacy}","received_events_url":"https://api.github.com/users/bhilbert4/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bhilbert4/mirage","description":"This code can be used to generate simulated NIRCam, NIRISS, or FGS data ","fork":true,"url":"https://api.github.com/repos/bhilbert4/mirage","forks_url":"https://api.github.com/repos/bhilbert4/mirage/forks","keys_url":"https://api.github.com/repos/bhilbert4/mirage/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bhilbert4/mirage/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bhilbert4/mirage/teams","hooks_url":"https://api.github.com/repos/bhilbert4/mirage/hooks","issue_events_url":"https://api.github.com/repos/bhilbert4/mirage/issues/events{/number}","events_url":"https://api.github.com/repos/bhilbert4/mirage/events","assignees_url":"https://api.github.com/repos/bhilbert4/mirage/assignees{/user}","branches_url":"https://api.github.com/repos/bhilbert4/mirage/branches{/branch}","tags_url":"https://api.github.com/repos/bhilbert4/mirage/tags","blobs_url":"https://api.github.com/repos/bhilbert4/mirage/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bhilbert4/mirage/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bhilbert4/mirage/git/refs{/sha}","trees_url":"https://api.github.com/repos/bhilbert4/mirage/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bhilbert4/mirage/statuses/{sha}","languages_url":"https://api.github.com/repos/bhilbert4/mirage/languages","stargazers_url":"https://api.github.com/repos/bhilbert4/mirage/stargazers","contributors_url":"https://api.github.com/repos/bhilbert4/mirage/contributors","subscribers_url":"https://api.github.com/repos/bhilbert4/mirage/subscribers","subscription_url":"https://api.github.com/repos/bhilbert4/mirage/subscription","commits_url":"https://api.github.com/repos/bhilbert4/mirage/commits{/sha}","git_commits_url":"https://api.github.com/repos/bhilbert4/mirage/git/commits{/sha}","comments_url":"https://api.github.com/repos/bhilbert4/mirage/comments{/number}","issue_comment_url":"https://api.github.com/repos/bhilbert4/mirage/issues/comments{/number}","contents_url":"https://api.github.com/repos/bhilbert4/mirage/contents/{+path}","compare_url":"https://api.github.com/repos/bhilbert4/mirage/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bhilbert4/mirage/merges","archive_url":"https://api.github.com/repos/bhilbert4/mirage/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bhilbert4/mirage/downloads","issues_url":"https://api.github.com/repos/bhilbert4/mirage/issues{/number}","pulls_url":"https://api.github.com/repos/bhilbert4/mirage/pulls{/number}","milestones_url":"https://api.github.com/repos/bhilbert4/mirage/milestones{/number}","notifications_url":"https://api.github.com/repos/bhilbert4/mirage/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bhilbert4/mirage/labels{/name}","releases_url":"https://api.github.com/repos/bhilbert4/mirage/releases{/id}","deployments_url":"https://api.github.com/repos/bhilbert4/mirage/deployments","created_at":"2018-07-30T17:07:31Z","updated_at":"2018-08-28T18:10:26Z","pushed_at":"2018-08-28T21:08:52Z","git_url":"git://github.com/bhilbert4/mirage.git","ssh_url":"git@github.com:bhilbert4/mirage.git","clone_url":"https://github.com/bhilbert4/mirage.git","svn_url":"https://github.com/bhilbert4/mirage","homepage":"","size":16809,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"spacetelescope:master","ref":"master","sha":"20f95b288b64b6bf8fb67ac2556b38a037c6aa8f","user":{"login":"spacetelescope","id":2751928,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI3NTE5Mjg=","avatar_url":"https://avatars3.githubusercontent.com/u/2751928?v=4","gravatar_id":"","url":"https://api.github.com/users/spacetelescope","html_url":"https://github.com/spacetelescope","followers_url":"https://api.github.com/users/spacetelescope/followers","following_url":"https://api.github.com/users/spacetelescope/following{/other_user}","gists_url":"https://api.github.com/users/spacetelescope/gists{/gist_id}","starred_url":"https://api.github.com/users/spacetelescope/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spacetelescope/subscriptions","organizations_url":"https://api.github.com/users/spacetelescope/orgs","repos_url":"https://api.github.com/users/spacetelescope/repos","events_url":"https://api.github.com/users/spacetelescope/events{/privacy}","received_events_url":"https://api.github.com/users/spacetelescope/received_events","type":"Organization","site_admin":false},"repo":{"id":109982775,"node_id":"MDEwOlJlcG9zaXRvcnkxMDk5ODI3NzU=","name":"mirage","full_name":"spacetelescope/mirage","owner":{"login":"spacetelescope","id":2751928,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI3NTE5Mjg=","avatar_url":"https://avatars3.githubusercontent.com/u/2751928?v=4","gravatar_id":"","url":"https://api.github.com/users/spacetelescope","html_url":"https://github.com/spacetelescope","followers_url":"https://api.github.com/users/spacetelescope/followers","following_url":"https://api.github.com/users/spacetelescope/following{/other_user}","gists_url":"https://api.github.com/users/spacetelescope/gists{/gist_id}","starred_url":"https://api.github.com/users/spacetelescope/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spacetelescope/subscriptions","organizations_url":"https://api.github.com/users/spacetelescope/orgs","repos_url":"https://api.github.com/users/spacetelescope/repos","events_url":"https://api.github.com/users/spacetelescope/events{/privacy}","received_events_url":"https://api.github.com/users/spacetelescope/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spacetelescope/mirage","description":"This code can be used to generate simulated NIRCam, NIRISS, or FGS data ","fork":false,"url":"https://api.github.com/repos/spacetelescope/mirage","forks_url":"https://api.github.com/repos/spacetelescope/mirage/forks","keys_url":"https://api.github.com/repos/spacetelescope/mirage/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spacetelescope/mirage/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spacetelescope/mirage/teams","hooks_url":"https://api.github.com/repos/spacetelescope/mirage/hooks","issue_events_url":"https://api.github.com/repos/spacetelescope/mirage/issues/events{/number}","events_url":"https://api.github.com/repos/spacetelescope/mirage/events","assignees_url":"https://api.github.com/repos/spacetelescope/mirage/assignees{/user}","branches_url":"https://api.github.com/repos/spacetelescope/mirage/branches{/branch}","tags_url":"https://api.github.com/repos/spacetelescope/mirage/tags","blobs_url":"https://api.github.com/repos/spacetelescope/mirage/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spacetelescope/mirage/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spacetelescope/mirage/git/refs{/sha}","trees_url":"https://api.github.com/repos/spacetelescope/mirage/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spacetelescope/mirage/statuses/{sha}","languages_url":"https://api.github.com/repos/spacetelescope/mirage/languages","stargazers_url":"https://api.github.com/repos/spacetelescope/mirage/stargazers","contributors_url":"https://api.github.com/repos/spacetelescope/mirage/contributors","subscribers_url":"https://api.github.com/repos/spacetelescope/mirage/subscribers","subscription_url":"https://api.github.com/repos/spacetelescope/mirage/subscription","commits_url":"https://api.github.com/repos/spacetelescope/mirage/commits{/sha}","git_commits_url":"https://api.github.com/repos/spacetelescope/mirage/git/commits{/sha}","comments_url":"https://api.github.com/repos/spacetelescope/mirage/comments{/number}","issue_comment_url":"https://api.github.com/repos/spacetelescope/mirage/issues/comments{/number}","contents_url":"https://api.github.com/repos/spacetelescope/mirage/contents/{+path}","compare_url":"https://api.github.com/repos/spacetelescope/mirage/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spacetelescope/mirage/merges","archive_url":"https://api.github.com/repos/spacetelescope/mirage/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spacetelescope/mirage/downloads","issues_url":"https://api.github.com/repos/spacetelescope/mirage/issues{/number}","pulls_url":"https://api.github.com/repos/spacetelescope/mirage/pulls{/number}","milestones_url":"https://api.github.com/repos/spacetelescope/mirage/milestones{/number}","notifications_url":"https://api.github.com/repos/spacetelescope/mirage/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spacetelescope/mirage/labels{/name}","releases_url":"https://api.github.com/repos/spacetelescope/mirage/releases{/id}","deployments_url":"https://api.github.com/repos/spacetelescope/mirage/deployments","created_at":"2017-11-08T13:58:01Z","updated_at":"2018-08-28T21:08:47Z","pushed_at":"2018-08-28T21:08:45Z","git_url":"git://github.com/spacetelescope/mirage.git","ssh_url":"git@github.com:spacetelescope/mirage.git","clone_url":"https://github.com/spacetelescope/mirage.git","svn_url":"https://github.com/spacetelescope/mirage","homepage":"","size":16753,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"archived":false,"open_issues_count":45,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":8,"open_issues":45,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spacetelescope/mirage/pulls/156"},"html":{"href":"https://github.com/spacetelescope/mirage/pull/156"},"issue":{"href":"https://api.github.com/repos/spacetelescope/mirage/issues/156"},"comments":{"href":"https://api.github.com/repos/spacetelescope/mirage/issues/156/comments"},"review_comments":{"href":"https://api.github.com/repos/spacetelescope/mirage/pulls/156/comments"},"review_comment":{"href":"https://api.github.com/repos/spacetelescope/mirage/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spacetelescope/mirage/pulls/156/commits"},"statuses":{"href":"https://api.github.com/repos/spacetelescope/mirage/statuses/bb918a3a2750e6148bff3e4d418059ad40b2b7b1"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"bhilbert4"}}