Datasets

class gammapy.modeling.Datasets(datasets)[source]

Bases: object

Join multiple datasets.

Parameters:
datasets : Dataset or list of Dataset

List of Dataset objects ot be joined.

Attributes Summary

datasets List of datasets
is_all_same_shape Whether all contained datasets have the same data shape
is_all_same_type Whether all contained datasets are of the same type
names List of dataset names
parameters
types Types of the contained datasets

Methods Summary

copy(self) A deep copy.
from_yaml(filedata, filemodel) De-serialize datasets from YAML and FITS files.
likelihood(self) Compute joint likelihood
stack_reduce(self) Reduce the Datasets to a unique Dataset by stacking them together.
to_yaml(self, path[, overwrite]) Serialize datasets to YAML and FITS files.

Attributes Documentation

datasets

List of datasets

is_all_same_shape

Whether all contained datasets have the same data shape

is_all_same_type

Whether all contained datasets are of the same type

names

List of dataset names

parameters
types

Types of the contained datasets

Methods Documentation

copy(self)[source]

A deep copy.

classmethod from_yaml(filedata, filemodel)[source]

De-serialize datasets from YAML and FITS files.

Parameters:
filedata : str

filepath to yaml datasets file

filemodel : str

filepath to yaml models file

Returns:
dataset : ‘gammapy.modeling.Datasets’

Datasets

likelihood(self)[source]

Compute joint likelihood

stack_reduce(self)[source]

Reduce the Datasets to a unique Dataset by stacking them together.

This works only if all Dataset are of the same type and if a proper in-place stack method exists for the Dataset type.

Returns:
dataset : ~gammapy.utils.Dataset

the stacked dataset

to_yaml(self, path, overwrite=False)[source]

Serialize datasets to YAML and FITS files.

Parameters:
path : str

path to write files

overwrite : bool

overwrite datasets FITS files