Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Remove unused functions from gammapy.irf #2552
@@ Coverage Diff @@ ## master #2552 +/- ## ========================================== + Coverage 91.26% 91.31% +0.04% ========================================== Files 144 144 Lines 16282 16213 -69 ========================================== - Hits 14860 14805 -55 + Misses 1422 1408 -14
Do you want to keep it or replace it with something else?
I noticed it in static analysis, because PyCharm complains about the coding pattern that can lead to
I guess if the code to create one object isn't a lot, then we should put one line code duplication before and in the loop, and rewrite it like this?
def make_mean_psf(observations, position, energy=None, rad=None): psf = make_psf(observations, position, energy, rad) for observation in observations[1:]: psf_obs = make_psf(observation, position, energy, rad) psf = psf.stack(psf_obs) return psf
This will lead to an
Another coding pattern we could use:
def make_mean_psf(observations, position, energy=None, rad=None): return EnergyDependentTablePSF.from_stack( make_psf(obs, position, energy, rad) for obs in observations )
This might be a general point for functions where we accumulate or stack, i.e. we should probably clean up in other places as well and always use the same coding pattern.