# ThetaCalculator¶

class gammapy.image.models.ThetaCalculator(dist, theta_max, n_bins, normalize=False)[source]

Bases: object

Provides methods containment_fraction(theta) and containment_radius(containment_fraction) given some 1D distribution (not necessarily normalized).

Notes If you have to compute theta or containment many times for the same dist, this is much faster than ThetaCalculatorScipy. If you want only one value it could actually be slower, especially the containment calculation.

Parameters: dist : callable Distribution function dp / dtheta2 (theta2) theta_max : float Integration range will be 0 .. theta_max ^ 2 nbins : int Integration step size normalize : bool Normalize discretized distribution to 1?

Methods Summary

 containment_fraction(theta) Compute containment fraction for a given theta. containment_radius(containment_fraction) Compute theta for a given containment fraction.

Methods Documentation

containment_fraction(theta)[source]

Compute containment fraction for a given theta.

containment_radius(containment_fraction)[source]

Compute theta for a given containment fraction.