CWTData

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

Bases: object

Images for CWT algorithm.

Contains also input counts and background.

Parameters:

counts : WcsNDMap

2D counts image.

background : WcsNDMap

2D background image.

n_scale : int

Number of scales.

Examples

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

Attributes Summary

approx 2D approx ??? image (WcsNDMap).
approx_bkg 2D approx bkg image (WcsNDMap).
background 2D background input image (WcsNDMap).
counts 2D counts input image (WcsNDMap).
error 3D error cube (WcsNDMap).
info_table Information about all the images and cubes.
max_scale_image Maximum scale image (WcsNDMap).
model 2D model image (WcsNDMap).
model_plus_approx TODO: document what this is.
residual 2D residual image (WcsNDMap).
support_2d 2D cube exclusion mask (WcsNDMap).
support_3d 3D support (exclusion) cube (WcsNDMap).
transform_2d 2D transform ??? image (WcsNDMap).
transform_3d 3D transform ??? cube (WcsNDMap).

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 (WcsNDMap).

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 (WcsNDMap).

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

background

2D background input image (WcsNDMap).

counts

2D counts input image (WcsNDMap).

error

3D error cube (WcsNDMap).

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 (WcsNDMap).

model

2D model image (WcsNDMap).

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

model_plus_approx

TODO: document what this is.

residual

2D residual image (WcsNDMap).

Calculate as counts - model - approx.

support_2d

2D cube exclusion mask (WcsNDMap).

Created from support_3d by OR-operation per 0 axis.

support_3d

3D support (exclusion) cube (WcsNDMap).

Primordial initialized by zero array.

transform_2d

2D transform ??? image (WcsNDMap).

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

transform_3d

3D transform ??? cube (WcsNDMap).

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 : dict

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 : dict

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.