Datasets

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

Bases: collections.abc.Sequence

Dataset collection.

Parameters
datasetsDataset or list of Dataset

Datasets

Attributes Summary

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

parameters

Unique parameters (Parameters).

Methods Summary

copy(self)

A deep copy.

count(self, value)

index(self, value[, start, stop])

Raises ValueError if the value is not present.

info_table(self[, cumulative])

Get info table for datasets.

read(filedata, filemodel)

De-serialize datasets from YAML and FITS files.

stack_reduce(self)

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

stat_sum(self)

Compute joint likelihood

write(self, path[, prefix, overwrite])

Serialize datasets to YAML and FITS files.

Attributes Documentation

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

parameters

Unique parameters (Parameters).

Duplicate parameter objects have been removed. The order of the unique parameters remains.

Methods Documentation

copy(self)[source]

A deep copy.

count(self, value)
index(self, value, start=0, stop=None)

Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

info_table(self, cumulative=False)[source]

Get info table for datasets.

Parameters
cumulativebool

Cumulate info across all observations

Returns
info_tableTable

Info table.

classmethod read(filedata, filemodel)[source]

De-serialize datasets from YAML and FITS files.

Parameters
filedatastr

filepath to yaml datasets file

filemodelstr

filepath to yaml models file

Returns
dataset‘gammapy.modeling.Datasets’

Datasets

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

stat_sum(self)[source]

Compute joint likelihood

write(self, path, prefix='', overwrite=False)[source]

Serialize datasets to YAML and FITS files.

Parameters
pathpathlib.Path

path to write files

prefixstr

common prefix of file names

overwritebool

overwrite datasets FITS files