{"action":"created","comment":{"url":"https://api.github.com/repos/GalSim-developers/GalSim/pulls/comments/24715928","id":24715928,"diff_hunk":"@@ -131,6 +136,216 @@ def __init__(self, obj):\n         # wavelength-dependent expansion and wavelength-dependent flux rescaling.\n         self._fluxFactor = lambda w: 1.0\n \n+    def setupInterpolation(self, waves, oversample_fac=1.):\n+        \"\"\"\n+        This method is used as a pre-processing step that can expedite image rendering using objects\n+        that have to be built up as sums of GSObjects with different parameters at each wavelength,\n+        by interpolating between Images at each wavelength instead of making a more costly\n+        instantiation of the relevant GSObject at each value of wavelength at which the bandpass is\n+        defined.  This routine does a costly initialization process to build up a grid of images to\n+        be used for the interpolation later on.  However, the object can get reused with different\n+        bandpasses, so there should not be any need to make many versions of this object, and there\n+        is a significant savings each time it is drawn into an image.  As a general rule of thumb,\n+        chromatic objects that are separable do not benefit from this particular optimization,\n+        whereas those that involve making GSObjects with wavelength-dependent keywords or\n+        transformations do benefit from it.  Note that the interpolation scheme is simple linear\n+        interpolation in wavelength, and no extrapolation beyond the originally-provided range of\n+        wavelengths is permitted.\n+\n+        The speedup involved in using interpolation depends in part on the bandpass used for\n+        rendering (since that determines how many full profile evaluations are involved in rendering\n+        the image).  However, for ChromaticAtmosphere with simple profiles like Kolmogorov, the\n+        speedup in some simple example cases is roughly a factor of three, whereas for more\n+        expensive to render profiles like the ChromaticOpticalPSF, the speedup is more typically a\n+        factor of 10-50.\n+\n+        Achromatic transformations can be applied either before or after setting up interpolation,\n+        with the best option depending on the application.  For example, when rendering many times\n+        with the same achromatic transformation applied, it is typically advantageous to apply the\n+        transformation before setting up the interpolation.  But there is no value in this when\n+        applying different achromatic transformation to each object.  Chromatic transformations must\n+        be applied before setting up interpolation, and attempts to render images of\n+        ChromaticObjects with interpolation followed by a chromatic transformation will result in an\n+        exception being raised.","path":"galsim/chromatic.py","position":57,"original_position":57,"commit_id":"bb6c731079a02a10776cca6229e3901f6088ec86","original_commit_id":"bb6c731079a02a10776cca6229e3901f6088ec86","user":{"login":"rmjarvis","id":623887,"avatar_url":"https://avatars.githubusercontent.com/u/623887?v=3","gravatar_id":"","url":"https://api.github.com/users/rmjarvis","html_url":"https://github.com/rmjarvis","followers_url":"https://api.github.com/users/rmjarvis/followers","following_url":"https://api.github.com/users/rmjarvis/following{/other_user}","gists_url":"https://api.github.com/users/rmjarvis/gists{/gist_id}","starred_url":"https://api.github.com/users/rmjarvis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmjarvis/subscriptions","organizations_url":"https://api.github.com/users/rmjarvis/orgs","repos_url":"https://api.github.com/users/rmjarvis/repos","events_url":"https://api.github.com/users/rmjarvis/events{/privacy}","received_events_url":"https://api.github.com/users/rmjarvis/received_events","type":"User","site_admin":false},"body":"Is this still the case?  I thought we decided that a chromatic transformation of something with the interpolation set up was valid, but would emit a warning about losing the interpolation.","created_at":"2015-02-14T17:51:19Z","updated_at":"2015-02-14T17:51:19Z","html_url":"https://github.com/GalSim-developers/GalSim/pull/632#discussion_r24715928","pull_request_url":"https://api.github.com/repos/GalSim-developers/GalSim/pulls/632","_links":{"self":{"href":"https://api.github.com/repos/GalSim-developers/GalSim/pulls/comments/24715928"},"html":{"href":"https://github.com/GalSim-developers/GalSim/pull/632#discussion_r24715928"},"pull_request":{"href":"https://api.github.com/repos/GalSim-developers/GalSim/pulls/632"}}},"pull_request":{"url":"https://api.github.com/repos/GalSim-developers/GalSim/pulls/632","id":27635706,"html_url":"https://github.com/GalSim-developers/GalSim/pull/632","diff_url":"https://github.com/GalSim-developers/GalSim/pull/632.diff","patch_url":"https://github.com/GalSim-developers/GalSim/pull/632.patch","issue_url":"https://api.github.com/repos/GalSim-developers/GalSim/issues/632","number":632,"state":"open","locked":false,"title":"#618 - interpolated ChromaticObject functionality","user":{"login":"rmandelb","id":1454906,"avatar_url":"https://avatars.githubusercontent.com/u/1454906?v=3","gravatar_id":"","url":"https://api.github.com/users/rmandelb","html_url":"https://github.com/rmandelb","followers_url":"https://api.github.com/users/rmandelb/followers","following_url":"https://api.github.com/users/rmandelb/following{/other_user}","gists_url":"https://api.github.com/users/rmandelb/gists{/gist_id}","starred_url":"https://api.github.com/users/rmandelb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmandelb/subscriptions","organizations_url":"https://api.github.com/users/rmandelb/orgs","repos_url":"https://api.github.com/users/rmandelb/repos","events_url":"https://api.github.com/users/rmandelb/events{/privacy}","received_events_url":"https://api.github.com/users/rmandelb/received_events","type":"User","site_admin":false},"body":"This is a new pull request for code that enables faster rendering of ChromaticObjects by interpolating between precomputed images.  The code has been substantially modified compared to what was presented in an earlier pull request, thanks to comments from @rmjarvis and @jmeyers314 (and looks different enough now that I think it's worth starting a new PR).   Please check it out and see what you think.\r\n\r\nA few final comments and questions:\r\n* @jmeyers314 , one thing I was thinking about was the question of whether it makes sense to ever draw a ChromaticAtmosphere or ChromaticOpticalPSF or any such thing without convolving with something that has an SED.  Currently, this is allowed, but it's not really clear what this corresponds to physically.  Is this something that we should either forbid or at least raise a warning that the physical interpretation is unclear?\r\n\r\n* More generally, I was thinking about transformations of certain ChromaticObjects.  Currently, ChromaticAtmosphere is qualitatively different from ChromaticOpticalPSF in that the former is a method that returns a ChromaticObject corresponding to the PSF at some base wavelength along with some chromatic transformations, whereas the latter is actually a class that has an evaluateAtWavelength method.  This means that in practice, if you do\r\n```\r\nfoo = galsim.ChromaticAtmosphere(...)\r\nbar = foo.dilate(...)\r\n```\r\nthen the ChromaticObject.evaluateAtWavelength() method will take care of the dilation, whereas if you do\r\n```\r\nfoo = galsim.ChromaticOpticalPSF(...)\r\nbar = foo.dilate(...)\r\n```\r\nthen since evaluateAtWavelength for the ChromaticOpticalPSF class does not explicitly apply transformations, nothing would happen here, so I actually made dilate() and other transformations of ChromaticOpticalPSF invalid.\r\n\r\nI could alternatively make ChromaticOpticalPSF have an ```_A``` and ```_fluxFactor``` attribute, and then its ```evaluateAtWavelength``` would have to apply the transformations.  The reason I didn't do that was that I felt that since there is a clearly physical process behind the form of the ChromaticOpticalPSF, enabling arbitrary transformations of them didn't make sense.  However, I am willing to hear arguments to the contrary about this.  And for what it's worth, in principle one can still transform ChromaticOpticalPSF after ```setupInterpolation```.\r\n\r\nMore generally, this whole experience made me wonder about the idea of people making subclasses of ChromaticObject.  It seems like they have to make evaluateAtWavelength handle transformations explicitly, copying over a lot of code from ChromaticObject.evaluateAtWavelength, which is perhaps something to warn about in the documentation.  But the decision of whether or not to do that seems like it should depend on what the particular subclass is meant to represent.\r\n\r\nAnyway, ideas on either of these two points are welcome.\r\n","created_at":"2015-01-19T21:06:57Z","updated_at":"2015-02-14T17:51:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d90e9db9949d50bddc1b3fad3cc9f51cd90cf6f0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/GalSim-developers/GalSim/pulls/632/commits","review_comments_url":"https://api.github.com/repos/GalSim-developers/GalSim/pulls/632/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/632/comments","statuses_url":"https://api.github.com/repos/GalSim-developers/GalSim/statuses/bb6c731079a02a10776cca6229e3901f6088ec86","head":{"label":"GalSim-developers:#618","ref":"#618","sha":"bb6c731079a02a10776cca6229e3901f6088ec86","user":{"login":"GalSim-developers","id":1462196,"avatar_url":"https://avatars.githubusercontent.com/u/1462196?v=3","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://avatars.githubusercontent.com/u/1462196?v=3","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}","created_at":"2012-02-22T02:51:45Z","updated_at":"2015-01-27T06:46:41Z","pushed_at":"2015-02-14T03:46:14Z","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":90305,"stargazers_count":29,"watchers_count":29,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":19,"mirror_url":null,"open_issues_count":57,"forks":19,"open_issues":57,"watchers":29,"default_branch":"releases/1.2"}},"base":{"label":"GalSim-developers:master","ref":"master","sha":"ef628599468e296e843e27d4e2197336d94a2026","user":{"login":"GalSim-developers","id":1462196,"avatar_url":"https://avatars.githubusercontent.com/u/1462196?v=3","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://avatars.githubusercontent.com/u/1462196?v=3","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}","created_at":"2012-02-22T02:51:45Z","updated_at":"2015-01-27T06:46:41Z","pushed_at":"2015-02-14T03:46:14Z","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":90305,"stargazers_count":29,"watchers_count":29,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":19,"mirror_url":null,"open_issues_count":57,"forks":19,"open_issues":57,"watchers":29,"default_branch":"releases/1.2"}},"_links":{"self":{"href":"https://api.github.com/repos/GalSim-developers/GalSim/pulls/632"},"html":{"href":"https://github.com/GalSim-developers/GalSim/pull/632"},"issue":{"href":"https://api.github.com/repos/GalSim-developers/GalSim/issues/632"},"comments":{"href":"https://api.github.com/repos/GalSim-developers/GalSim/issues/632/comments"},"review_comments":{"href":"https://api.github.com/repos/GalSim-developers/GalSim/pulls/632/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/632/commits"},"statuses":{"href":"https://api.github.com/repos/GalSim-developers/GalSim/statuses/bb6c731079a02a10776cca6229e3901f6088ec86"}}}}