{"action":"opened","issue":{"url":"https://api.github.com/repos/GalSim-developers/GalSim/issues/670","labels_url":"https://api.github.com/repos/GalSim-developers/GalSim/issues/670/labels{/name}","comments_url":"https://api.github.com/repos/GalSim-developers/GalSim/issues/670/comments","events_url":"https://api.github.com/repos/GalSim-developers/GalSim/issues/670/events","html_url":"https://github.com/GalSim-developers/GalSim/issues/670","id":87540562,"number":670,"title":"Cache chromatic drawImage intermediate results","user":{"login":"jmeyers314","id":3650485,"avatar_url":"https://avatars.githubusercontent.com/u/3650485?v=3","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},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-11T23:32:00Z","updated_at":"2015-06-11T23:32:00Z","closed_at":null,"body":"This issue is to implement caches of intermediate products in the drawImage() and drawKImage() methods of `ChromaticObject` and subclasses where possible.\r\n\r\nThere are several instances where one may wish to call the `drawImage()` (or `drawKImage()`) method of a `ChromaticObject` with only minor changes between invocations, and in particular with no changes to `SED`s, `Bandpass`es, and chromatic PSFs.  Examples include forward-model fitting/sampling and ring tests.  In these cases, it would be advantageous to avoid recomputing certain intermediate results of `ChromaticObject.drawImage()` and `.drawKImage()`, such as the product of an SED and a Bandpass in the case of separable profiles, or the effective (wavelength-integrated) profile in the case of convolution of separable and inseparable profiles.\r\n\r\nPreviously, creating such a cache was problematic since it was difficult to recognize when particular GalSim objects had been seen before.  Now that (most) GalSim objects are immutable, though, and carry `__eq__` and `__hash__` methods, caching is feasible.  \r\n\r\nMy current plan is to steal the code for the cache from here: http://code.activestate.com/recipes/577970-simplified-lru-cache/ , but I'm happy to hear alternatives."}}