CWTData

class gammapy.detect.CWTData(counts, background, n_scale)[source]

Bases: object

Images for CWT algorithm.

Contains also input counts and background.

Parameters:

counts : SkyImage

2D counts image.

background : SkyImage

2D background image.

n_scale : int

Number of scales.

Examples

>>> from gammapy.image import SkyImage
>>> from gammapy.detect import CWTData
>>> filename = '$GAMMAPY_EXTRA/datasets/fermi_survey/all.fits.gz'
>>> image = SkyImage.read(filename, hdu='COUNTS')
>>> background = SkyImage.read(filename, hdu='BACKGROUND')
>>> data = CWTData(counts=image, background=background, n_scale=2)

Attributes Summary

approx 2D approx??? image (SkyImage).
approx_bkg 2D approx bkg image (SkyImage).
background 2D background input image (SkyImage).
counts 2D counts input image (SkyImage).
error 3D error cube (SkyCube).
info_table Information about all the images and cubes.
max_scale_image Maximum scale image (SkyImage).
model 2D model image (SkyImage).
model_plus_approx TODO: document what this is.
residual 2D residual image (SkyImage).
support_2d 2D cube exclusion mask (SkyCube).
support_3d 3D support (exclusion) cube (SkyCube).
transform_2d 2D transforma??? image (SkyImage).
transform_3d 3D SkyCube cube. Primordial initialized by zero array. In the course of

Methods Summary

cube_info(name[, per_scale]) Compute cube info.
cubes() All the cubes in a dict.
image_info(name) Compute image info.
images() All the images in a dict.
write(filename[, overwrite]) Save results to FITS file.

Attributes Documentation

approx

2D approx??? image (SkyImage).

In the course of iterations updated by convolution of
counts - model - background with kern_approx

Primordial initialized by zero array.

approx_bkg

2D approx bkg image (SkyImage).

In the course of iterations updated by convolution of background with kern_approx. Primordial initialized by zero array.

background

2D background input image (SkyImage).

counts

2D counts input image (SkyImage).

error

3D error cube (SkyCube).

Primordial initialized by zero array. In the course of iterations updated by convolution of total_background with kernel^2 for each scale.

info_table

Information about all the images and cubes.

Returns:

table : Table

Information about the object.

max_scale_image

Maximum scale image (SkyImage).

model

2D model image (SkyImage).

Positive version of transform_2d image. Primordial initialized by zero array.

model_plus_approx

TODO: document what this is.

residual

2D residual image (SkyImage).

Calculate as counts - model - approx.

support_2d

2D cube exclusion mask (SkyCube).

Created from support_3d by OR-operation per 0 axis.

support_3d

3D support (exclusion) cube (SkyCube).

Primordial initialized by zero array.

transform_2d

2D transforma??? image (SkyImage).

Created from transform_3d by summarize values per 0 axes. Primordial initialized by zero array.

transform_3d

3D SkyCube cube. Primordial initialized by zero array. In the course of iterations updated by convolution of counts - total_background with kernel for each scale (total_background = model + background + approx).

Methods Documentation

cube_info(name, per_scale=False)[source]

Compute cube info.

Compute variance, mean, find max and min values and compute sum for image with given name. Return that information about the image.

Parameters:

name : string

Name of the image. Name can be as one of the follow: {‘transform_3d’, ‘error’, ‘support’}

per_scale : boolean, optional (default False)

If True, return information about the cube per all the scales.

Returns:

table : Table

Information about the object.

cubes()[source]

All the cubes in a dict.

Returns:

cubes : OrderedDict

Dictionary with keys {‘transform_3d’, ‘error’, ‘support_3d’} and 3D ndarray cubes as values.

image_info(name)[source]

Compute image info.

Compute variance, mean, find max and min values and compute sum for image with given name. Return that information about the image.

Parameters:

name : string

Name of the image. Name can be as one of the follow: {‘counts’, ‘background’, ‘model’, ‘approx’, ‘approx_bkg’, ‘transform_2d’, ‘model_plus_approx’, ‘residual’, ‘maximal’, ‘support_2d’}

Returns:

table : Table

Information about the object.

images()[source]

All the images in a dict.

Returns:

images : OrderedDict

Dictionary with keys {‘counts’, ‘background’, ‘model’, ‘approx’, ‘approx_bkg’, ‘transform_2d’, ‘maximal’, ‘support_2d’} and 2D ndarray images as values.

write(filename, overwrite=False)[source]

Save results to FITS file.

Parameters:

filename : str

Fits file name.

overwrite : bool, optional (default False)

If True, overwrite file with name as filename.