MultiGauss2D¶
-
class
gammapy.image.models.MultiGauss2D(sigmas, norms=None)[source]¶ Bases:
objectSum of multiple 2D Gaussians.
Parameters: sigmas :
ndarraywidths of the Gaussians to add
norms :
ndarray, optionalnormalizations of the Gaussians to add
Notes
- This sum is no longer a PDF, it is not normalized to 1.
- The “norm” of each component represents the 2D integral, not the amplitude at the origin.
Attributes Summary
amplitudeAmplitude at the center (float) eff_sigmaEffective Gaussian width for single-Gauss approximation (float) integralIntegral as sum of norms ( ndarray)max_sigmaLargest Gaussian width (float) n_componentsNumber of components (int) sigmasArray of Gaussian widths ( ndarray)Methods Summary
__call__(x[, y])dp / (dx dy) at position (x, y) containment_fraction(theta)Containment fraction. containment_radius(containment_fraction)Containment angle for a given containment fraction. dpdtheta2(theta2)dp / dtheta2 at position theta2 = theta ^ 2 gauss_convolve(sigma[, norm])Convolve with another Gauss. match_sigma(containment_fraction)Compute equivalent Gauss width. normalize()Normalize function. Attributes Documentation
-
amplitude¶ Amplitude at the center (float)
-
eff_sigma¶ Effective Gaussian width for single-Gauss approximation (float)
Notes
The effective Gaussian width is given by:
\[\sigma_\mathrm{eff} = \sqrt{\sum_i N_i \sigma_i^2}\]where
Nis normalization andsigmais width.
-
max_sigma¶ Largest Gaussian width (float)
-
n_components¶ Number of components (int)
Methods Documentation
-
__call__(x, y=0)[source]¶ dp / (dx dy) at position (x, y)
Parameters: x :
ndarrayx coordinate
y :
ndarray, optionaly coordinate
Returns: total :
ndarraydp / (dx dy)
-
containment_fraction(theta)[source]¶ Containment fraction.
Parameters: theta :
ndarrayOffset
Returns: containment_fraction :
ndarrayContainment fraction
-
containment_radius(containment_fraction)[source]¶ Containment angle for a given containment fraction.
Parameters: containment_fraction :
ndarrayContainment fraction
Returns: containment_radius :
ndarrayContainment radius
-
dpdtheta2(theta2)[source]¶ dp / dtheta2 at position theta2 = theta ^ 2
Parameters: theta2 :
ndarrayOffset squared
Returns: dpdtheta2 :
ndarraydp / dtheta2
-
gauss_convolve(sigma, norm=1)[source]¶ Convolve with another Gauss.
Compute new norms and sigmas of all the components such that the new distribution represents the convolved old distribution by a Gaussian of width sigma and then multiplied by norm.
This MultiGauss2D is unchanged, a new one is created and returned. This is useful if you need to e.g. compute theta for one PSF and many sigmas.
Parameters: sigma :
ndarrayor floatGaussian width of the new Gaussian 2D PDF to covolve with.
norm :
ndarrayor floatNormalization of the new Gaussian 2D PDF to covolve with.
Returns: new_multi_gauss_2d :
MultiGauss2DConvolution as new MultiGauss2D
-
match_sigma(containment_fraction)[source]¶ Compute equivalent Gauss width.
Find the sigma of a single-Gaussian distribution that approximates this one, such that theta matches for a given containment.
Parameters: containment_fraction :
ndarrayContainment fraction
Returns: sigma :
ndarrayEquivalent containment radius
-
normalize()[source]¶ Normalize function.
Returns: norm_multigauss :
MultiGauss2Dnormalized function