Datasets¶
-
class
gammapy.datasets.
Datasets
(datasets=None)[source]¶ Bases:
collections.abc.MutableSequence
Dataset collection.
Attributes Summary
Whether all contained datasets have the same data shape
Whether all contained datasets have the same data shape
Whether all contained datasets are of the same type
Unique models (
Models
).Unique parameters (
Parameters
).Methods Summary
append
(self, value)S.append(value) – append value to the end of the sequence
clear
(self)copy
(self)A deep copy.
count
(self, value)extend
(self, values)S.extend(iterable) – extend sequence by appending elements from the iterable
index
(self, key)Raises ValueError if the value is not present.
info_table
(self[, cumulative])Get info table for datasets.
insert
(self, idx, dataset)S.insert(index, value) – insert value before index
pop
(self[, index])Raise IndexError if list is empty or index is out of range.
read
(filedata, filemodel)De-serialize datasets from YAML and FITS files.
remove
(self, value)S.remove(value) – remove first occurrence of value.
reverse
(self)S.reverse() – reverse IN PLACE
stack_reduce
(self[, name])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_energy_shape
¶ Whether all contained datasets have the same data shape
-
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
-
models
¶ Unique models (
Models
).Duplicate model objects have been removed. The order of the unique models remains.
-
names
¶
-
parameters
¶ Unique parameters (
Parameters
).Duplicate parameter objects have been removed. The order of the unique parameters remains.
Methods Documentation
-
append
(self, value)¶ S.append(value) – append value to the end of the sequence
-
clear
(self)¶
-
count
(self, value)¶
-
extend
(self, values)¶ S.extend(iterable) – extend sequence by appending elements from the iterable
-
index
(self, key)[source]¶ 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_table
Table
Info table.
- info_table
-
pop
(self, index=-1)¶ Raise IndexError if list is empty or index is out of range.
-
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
-
remove
(self, value)¶ S.remove(value) – remove first occurrence of value. Raise ValueError if the value is not present.
-
reverse
(self)¶ S.reverse() – reverse IN PLACE
-
stack_reduce
(self, name=None)[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
-
write
(self, path, prefix='', overwrite=False)[source]¶ Serialize datasets to YAML and FITS files.
- Parameters
- path
pathlib.Path
path to write files
- prefixstr
common prefix of file names
- overwritebool
overwrite datasets FITS files
- path
-