{"action":"created","comment":{"url":"https://api.github.com/repos/LSSTDESC/imSim/pulls/comments/183773492","pull_request_review_id":114835300,"id":183773492,"diff_hunk":"@@ -0,0 +1,175 @@\n+\"\"\"\n+Simple bleed trail implementation to apply to \"eimages\" just prior to\n+the camera readout code.\n+\"\"\"\n+import lsst.afw.image as afw_image\n+import lsst.afw.detection as afw_detect\n+\n+__all__ = ['apply_channel_bleeding', 'bleed_eimage',\n+           'find_channels_with_saturation', 'bleed_channel']\n+\n+\n+def apply_channel_bleeding(gs_interpreter, full_well):\n+    \"\"\"\n+    Apply charge bleeding to eimages with channels that have pixels\n+    above full well.\n+\n+    Parameters\n+    ----------\n+    gs_interpreter: lsst.sims.GalSimInterface.GalSimInterpreter\n+        The object that is actually drawing the images\n+    full_well: int\n+        The pixel full well/saturation value in electrons.\n+    \"\"\"\n+    for gs_image in gs_interpreter.detectorImages.values():\n+        bleed_eimage(afw_image.ImageF(gs_image.array), full_well)\n+\n+\n+def bleed_eimage(eimage, full_well, midline_stop=True):\n+    \"\"\"\n+    Apply the bleed charge algorithm to an eimage.\n+\n+    Parameters\n+    ----------\n+    eimage: lsst.afw.image.ImageF\n+        The \"eimage\" containing the image data in units of electrons per\n+        pixel.  This is the image prior to electronic readout (i.e.,\n+        conversion to ADU, addition of bias, dark current, crosstalk, etc.).\n+        For LSST CCDs, the eimages have parallel transfer directions along\n+        the x-axis, hence channels correspond to rows in eimages.\n+    full_well: int\n+        The pixel full well/saturation value in electrons.\n+    midline_stop: bool [True]\n+        Flag to treat the midline of the sensor as a bleed stop.\n+\n+    Returns\n+    -------\n+    afw.image.ImageF: This is the input eimage object with the charge\n+        bleeding applied.\n+    \"\"\"\n+    channels = find_channels_with_saturation(eimage, full_well)\n+    imarr = eimage.getArray()\n+    for ypix in channels:\n+        if midline_stop:\n+            xmid = imarr.shape[1]//2\n+            imarr[ypix, :xmid] = bleed_channel(imarr[ypix, :xmid], full_well)\n+            imarr[ypix, xmid:] = bleed_channel(imarr[ypix, xmid:], full_well)\n+        else:\n+            imarr[ypix, :] = bleed_channel(imarr[ypix, :], full_well)\n+    return eimage\n+\n+\n+def find_channels_with_saturation(eimage, full_well):","path":"python/desc/imsim/bleed_trails.py","position":62,"original_position":62,"commit_id":"43ef646838690d6f6fcd8d6a5d0b241a9bd78076","original_commit_id":"43ef646838690d6f6fcd8d6a5d0b241a9bd78076","user":{"login":"jchiang87","id":1994473,"avatar_url":"https://avatars3.githubusercontent.com/u/1994473?v=4","gravatar_id":"","url":"https://api.github.com/users/jchiang87","html_url":"https://github.com/jchiang87","followers_url":"https://api.github.com/users/jchiang87/followers","following_url":"https://api.github.com/users/jchiang87/following{/other_user}","gists_url":"https://api.github.com/users/jchiang87/gists{/gist_id}","starred_url":"https://api.github.com/users/jchiang87/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jchiang87/subscriptions","organizations_url":"https://api.github.com/users/jchiang87/orgs","repos_url":"https://api.github.com/users/jchiang87/repos","events_url":"https://api.github.com/users/jchiang87/events{/privacy}","received_events_url":"https://api.github.com/users/jchiang87/received_events","type":"User","site_admin":false},"body":"I wanted to avoid `column` because it implies being parallel to the y-axis, whereas for LSST eimages, the channels are along the x-axis in the Camera Coordinate System.  Also, the `lsst.afw.detection` code has the relevant dimensions of its `span`s indexed in x.  Finally, \"channel\" seems to be the correct technical term for this feature of CCDs, e.g., see the Janesick book.","created_at":"2018-04-24T15:18:52Z","updated_at":"2018-04-24T15:18:52Z","html_url":"https://github.com/LSSTDESC/imSim/pull/110#discussion_r183773492","pull_request_url":"https://api.github.com/repos/LSSTDESC/imSim/pulls/110","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/LSSTDESC/imSim/pulls/comments/183773492"},"html":{"href":"https://github.com/LSSTDESC/imSim/pull/110#discussion_r183773492"},"pull_request":{"href":"https://api.github.com/repos/LSSTDESC/imSim/pulls/110"}},"in_reply_to_id":183729078},"pull_request":{"url":"https://api.github.com/repos/LSSTDESC/imSim/pulls/110","id":183247638,"html_url":"https://github.com/LSSTDESC/imSim/pull/110","diff_url":"https://github.com/LSSTDESC/imSim/pull/110.diff","patch_url":"https://github.com/LSSTDESC/imSim/pull/110.patch","issue_url":"https://api.github.com/repos/LSSTDESC/imSim/issues/110","number":110,"state":"open","locked":false,"title":"add bleed trail implementation","user":{"login":"jchiang87","id":1994473,"avatar_url":"https://avatars3.githubusercontent.com/u/1994473?v=4","gravatar_id":"","url":"https://api.github.com/users/jchiang87","html_url":"https://github.com/jchiang87","followers_url":"https://api.github.com/users/jchiang87/followers","following_url":"https://api.github.com/users/jchiang87/following{/other_user}","gists_url":"https://api.github.com/users/jchiang87/gists{/gist_id}","starred_url":"https://api.github.com/users/jchiang87/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jchiang87/subscriptions","organizations_url":"https://api.github.com/users/jchiang87/orgs","repos_url":"https://api.github.com/users/jchiang87/repos","events_url":"https://api.github.com/users/jchiang87/events{/privacy}","received_events_url":"https://api.github.com/users/jchiang87/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-04-21T23:48:14Z","updated_at":"2018-04-24T15:18:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0b1884920116cf426d78f54f60d26c0b0a9bc837","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/LSSTDESC/imSim/pulls/110/commits","review_comments_url":"https://api.github.com/repos/LSSTDESC/imSim/pulls/110/comments","review_comment_url":"https://api.github.com/repos/LSSTDESC/imSim/pulls/comments{/number}","comments_url":"https://api.github.com/repos/LSSTDESC/imSim/issues/110/comments","statuses_url":"https://api.github.com/repos/LSSTDESC/imSim/statuses/43ef646838690d6f6fcd8d6a5d0b241a9bd78076","head":{"label":"LSSTDESC:u/jchiang/bleed_trails","ref":"u/jchiang/bleed_trails","sha":"43ef646838690d6f6fcd8d6a5d0b241a9bd78076","user":{"login":"LSSTDESC","id":2731443,"avatar_url":"https://avatars1.githubusercontent.com/u/2731443?v=4","gravatar_id":"","url":"https://api.github.com/users/LSSTDESC","html_url":"https://github.com/LSSTDESC","followers_url":"https://api.github.com/users/LSSTDESC/followers","following_url":"https://api.github.com/users/LSSTDESC/following{/other_user}","gists_url":"https://api.github.com/users/LSSTDESC/gists{/gist_id}","starred_url":"https://api.github.com/users/LSSTDESC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LSSTDESC/subscriptions","organizations_url":"https://api.github.com/users/LSSTDESC/orgs","repos_url":"https://api.github.com/users/LSSTDESC/repos","events_url":"https://api.github.com/users/LSSTDESC/events{/privacy}","received_events_url":"https://api.github.com/users/LSSTDESC/received_events","type":"Organization","site_admin":false},"repo":{"id":70957320,"name":"imSim","full_name":"LSSTDESC/imSim","owner":{"login":"LSSTDESC","id":2731443,"avatar_url":"https://avatars1.githubusercontent.com/u/2731443?v=4","gravatar_id":"","url":"https://api.github.com/users/LSSTDESC","html_url":"https://github.com/LSSTDESC","followers_url":"https://api.github.com/users/LSSTDESC/followers","following_url":"https://api.github.com/users/LSSTDESC/following{/other_user}","gists_url":"https://api.github.com/users/LSSTDESC/gists{/gist_id}","starred_url":"https://api.github.com/users/LSSTDESC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LSSTDESC/subscriptions","organizations_url":"https://api.github.com/users/LSSTDESC/orgs","repos_url":"https://api.github.com/users/LSSTDESC/repos","events_url":"https://api.github.com/users/LSSTDESC/events{/privacy}","received_events_url":"https://api.github.com/users/LSSTDESC/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/LSSTDESC/imSim","description":"GalSim based Large Synoptic Survey Telescope (LSST) image simulation package","fork":false,"url":"https://api.github.com/repos/LSSTDESC/imSim","forks_url":"https://api.github.com/repos/LSSTDESC/imSim/forks","keys_url":"https://api.github.com/repos/LSSTDESC/imSim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/LSSTDESC/imSim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/LSSTDESC/imSim/teams","hooks_url":"https://api.github.com/repos/LSSTDESC/imSim/hooks","issue_events_url":"https://api.github.com/repos/LSSTDESC/imSim/issues/events{/number}","events_url":"https://api.github.com/repos/LSSTDESC/imSim/events","assignees_url":"https://api.github.com/repos/LSSTDESC/imSim/assignees{/user}","branches_url":"https://api.github.com/repos/LSSTDESC/imSim/branches{/branch}","tags_url":"https://api.github.com/repos/LSSTDESC/imSim/tags","blobs_url":"https://api.github.com/repos/LSSTDESC/imSim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/LSSTDESC/imSim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/LSSTDESC/imSim/git/refs{/sha}","trees_url":"https://api.github.com/repos/LSSTDESC/imSim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/LSSTDESC/imSim/statuses/{sha}","languages_url":"https://api.github.com/repos/LSSTDESC/imSim/languages","stargazers_url":"https://api.github.com/repos/LSSTDESC/imSim/stargazers","contributors_url":"https://api.github.com/repos/LSSTDESC/imSim/contributors","subscribers_url":"https://api.github.com/repos/LSSTDESC/imSim/subscribers","subscription_url":"https://api.github.com/repos/LSSTDESC/imSim/subscription","commits_url":"https://api.github.com/repos/LSSTDESC/imSim/commits{/sha}","git_commits_url":"https://api.github.com/repos/LSSTDESC/imSim/git/commits{/sha}","comments_url":"https://api.github.com/repos/LSSTDESC/imSim/comments{/number}","issue_comment_url":"https://api.github.com/repos/LSSTDESC/imSim/issues/comments{/number}","contents_url":"https://api.github.com/repos/LSSTDESC/imSim/contents/{+path}","compare_url":"https://api.github.com/repos/LSSTDESC/imSim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/LSSTDESC/imSim/merges","archive_url":"https://api.github.com/repos/LSSTDESC/imSim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/LSSTDESC/imSim/downloads","issues_url":"https://api.github.com/repos/LSSTDESC/imSim/issues{/number}","pulls_url":"https://api.github.com/repos/LSSTDESC/imSim/pulls{/number}","milestones_url":"https://api.github.com/repos/LSSTDESC/imSim/milestones{/number}","notifications_url":"https://api.github.com/repos/LSSTDESC/imSim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/LSSTDESC/imSim/labels{/name}","releases_url":"https://api.github.com/repos/LSSTDESC/imSim/releases{/id}","deployments_url":"https://api.github.com/repos/LSSTDESC/imSim/deployments","created_at":"2016-10-15T00:53:14Z","updated_at":"2018-04-21T13:37:53Z","pushed_at":"2018-04-24T01:32:11Z","git_url":"git://github.com/LSSTDESC/imSim.git","ssh_url":"git@github.com:LSSTDESC/imSim.git","clone_url":"https://github.com/LSSTDESC/imSim.git","svn_url":"https://github.com/LSSTDESC/imSim","homepage":"","size":2654,"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":3,"mirror_url":null,"archived":false,"open_issues_count":38,"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"},"forks":3,"open_issues":38,"watchers":0,"default_branch":"master"}},"base":{"label":"LSSTDESC:master","ref":"master","sha":"6d3478a329563033e695c15706aa949025978d63","user":{"login":"LSSTDESC","id":2731443,"avatar_url":"https://avatars1.githubusercontent.com/u/2731443?v=4","gravatar_id":"","url":"https://api.github.com/users/LSSTDESC","html_url":"https://github.com/LSSTDESC","followers_url":"https://api.github.com/users/LSSTDESC/followers","following_url":"https://api.github.com/users/LSSTDESC/following{/other_user}","gists_url":"https://api.github.com/users/LSSTDESC/gists{/gist_id}","starred_url":"https://api.github.com/users/LSSTDESC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LSSTDESC/subscriptions","organizations_url":"https://api.github.com/users/LSSTDESC/orgs","repos_url":"https://api.github.com/users/LSSTDESC/repos","events_url":"https://api.github.com/users/LSSTDESC/events{/privacy}","received_events_url":"https://api.github.com/users/LSSTDESC/received_events","type":"Organization","site_admin":false},"repo":{"id":70957320,"name":"imSim","full_name":"LSSTDESC/imSim","owner":{"login":"LSSTDESC","id":2731443,"avatar_url":"https://avatars1.githubusercontent.com/u/2731443?v=4","gravatar_id":"","url":"https://api.github.com/users/LSSTDESC","html_url":"https://github.com/LSSTDESC","followers_url":"https://api.github.com/users/LSSTDESC/followers","following_url":"https://api.github.com/users/LSSTDESC/following{/other_user}","gists_url":"https://api.github.com/users/LSSTDESC/gists{/gist_id}","starred_url":"https://api.github.com/users/LSSTDESC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LSSTDESC/subscriptions","organizations_url":"https://api.github.com/users/LSSTDESC/orgs","repos_url":"https://api.github.com/users/LSSTDESC/repos","events_url":"https://api.github.com/users/LSSTDESC/events{/privacy}","received_events_url":"https://api.github.com/users/LSSTDESC/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/LSSTDESC/imSim","description":"GalSim based Large Synoptic Survey Telescope (LSST) image simulation package","fork":false,"url":"https://api.github.com/repos/LSSTDESC/imSim","forks_url":"https://api.github.com/repos/LSSTDESC/imSim/forks","keys_url":"https://api.github.com/repos/LSSTDESC/imSim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/LSSTDESC/imSim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/LSSTDESC/imSim/teams","hooks_url":"https://api.github.com/repos/LSSTDESC/imSim/hooks","issue_events_url":"https://api.github.com/repos/LSSTDESC/imSim/issues/events{/number}","events_url":"https://api.github.com/repos/LSSTDESC/imSim/events","assignees_url":"https://api.github.com/repos/LSSTDESC/imSim/assignees{/user}","branches_url":"https://api.github.com/repos/LSSTDESC/imSim/branches{/branch}","tags_url":"https://api.github.com/repos/LSSTDESC/imSim/tags","blobs_url":"https://api.github.com/repos/LSSTDESC/imSim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/LSSTDESC/imSim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/LSSTDESC/imSim/git/refs{/sha}","trees_url":"https://api.github.com/repos/LSSTDESC/imSim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/LSSTDESC/imSim/statuses/{sha}","languages_url":"https://api.github.com/repos/LSSTDESC/imSim/languages","stargazers_url":"https://api.github.com/repos/LSSTDESC/imSim/stargazers","contributors_url":"https://api.github.com/repos/LSSTDESC/imSim/contributors","subscribers_url":"https://api.github.com/repos/LSSTDESC/imSim/subscribers","subscription_url":"https://api.github.com/repos/LSSTDESC/imSim/subscription","commits_url":"https://api.github.com/repos/LSSTDESC/imSim/commits{/sha}","git_commits_url":"https://api.github.com/repos/LSSTDESC/imSim/git/commits{/sha}","comments_url":"https://api.github.com/repos/LSSTDESC/imSim/comments{/number}","issue_comment_url":"https://api.github.com/repos/LSSTDESC/imSim/issues/comments{/number}","contents_url":"https://api.github.com/repos/LSSTDESC/imSim/contents/{+path}","compare_url":"https://api.github.com/repos/LSSTDESC/imSim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/LSSTDESC/imSim/merges","archive_url":"https://api.github.com/repos/LSSTDESC/imSim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/LSSTDESC/imSim/downloads","issues_url":"https://api.github.com/repos/LSSTDESC/imSim/issues{/number}","pulls_url":"https://api.github.com/repos/LSSTDESC/imSim/pulls{/number}","milestones_url":"https://api.github.com/repos/LSSTDESC/imSim/milestones{/number}","notifications_url":"https://api.github.com/repos/LSSTDESC/imSim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/LSSTDESC/imSim/labels{/name}","releases_url":"https://api.github.com/repos/LSSTDESC/imSim/releases{/id}","deployments_url":"https://api.github.com/repos/LSSTDESC/imSim/deployments","created_at":"2016-10-15T00:53:14Z","updated_at":"2018-04-21T13:37:53Z","pushed_at":"2018-04-24T01:32:11Z","git_url":"git://github.com/LSSTDESC/imSim.git","ssh_url":"git@github.com:LSSTDESC/imSim.git","clone_url":"https://github.com/LSSTDESC/imSim.git","svn_url":"https://github.com/LSSTDESC/imSim","homepage":"","size":2654,"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":3,"mirror_url":null,"archived":false,"open_issues_count":38,"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"},"forks":3,"open_issues":38,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/LSSTDESC/imSim/pulls/110"},"html":{"href":"https://github.com/LSSTDESC/imSim/pull/110"},"issue":{"href":"https://api.github.com/repos/LSSTDESC/imSim/issues/110"},"comments":{"href":"https://api.github.com/repos/LSSTDESC/imSim/issues/110/comments"},"review_comments":{"href":"https://api.github.com/repos/LSSTDESC/imSim/pulls/110/comments"},"review_comment":{"href":"https://api.github.com/repos/LSSTDESC/imSim/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/LSSTDESC/imSim/pulls/110/commits"},"statuses":{"href":"https://api.github.com/repos/LSSTDESC/imSim/statuses/43ef646838690d6f6fcd8d6a5d0b241a9bd78076"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"jchiang87"}}