{"action":"created","comment":{"url":"https://api.github.com/repos/GalSim-developers/GalSim/pulls/comments/176208473","pull_request_review_id":105872011,"id":176208473,"diff_hunk":"@@ -925,7 +935,23 @@ def makePSF(self, lam, **kwargs):\n     @property\n     def r0_500_effective(self):\n         \"\"\"Effective r0_500 for set of screens in list that define an r0_500 attribute.\"\"\"\n-        return np.sum([l.r0_500**(-5./3) for l in self if hasattr(l, 'r0_500')])**(-3./5)\n+        r0_500s = np.array([l.r0_500 for l in self if hasattr(l, 'r0_500')])\n+        if len(r0_500s) == 0:\n+            return None\n+        else:\n+            return np.sum(r0_500s**(-5./3))**(-3./5)\n+\n+    @property\n+    def L0_effective(self):\n+        \"\"\"Weighted average of individual screen outer scale L0 values.\"\"\"\n+        # This is just a guess.  It corresponds to weighting the layers by their relative phase\n+        # variance\n+        weights = np.array([l.r0_500**(-5./3) for l in self if hasattr(l, 'r0_500')])\n+        L0s = np.array([l.L0 for l in self if hasattr(l, 'L0')])\n+        if len(weights) == 0:\n+            return None","path":"galsim/phase_psf.py","position":null,"original_position":74,"commit_id":"47fed58e7fc292098867cb43618b472f0ea51e9c","original_commit_id":"315d6cd86999e6108ffadd6f598687c4c13bb4ad","user":{"login":"jmeyers314","id":3650485,"avatar_url":"https://avatars0.githubusercontent.com/u/3650485?v=4","gravatar_id":"","url":"https://api.github.com/users/jmeyers314","html_url":"https://github.com/jmeyers314","followers_url":"https://api.github.com/users/jmeyers314/followers","following_url":"https://api.github.com/users/jmeyers314/following{/other_user}","gists_url":"https://api.github.com/users/jmeyers314/gists{/gist_id}","starred_url":"https://api.github.com/users/jmeyers314/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmeyers314/subscriptions","organizations_url":"https://api.github.com/users/jmeyers314/orgs","repos_url":"https://api.github.com/users/jmeyers314/repos","events_url":"https://api.github.com/users/jmeyers314/events{/privacy}","received_events_url":"https://api.github.com/users/jmeyers314/received_events","type":"User","site_admin":false},"body":"I guess this isn't impossible given that it's in the public API (though I suppose we could hide it).  I went ahead and left this branch in the code, but added tests to cover it.","created_at":"2018-03-21T19:21:14Z","updated_at":"2018-03-21T19:21:14Z","html_url":"https://github.com/GalSim-developers/GalSim/pull/948#discussion_r176208473","pull_request_url":"https://api.github.com/repos/GalSim-developers/GalSim/pulls/948","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/GalSim-developers/GalSim/pulls/comments/176208473"},"html":{"href":"https://github.com/GalSim-developers/GalSim/pull/948#discussion_r176208473"},"pull_request":{"href":"https://api.github.com/repos/GalSim-developers/GalSim/pulls/948"}},"in_reply_to_id":174167853},"pull_request":{"url":"https://api.github.com/repos/GalSim-developers/GalSim/pulls/948","id":170870692,"html_url":"https://github.com/GalSim-developers/GalSim/pull/948","diff_url":"https://github.com/GalSim-developers/GalSim/pull/948.diff","patch_url":"https://github.com/GalSim-developers/GalSim/pull/948.patch","issue_url":"https://api.github.com/repos/GalSim-developers/GalSim/issues/948","number":948,"state":"open","locked":false,"title":"Second Kick","user":{"login":"jmeyers314","id":3650485,"avatar_url":"https://avatars0.githubusercontent.com/u/3650485?v=4","gravatar_id":"","url":"https://api.github.com/users/jmeyers314","html_url":"https://github.com/jmeyers314","followers_url":"https://api.github.com/users/jmeyers314/followers","following_url":"https://api.github.com/users/jmeyers314/following{/other_user}","gists_url":"https://api.github.com/users/jmeyers314/gists{/gist_id}","starred_url":"https://api.github.com/users/jmeyers314/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmeyers314/subscriptions","organizations_url":"https://api.github.com/users/jmeyers314/orgs","repos_url":"https://api.github.com/users/jmeyers314/repos","events_url":"https://api.github.com/users/jmeyers314/events{/privacy}","received_events_url":"https://api.github.com/users/jmeyers314/received_events","type":"User","site_admin":false},"body":"This PR implements the SecondKick profile, which is the expectation value for an Airy profile convolved with a turbulent atmospheric PSF, where the turbulence power spectrum is von Karman and can include a lower truncation bound on the included Fourier modes.  \r\n\r\nThe intended use for the profile is in conjunction with geometric photon-shooting through atmospheric phase screens.  As such, a SecondKick profile is automatically included when a user opts to draw PhaseScreenPSFs using geometric photon-shooting.  The power spectrum truncation length is also chosen automatically by `AtmosphericScreen`s now based upon how they are first used (drawing with FFT vs drawing with photon-shooting).\r\n\r\nFor an example of the SecondKick machinery in action, take a look at examples/fft_vs_geom_movie.py.  Note that the SecondKick object is never explicitly used there, but it is used behind the scenes thanks to the automatic determinations described above.  (In fact, it may be worth considering making SecondKick a pure implementation detail: `_SecondKick`.)\r\n\r\nThis PR also fixes what I believe is a mistake that had been present in the generation of phase screens with a specified power spectrum.  [This factor of sqrt(2)](https://github.com/GalSim-developers/GalSim/blob/releases/1.5/devel/modules/phase_psf/ArScreens/create_multilayer_arbase.py#L57), which I copied from the UCSC code that originally formed the basis for the GalSim phase screens, appears to produce fluctuations that are too large (at least in GalSim) by the same factor, and subsequently produces PSFs with too large a FWHM.\r\n\r\nTo convince myself that this really is the problem, I looked at a few different tests:\r\n\r\nThe first is a more detailed comparison of the measured simulated structure functions of screens to their expected analytic forms (test_phase_psf:test_structure_function()).  While this test existed before for pure Kolmogorov screens, its tolerance was only 50%.  The new version of the test has a tolerance of 5% and tests von Karman screens instead of Kolmogorov screens, which are easier to deal with since they don't have divergent power as k -> 0.  \r\n\r\nThe second test is that a second kick profile should be the same as a long exposure time Fourier optics profile if the simulated screens are truncated at the same scale (test_second_kick:test_sk_phase_psf()).\r\n\r\nThe third test is just a more general check that Fourier optics PSFs match geometric optics PSFs and also match corresponding analytic PSF sizes (test_phase_psf:test_phase_gradient_shoot()).\r\n\r\nA number of other validation tools I found useful during development are included in the devel/modules/atmValidate/ directory.  The `vonKarman.py` script there was particularly helpful.\r\n\r\nFinally, I'll note that I while I believe everything technically works correctly (b/c of the tests), I think it's also very likely that there are some incorrect names for things floating around in phase_screens.py and SBSecondKick.cpp and possible SBVonKarman.cpp.  In particular, I think that some of the things I've called `f` should really be `k` (frequency vs angular frequency) or vice-versa, and there are probably some incorrect 2pi's floating around and presumably canceling each other out too.  One potential consequence of this is that I've developed a very different looking critical k-mode for splitting geometric/diffractive scales than reported by Peterson et al. and used in PhoSim.  The scale reported there is 2pi / (1.5 r0), while the scale that seems to work well here is more like 0.2 / r0 (determined using some of the scripts in the atmValidate directory).  A factor of 2pi doesn't eliminate that difference, (factor of ~20), but it might make it smaller.","created_at":"2018-02-22T21:28:11Z","updated_at":"2018-03-21T19:21:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b72a086ed8196ddcde18d027261017b85d25ee72","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/GalSim-developers/GalSim/pulls/948/commits","review_comments_url":"https://api.github.com/repos/GalSim-developers/GalSim/pulls/948/comments","review_comment_url":"https://api.github.com/repos/GalSim-developers/GalSim/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GalSim-developers/GalSim/issues/948/comments","statuses_url":"https://api.github.com/repos/GalSim-developers/GalSim/statuses/47fed58e7fc292098867cb43618b472f0ea51e9c","head":{"label":"GalSim-developers:2kick","ref":"2kick","sha":"47fed58e7fc292098867cb43618b472f0ea51e9c","user":{"login":"GalSim-developers","id":1462196,"avatar_url":"https://avatars2.githubusercontent.com/u/1462196?v=4","gravatar_id":"","url":"https://api.github.com/users/GalSim-developers","html_url":"https://github.com/GalSim-developers","followers_url":"https://api.github.com/users/GalSim-developers/followers","following_url":"https://api.github.com/users/GalSim-developers/following{/other_user}","gists_url":"https://api.github.com/users/GalSim-developers/gists{/gist_id}","starred_url":"https://api.github.com/users/GalSim-developers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GalSim-developers/subscriptions","organizations_url":"https://api.github.com/users/GalSim-developers/orgs","repos_url":"https://api.github.com/users/GalSim-developers/repos","events_url":"https://api.github.com/users/GalSim-developers/events{/privacy}","received_events_url":"https://api.github.com/users/GalSim-developers/received_events","type":"Organization","site_admin":false},"repo":{"id":3510804,"name":"GalSim","full_name":"GalSim-developers/GalSim","owner":{"login":"GalSim-developers","id":1462196,"avatar_url":"https://avatars2.githubusercontent.com/u/1462196?v=4","gravatar_id":"","url":"https://api.github.com/users/GalSim-developers","html_url":"https://github.com/GalSim-developers","followers_url":"https://api.github.com/users/GalSim-developers/followers","following_url":"https://api.github.com/users/GalSim-developers/following{/other_user}","gists_url":"https://api.github.com/users/GalSim-developers/gists{/gist_id}","starred_url":"https://api.github.com/users/GalSim-developers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GalSim-developers/subscriptions","organizations_url":"https://api.github.com/users/GalSim-developers/orgs","repos_url":"https://api.github.com/users/GalSim-developers/repos","events_url":"https://api.github.com/users/GalSim-developers/events{/privacy}","received_events_url":"https://api.github.com/users/GalSim-developers/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GalSim-developers/GalSim","description":"The modular galaxy image simulation toolkit","fork":false,"url":"https://api.github.com/repos/GalSim-developers/GalSim","forks_url":"https://api.github.com/repos/GalSim-developers/GalSim/forks","keys_url":"https://api.github.com/repos/GalSim-developers/GalSim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GalSim-developers/GalSim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GalSim-developers/GalSim/teams","hooks_url":"https://api.github.com/repos/GalSim-developers/GalSim/hooks","issue_events_url":"https://api.github.com/repos/GalSim-developers/GalSim/issues/events{/number}","events_url":"https://api.github.com/repos/GalSim-developers/GalSim/events","assignees_url":"https://api.github.com/repos/GalSim-developers/GalSim/assignees{/user}","branches_url":"https://api.github.com/repos/GalSim-developers/GalSim/branches{/branch}","tags_url":"https://api.github.com/repos/GalSim-developers/GalSim/tags","blobs_url":"https://api.github.com/repos/GalSim-developers/GalSim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GalSim-developers/GalSim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GalSim-developers/GalSim/git/refs{/sha}","trees_url":"https://api.github.com/repos/GalSim-developers/GalSim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GalSim-developers/GalSim/statuses/{sha}","languages_url":"https://api.github.com/repos/GalSim-developers/GalSim/languages","stargazers_url":"https://api.github.com/repos/GalSim-developers/GalSim/stargazers","contributors_url":"https://api.github.com/repos/GalSim-developers/GalSim/contributors","subscribers_url":"https://api.github.com/repos/GalSim-developers/GalSim/subscribers","subscription_url":"https://api.github.com/repos/GalSim-developers/GalSim/subscription","commits_url":"https://api.github.com/repos/GalSim-developers/GalSim/commits{/sha}","git_commits_url":"https://api.github.com/repos/GalSim-developers/GalSim/git/commits{/sha}","comments_url":"https://api.github.com/repos/GalSim-developers/GalSim/comments{/number}","issue_comment_url":"https://api.github.com/repos/GalSim-developers/GalSim/issues/comments{/number}","contents_url":"https://api.github.com/repos/GalSim-developers/GalSim/contents/{+path}","compare_url":"https://api.github.com/repos/GalSim-developers/GalSim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GalSim-developers/GalSim/merges","archive_url":"https://api.github.com/repos/GalSim-developers/GalSim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GalSim-developers/GalSim/downloads","issues_url":"https://api.github.com/repos/GalSim-developers/GalSim/issues{/number}","pulls_url":"https://api.github.com/repos/GalSim-developers/GalSim/pulls{/number}","milestones_url":"https://api.github.com/repos/GalSim-developers/GalSim/milestones{/number}","notifications_url":"https://api.github.com/repos/GalSim-developers/GalSim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GalSim-developers/GalSim/labels{/name}","releases_url":"https://api.github.com/repos/GalSim-developers/GalSim/releases{/id}","deployments_url":"https://api.github.com/repos/GalSim-developers/GalSim/deployments","created_at":"2012-02-22T02:51:45Z","updated_at":"2018-01-17T06:38:55Z","pushed_at":"2018-03-21T19:14:33Z","git_url":"git://github.com/GalSim-developers/GalSim.git","ssh_url":"git@github.com:GalSim-developers/GalSim.git","clone_url":"https://github.com/GalSim-developers/GalSim.git","svn_url":"https://github.com/GalSim-developers/GalSim","homepage":"","size":125995,"stargazers_count":76,"watchers_count":76,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":49,"mirror_url":null,"archived":false,"open_issues_count":62,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":49,"open_issues":62,"watchers":76,"default_branch":"releases/1.5"}},"base":{"label":"GalSim-developers:master","ref":"master","sha":"21b43c3df9d12f6b645f052eb815fba2cc283503","user":{"login":"GalSim-developers","id":1462196,"avatar_url":"https://avatars2.githubusercontent.com/u/1462196?v=4","gravatar_id":"","url":"https://api.github.com/users/GalSim-developers","html_url":"https://github.com/GalSim-developers","followers_url":"https://api.github.com/users/GalSim-developers/followers","following_url":"https://api.github.com/users/GalSim-developers/following{/other_user}","gists_url":"https://api.github.com/users/GalSim-developers/gists{/gist_id}","starred_url":"https://api.github.com/users/GalSim-developers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GalSim-developers/subscriptions","organizations_url":"https://api.github.com/users/GalSim-developers/orgs","repos_url":"https://api.github.com/users/GalSim-developers/repos","events_url":"https://api.github.com/users/GalSim-developers/events{/privacy}","received_events_url":"https://api.github.com/users/GalSim-developers/received_events","type":"Organization","site_admin":false},"repo":{"id":3510804,"name":"GalSim","full_name":"GalSim-developers/GalSim","owner":{"login":"GalSim-developers","id":1462196,"avatar_url":"https://avatars2.githubusercontent.com/u/1462196?v=4","gravatar_id":"","url":"https://api.github.com/users/GalSim-developers","html_url":"https://github.com/GalSim-developers","followers_url":"https://api.github.com/users/GalSim-developers/followers","following_url":"https://api.github.com/users/GalSim-developers/following{/other_user}","gists_url":"https://api.github.com/users/GalSim-developers/gists{/gist_id}","starred_url":"https://api.github.com/users/GalSim-developers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GalSim-developers/subscriptions","organizations_url":"https://api.github.com/users/GalSim-developers/orgs","repos_url":"https://api.github.com/users/GalSim-developers/repos","events_url":"https://api.github.com/users/GalSim-developers/events{/privacy}","received_events_url":"https://api.github.com/users/GalSim-developers/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GalSim-developers/GalSim","description":"The modular galaxy image simulation toolkit","fork":false,"url":"https://api.github.com/repos/GalSim-developers/GalSim","forks_url":"https://api.github.com/repos/GalSim-developers/GalSim/forks","keys_url":"https://api.github.com/repos/GalSim-developers/GalSim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GalSim-developers/GalSim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GalSim-developers/GalSim/teams","hooks_url":"https://api.github.com/repos/GalSim-developers/GalSim/hooks","issue_events_url":"https://api.github.com/repos/GalSim-developers/GalSim/issues/events{/number}","events_url":"https://api.github.com/repos/GalSim-developers/GalSim/events","assignees_url":"https://api.github.com/repos/GalSim-developers/GalSim/assignees{/user}","branches_url":"https://api.github.com/repos/GalSim-developers/GalSim/branches{/branch}","tags_url":"https://api.github.com/repos/GalSim-developers/GalSim/tags","blobs_url":"https://api.github.com/repos/GalSim-developers/GalSim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GalSim-developers/GalSim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GalSim-developers/GalSim/git/refs{/sha}","trees_url":"https://api.github.com/repos/GalSim-developers/GalSim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GalSim-developers/GalSim/statuses/{sha}","languages_url":"https://api.github.com/repos/GalSim-developers/GalSim/languages","stargazers_url":"https://api.github.com/repos/GalSim-developers/GalSim/stargazers","contributors_url":"https://api.github.com/repos/GalSim-developers/GalSim/contributors","subscribers_url":"https://api.github.com/repos/GalSim-developers/GalSim/subscribers","subscription_url":"https://api.github.com/repos/GalSim-developers/GalSim/subscription","commits_url":"https://api.github.com/repos/GalSim-developers/GalSim/commits{/sha}","git_commits_url":"https://api.github.com/repos/GalSim-developers/GalSim/git/commits{/sha}","comments_url":"https://api.github.com/repos/GalSim-developers/GalSim/comments{/number}","issue_comment_url":"https://api.github.com/repos/GalSim-developers/GalSim/issues/comments{/number}","contents_url":"https://api.github.com/repos/GalSim-developers/GalSim/contents/{+path}","compare_url":"https://api.github.com/repos/GalSim-developers/GalSim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GalSim-developers/GalSim/merges","archive_url":"https://api.github.com/repos/GalSim-developers/GalSim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GalSim-developers/GalSim/downloads","issues_url":"https://api.github.com/repos/GalSim-developers/GalSim/issues{/number}","pulls_url":"https://api.github.com/repos/GalSim-developers/GalSim/pulls{/number}","milestones_url":"https://api.github.com/repos/GalSim-developers/GalSim/milestones{/number}","notifications_url":"https://api.github.com/repos/GalSim-developers/GalSim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GalSim-developers/GalSim/labels{/name}","releases_url":"https://api.github.com/repos/GalSim-developers/GalSim/releases{/id}","deployments_url":"https://api.github.com/repos/GalSim-developers/GalSim/deployments","created_at":"2012-02-22T02:51:45Z","updated_at":"2018-01-17T06:38:55Z","pushed_at":"2018-03-21T19:14:33Z","git_url":"git://github.com/GalSim-developers/GalSim.git","ssh_url":"git@github.com:GalSim-developers/GalSim.git","clone_url":"https://github.com/GalSim-developers/GalSim.git","svn_url":"https://github.com/GalSim-developers/GalSim","homepage":"","size":125995,"stargazers_count":76,"watchers_count":76,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":49,"mirror_url":null,"archived":false,"open_issues_count":62,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":49,"open_issues":62,"watchers":76,"default_branch":"releases/1.5"}},"_links":{"self":{"href":"https://api.github.com/repos/GalSim-developers/GalSim/pulls/948"},"html":{"href":"https://github.com/GalSim-developers/GalSim/pull/948"},"issue":{"href":"https://api.github.com/repos/GalSim-developers/GalSim/issues/948"},"comments":{"href":"https://api.github.com/repos/GalSim-developers/GalSim/issues/948/comments"},"review_comments":{"href":"https://api.github.com/repos/GalSim-developers/GalSim/pulls/948/comments"},"review_comment":{"href":"https://api.github.com/repos/GalSim-developers/GalSim/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GalSim-developers/GalSim/pulls/948/commits"},"statuses":{"href":"https://api.github.com/repos/GalSim-developers/GalSim/statuses/47fed58e7fc292098867cb43618b472f0ea51e9c"}},"author_association":"OWNER"}}
{"actor":{"display_login":"jmeyers314"}}