ThetaCalculator2D

class gammapy.image.models.ThetaCalculator2D(dist, x, y)[source]

Bases: gammapy.image.models.ThetaCalculatorScipy

Methods to compute theta and containment for a given 2D probability distribution image.

Typically this method is used for PSF-convolved model images, where analytical distributions or 1D distributions are not available.

Note: The theta and containment is calculated relative to the origin (x, y) = (0, 0).

Note: We do simple bin summing. In principle we could do integration over bins by using scipy.integrate.dblquad in combination with e.g. scipy.interpolate.interp2d, but for the speed / precision we need this is overkill.

TODO: I just realized that probably the best thing to do is to bin (x,y) -> theta2, make a spline interpolation and then call ThetaCalculatorScipy!

Parameters:

dist : 2-dimensional array

Probability distribution (per dx * dy)

x : 2-dimensional array

Pixel x coordinate array. Must match shape of dist.

x : 2-dimensional array

Pixel x coordinate array. Must match share of dist.

Methods Summary

containment_fraction(theta)
containment_radius(containment_fraction) Compute containment angle using the containment_fraction method plus numerical root finding.

Methods Documentation

containment_fraction(theta)[source]
containment_radius(containment_fraction)

Compute containment angle using the containment_fraction method plus numerical root finding.