lsst-sims / legacy_sims_GalSimInterface

code to seamlessly generate simulated images using GalSim based off of simulated catalogs generated by CatSim
5 stars 7 forks source link

Refactor maybeSwitchPSF a bit for speed #79

Open rmjarvis opened 5 years ago

rmjarvis commented 5 years ago

There was a hypothesis about a reason for some inefficiency in the current 2.1i run that some code in maybeSwitchPSF was inefficiency. I'm pretty sure this was a red herring, since the function only got called a handful of times (only when the flux was > 1.e6).

But since I had already started coding it up, I figured I'd go ahead an make a PR for it.

The two salient changes are:

  1. Grab the Aperture from the geometric screen rather than make a new one when building the OpticalPSF, so it doesn't have to recalculate the pupil plane image.
  2. Add an additional early exit that just checks the Kolmogorov max sb, since that should always be very quick to calculate. And if that peak is < thresh, then there is no point continuing on to put the object back together and check the full thing.