{"action":"created","comment":{"url":"https://api.github.com/repos/jeff-regier/Celeste.jl/pulls/comments/85261867","pull_request_review_id":5987365,"id":85261867,"diff_hunk":"@@ -203,43 +205,77 @@ Arguments:\n function load_active_pixels!(ea::ElboArgs{Float64};\n                             noise_fraction=0.1,\n                             min_radius_pix=8.0)\n-    @assert length(ea.active_sources) == 1\n-    s = ea.active_sources[1]\n-\n-    @assert(length(ea.active_pixels) == 0)\n+    ea.active_pixels = ActivePixel[]\n \n     for n = 1:ea.N\n         tiles = ea.images[n].tiles\n \n-        patch = ea.patches[s, n]\n-        pix_loc = Model.linear_world_to_pix(patch.wcs_jacobian,\n-                                            patch.center,\n-                                            patch.pixel_center,\n-                                            ea.vp[s][ids.u])\n-\n-        # TODO: just loop over the tiles/pixels near the active source\n+        # TODO: just loop over the tiles/pixels near the active source(s)\n         for t in 1:length(tiles)\n             tile = tiles[t]\n \n-            tile_source_map = ea.tile_source_map[n][t]\n-            if s in tile_source_map\n-                # TODO; use log_prob.jl in the Model module to get the\n-                # get the expected brightness, not variational inference\n-                pred_tile_pixels =\n-                    DeterministicVI.tile_predicted_image(tile, ea, [ s ],\n-                                                   include_epsilon=false)\n-                for h in tile.h_range, w in tile.w_range\n-                    # The pixel location in the rendered image.\n-                    h_im = h - minimum(tile.h_range) + 1\n-                    w_im = w - minimum(tile.w_range) + 1\n-\n-                    bright_pixel = pred_tile_pixels[h_im, w_im] >\n-                       tile.iota_vec[h_im] * tile.epsilon_mat[h_im, w_im] * noise_fraction\n-                    close_pixel =\n-                        (h - pix_loc[1]) ^ 2 + (w - pix_loc[2])^2 < min_radius_pix^2\n-\n-                    if (bright_pixel || close_pixel) && !isnan(tile.pixels[h_im, w_im])\n+            # we're checking up front whether this tile matters,\n+            # *before* we allocate memory for local_active_sources\n+            # and local_active_centers\n+            ignore_tile = true\n+            for s in ea.active_sources\n+                # `intersect(ea.active_sources, tile_source_map)` allocates\n+                # huge amounts of memory, so now we don't do that here\n+                if s in ea.tile_source_map[n][t]\n+                    ignore_tile = false\n+                    break\n+                end\n+            end\n+\n+            if ignore_tile\n+                continue\n+            end\n+\n+            local_active_sources = Int64[]\n+            local_centers = Vector{Float64}[]\n+            for s in ea.active_sources\n+                if s in ea.tile_source_map[n][t]\n+                    push!(local_active_sources, s)\n+\n+                    patch = ea.patches[s, n]\n+                    pix_loc = Model.linear_world_to_pix(patch.wcs_jacobian,\n+                                                        patch.center,\n+                                                        patch.pixel_center,\n+                                                        ea.vp[s][ids.u])\n+                    push!(local_centers, pix_loc)\n+                end\n+            end\n+\n+            # TODO; use log_prob.jl in the Model module to get the\n+            # get the expected brightness, not variational inference\n+            pred_tile_pixels = tile_predicted_image(tile,\n+                                                    ea,\n+                                                    local_active_sources,\n+                                                    include_epsilon=false)\n+\n+            for h in tile.h_range, w in tile.w_range\n+                # The pixel location in the rendered image.","path":"src/Infer.jl","position":95,"original_position":95,"commit_id":"a2ac697eea91864e416ba99fdb270e135a3ec0bd","original_commit_id":"a2ac697eea91864e416ba99fdb270e135a3ec0bd","user":{"login":"rgiordan","id":4494910,"avatar_url":"https://avatars.githubusercontent.com/u/4494910?v=3","gravatar_id":"","url":"https://api.github.com/users/rgiordan","html_url":"https://github.com/rgiordan","followers_url":"https://api.github.com/users/rgiordan/followers","following_url":"https://api.github.com/users/rgiordan/following{/other_user}","gists_url":"https://api.github.com/users/rgiordan/gists{/gist_id}","starred_url":"https://api.github.com/users/rgiordan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgiordan/subscriptions","organizations_url":"https://api.github.com/users/rgiordan/orgs","repos_url":"https://api.github.com/users/rgiordan/repos","events_url":"https://api.github.com/users/rgiordan/events{/privacy}","received_events_url":"https://api.github.com/users/rgiordan/received_events","type":"User","site_admin":false},"body":"This is the pixel location in the tile, not the image, right?","created_at":"2016-10-27T03:45:43Z","updated_at":"2016-10-27T03:45:43Z","html_url":"https://github.com/jeff-regier/Celeste.jl/pull/363#discussion_r85261867","pull_request_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/pulls/363","_links":{"self":{"href":"https://api.github.com/repos/jeff-regier/Celeste.jl/pulls/comments/85261867"},"html":{"href":"https://github.com/jeff-regier/Celeste.jl/pull/363#discussion_r85261867"},"pull_request":{"href":"https://api.github.com/repos/jeff-regier/Celeste.jl/pulls/363"}}},"pull_request":{"url":"https://api.github.com/repos/jeff-regier/Celeste.jl/pulls/363","id":90668648,"html_url":"https://github.com/jeff-regier/Celeste.jl/pull/363","diff_url":"https://github.com/jeff-regier/Celeste.jl/pull/363.diff","patch_url":"https://github.com/jeff-regier/Celeste.jl/pull/363.patch","issue_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/issues/363","number":363,"state":"open","locked":false,"title":"added a test for load_active_pixels!","user":{"login":"jeff-regier","id":8953355,"avatar_url":"https://avatars.githubusercontent.com/u/8953355?v=3","gravatar_id":"","url":"https://api.github.com/users/jeff-regier","html_url":"https://github.com/jeff-regier","followers_url":"https://api.github.com/users/jeff-regier/followers","following_url":"https://api.github.com/users/jeff-regier/following{/other_user}","gists_url":"https://api.github.com/users/jeff-regier/gists{/gist_id}","starred_url":"https://api.github.com/users/jeff-regier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeff-regier/subscriptions","organizations_url":"https://api.github.com/users/jeff-regier/orgs","repos_url":"https://api.github.com/users/jeff-regier/repos","events_url":"https://api.github.com/users/jeff-regier/events{/privacy}","received_events_url":"https://api.github.com/users/jeff-regier/received_events","type":"User","site_admin":false},"body":"I added a basic test for `load_active_pixels!`. The thing about testing this function is that it isn't well defined what the function is supposed to do, beyond what the code that implements it says it does. Sometimes really dim pixels are informative because we expect them to be bright (based on initial parameters); sometimes really bright pixels are informative because we expect them to be dim (based on our initial estimates of the parameters). We might want to think more about how to select active pixels. Maybe something about the log probability changes, given the initial estimates of the parameters, if a particular pixel (or set of pixels) is censored. Perhaps subsampling pixels for large galaxies could be a special case of our procedure for selecting active pixels.\r\n\r\nThis closes #355.","created_at":"2016-10-24T18:40:27Z","updated_at":"2016-10-27T03:45:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"04f5a8a65856e37d128cb00ae52bfb2becb878af","assignee":{"login":"rgiordan","id":4494910,"avatar_url":"https://avatars.githubusercontent.com/u/4494910?v=3","gravatar_id":"","url":"https://api.github.com/users/rgiordan","html_url":"https://github.com/rgiordan","followers_url":"https://api.github.com/users/rgiordan/followers","following_url":"https://api.github.com/users/rgiordan/following{/other_user}","gists_url":"https://api.github.com/users/rgiordan/gists{/gist_id}","starred_url":"https://api.github.com/users/rgiordan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgiordan/subscriptions","organizations_url":"https://api.github.com/users/rgiordan/orgs","repos_url":"https://api.github.com/users/rgiordan/repos","events_url":"https://api.github.com/users/rgiordan/events{/privacy}","received_events_url":"https://api.github.com/users/rgiordan/received_events","type":"User","site_admin":false},"assignees":[{"login":"rgiordan","id":4494910,"avatar_url":"https://avatars.githubusercontent.com/u/4494910?v=3","gravatar_id":"","url":"https://api.github.com/users/rgiordan","html_url":"https://github.com/rgiordan","followers_url":"https://api.github.com/users/rgiordan/followers","following_url":"https://api.github.com/users/rgiordan/following{/other_user}","gists_url":"https://api.github.com/users/rgiordan/gists{/gist_id}","starred_url":"https://api.github.com/users/rgiordan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgiordan/subscriptions","organizations_url":"https://api.github.com/users/rgiordan/orgs","repos_url":"https://api.github.com/users/rgiordan/repos","events_url":"https://api.github.com/users/rgiordan/events{/privacy}","received_events_url":"https://api.github.com/users/rgiordan/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/pulls/363/commits","review_comments_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/pulls/363/comments","review_comment_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/issues/363/comments","statuses_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/statuses/a2ac697eea91864e416ba99fdb270e135a3ec0bd","head":{"label":"jeff-regier:test_active_pixels","ref":"test_active_pixels","sha":"a2ac697eea91864e416ba99fdb270e135a3ec0bd","user":{"login":"jeff-regier","id":8953355,"avatar_url":"https://avatars.githubusercontent.com/u/8953355?v=3","gravatar_id":"","url":"https://api.github.com/users/jeff-regier","html_url":"https://github.com/jeff-regier","followers_url":"https://api.github.com/users/jeff-regier/followers","following_url":"https://api.github.com/users/jeff-regier/following{/other_user}","gists_url":"https://api.github.com/users/jeff-regier/gists{/gist_id}","starred_url":"https://api.github.com/users/jeff-regier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeff-regier/subscriptions","organizations_url":"https://api.github.com/users/jeff-regier/orgs","repos_url":"https://api.github.com/users/jeff-regier/repos","events_url":"https://api.github.com/users/jeff-regier/events{/privacy}","received_events_url":"https://api.github.com/users/jeff-regier/received_events","type":"User","site_admin":false},"repo":{"id":28730928,"name":"Celeste.jl","full_name":"jeff-regier/Celeste.jl","owner":{"login":"jeff-regier","id":8953355,"avatar_url":"https://avatars.githubusercontent.com/u/8953355?v=3","gravatar_id":"","url":"https://api.github.com/users/jeff-regier","html_url":"https://github.com/jeff-regier","followers_url":"https://api.github.com/users/jeff-regier/followers","following_url":"https://api.github.com/users/jeff-regier/following{/other_user}","gists_url":"https://api.github.com/users/jeff-regier/gists{/gist_id}","starred_url":"https://api.github.com/users/jeff-regier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeff-regier/subscriptions","organizations_url":"https://api.github.com/users/jeff-regier/orgs","repos_url":"https://api.github.com/users/jeff-regier/repos","events_url":"https://api.github.com/users/jeff-regier/events{/privacy}","received_events_url":"https://api.github.com/users/jeff-regier/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jeff-regier/Celeste.jl","description":"Scalable inference for a generative model of astronomical images","fork":false,"url":"https://api.github.com/repos/jeff-regier/Celeste.jl","forks_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/forks","keys_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/teams","hooks_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/hooks","issue_events_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/issues/events{/number}","events_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/events","assignees_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/assignees{/user}","branches_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/branches{/branch}","tags_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/tags","blobs_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/languages","stargazers_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/stargazers","contributors_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/contributors","subscribers_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/subscribers","subscription_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/subscription","commits_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/contents/{+path}","compare_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/merges","archive_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/downloads","issues_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/issues{/number}","pulls_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/labels{/name}","releases_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/releases{/id}","deployments_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/deployments","created_at":"2015-01-03T00:47:34Z","updated_at":"2016-10-26T22:59:51Z","pushed_at":"2016-10-27T02:24:44Z","git_url":"git://github.com/jeff-regier/Celeste.jl.git","ssh_url":"git@github.com:jeff-regier/Celeste.jl.git","clone_url":"https://github.com/jeff-regier/Celeste.jl.git","svn_url":"https://github.com/jeff-regier/Celeste.jl","homepage":"","size":57460,"stargazers_count":13,"watchers_count":13,"language":"Julia","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":52,"forks":10,"open_issues":52,"watchers":13,"default_branch":"master"}},"base":{"label":"jeff-regier:master","ref":"master","sha":"a3ccc43978f88ea618254cabc35195fd6f98245c","user":{"login":"jeff-regier","id":8953355,"avatar_url":"https://avatars.githubusercontent.com/u/8953355?v=3","gravatar_id":"","url":"https://api.github.com/users/jeff-regier","html_url":"https://github.com/jeff-regier","followers_url":"https://api.github.com/users/jeff-regier/followers","following_url":"https://api.github.com/users/jeff-regier/following{/other_user}","gists_url":"https://api.github.com/users/jeff-regier/gists{/gist_id}","starred_url":"https://api.github.com/users/jeff-regier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeff-regier/subscriptions","organizations_url":"https://api.github.com/users/jeff-regier/orgs","repos_url":"https://api.github.com/users/jeff-regier/repos","events_url":"https://api.github.com/users/jeff-regier/events{/privacy}","received_events_url":"https://api.github.com/users/jeff-regier/received_events","type":"User","site_admin":false},"repo":{"id":28730928,"name":"Celeste.jl","full_name":"jeff-regier/Celeste.jl","owner":{"login":"jeff-regier","id":8953355,"avatar_url":"https://avatars.githubusercontent.com/u/8953355?v=3","gravatar_id":"","url":"https://api.github.com/users/jeff-regier","html_url":"https://github.com/jeff-regier","followers_url":"https://api.github.com/users/jeff-regier/followers","following_url":"https://api.github.com/users/jeff-regier/following{/other_user}","gists_url":"https://api.github.com/users/jeff-regier/gists{/gist_id}","starred_url":"https://api.github.com/users/jeff-regier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeff-regier/subscriptions","organizations_url":"https://api.github.com/users/jeff-regier/orgs","repos_url":"https://api.github.com/users/jeff-regier/repos","events_url":"https://api.github.com/users/jeff-regier/events{/privacy}","received_events_url":"https://api.github.com/users/jeff-regier/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jeff-regier/Celeste.jl","description":"Scalable inference for a generative model of astronomical images","fork":false,"url":"https://api.github.com/repos/jeff-regier/Celeste.jl","forks_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/forks","keys_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/teams","hooks_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/hooks","issue_events_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/issues/events{/number}","events_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/events","assignees_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/assignees{/user}","branches_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/branches{/branch}","tags_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/tags","blobs_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/languages","stargazers_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/stargazers","contributors_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/contributors","subscribers_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/subscribers","subscription_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/subscription","commits_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/contents/{+path}","compare_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/merges","archive_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/downloads","issues_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/issues{/number}","pulls_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/labels{/name}","releases_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/releases{/id}","deployments_url":"https://api.github.com/repos/jeff-regier/Celeste.jl/deployments","created_at":"2015-01-03T00:47:34Z","updated_at":"2016-10-26T22:59:51Z","pushed_at":"2016-10-27T02:24:44Z","git_url":"git://github.com/jeff-regier/Celeste.jl.git","ssh_url":"git@github.com:jeff-regier/Celeste.jl.git","clone_url":"https://github.com/jeff-regier/Celeste.jl.git","svn_url":"https://github.com/jeff-regier/Celeste.jl","homepage":"","size":57460,"stargazers_count":13,"watchers_count":13,"language":"Julia","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":52,"forks":10,"open_issues":52,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jeff-regier/Celeste.jl/pulls/363"},"html":{"href":"https://github.com/jeff-regier/Celeste.jl/pull/363"},"issue":{"href":"https://api.github.com/repos/jeff-regier/Celeste.jl/issues/363"},"comments":{"href":"https://api.github.com/repos/jeff-regier/Celeste.jl/issues/363/comments"},"review_comments":{"href":"https://api.github.com/repos/jeff-regier/Celeste.jl/pulls/363/comments"},"review_comment":{"href":"https://api.github.com/repos/jeff-regier/Celeste.jl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jeff-regier/Celeste.jl/pulls/363/commits"},"statuses":{"href":"https://api.github.com/repos/jeff-regier/Celeste.jl/statuses/a2ac697eea91864e416ba99fdb270e135a3ec0bd"}}}}
{"actor":{"display_login":"rgiordan"}}