Datasets¶
-
class
gammapy.datasets.
Datasets
(datasets=None)[source]¶ Bases:
collections.abc.MutableSequence
Dataset collection.
Attributes Summary
Whether all contained datasets have aligned energy axis
Get global energy range of datasets.
GTI table
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
Meta table
Unique models (
Models
).Unique parameters (
Parameters
).Methods Summary
append
(value)S.append(value) – append value to the end of the sequence
clear
()copy
()A deep copy.
count
(value)extend
(values)S.extend(iterable) – extend sequence by appending elements from the iterable
index
(value, [start, [stop]])Raises ValueError if the value is not present.
info_table
([cumulative, region])Get info table for datasets.
insert
(idx, dataset)S.insert(index, value) – insert value before index
pop
([index])Raise IndexError if list is empty or index is out of range.
read
(filename[, filename_models, lazy, cache])De-serialize datasets from YAML and FITS files.
remove
(value)S.remove(value) – remove first occurrence of value.
reverse
()S.reverse() – reverse IN PLACE
select_time
(t_min, t_max[, atol])Select datasets in a given time interval.
slice_by_energy
(energy_min, energy_max)Select and slice datasets in energy range
stack_reduce
([name])Reduce the Datasets to a unique Dataset by stacking them together.
stat_sum
()Compute joint likelihood
write
(filename[, filename_models, …])Serialize datasets to YAML and FITS files.
Attributes Documentation
-
energy_axes_are_aligned
¶ Whether all contained datasets have aligned energy axis
-
energy_ranges
¶ Get global energy range of datasets.
The energy range is derived as the minimum / maximum of the energy ranges of all datasets.
- Returns
- energy_min, energy_max
Quantity
Energy range.
- energy_min, energy_max
-
gti
¶ GTI table
-
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
-
meta_table
¶ Meta table
-
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
(value)¶ S.append(value) – append value to the end of the sequence
-
clear
() → None -- remove all items from S¶
-
count
(value) → integer -- return number of occurrences of value¶
-
extend
(values)¶ S.extend(iterable) – extend sequence by appending elements from the iterable
-
index
(value[, start[, stop]]) → integer -- return first index of value.[source]¶ Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.
-
info_table
(cumulative=False, region=None)[source]¶ Get info table for datasets.
- Parameters
- cumulativebool
Cumulate info across all observations
- Returns
- info_table
Table
Info table.
- info_table
-
pop
([index]) → item -- remove and return item at index (default last).¶ Raise IndexError if list is empty or index is out of range.
-
classmethod
read
(filename, filename_models=None, lazy=True, cache=True)[source]¶ De-serialize datasets from YAML and FITS files.
- Parameters
- filenamestr or
Path
File path or name of datasets yaml file
- filename_modelsstr or
Path
File path or name of models fyaml ile
- lazybool
Whether to lazy load data into memory
- cachebool
Whether to cache the data after loading.
- filenamestr or
- Returns
- dataset
gammapy.datasets.Datasets
Datasets
- dataset
-
remove
(value)¶ S.remove(value) – remove first occurrence of value. Raise ValueError if the value is not present.
-
reverse
()¶ S.reverse() – reverse IN PLACE
-
slice_by_energy
(energy_min, energy_max)[source]¶ Select and slice datasets in energy range
- Parameters
- energy_min, energy_max
Quantity
Energy bounds to compute the flux point for.
- energy_min, energy_max
- Returns
- datasetsDatasets
Datasets
-
stack_reduce
(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
(filename, filename_models=None, overwrite=False, write_covariance=True)[source]¶ Serialize datasets to YAML and FITS files.
- Parameters
- filenamestr or
Path
File path or name of datasets yaml file
- filename_modelsstr or
Path
File path or name of models fyaml ile
- overwritebool
overwrite datasets FITS files
- write_covariancebool
save covariance or not
- filenamestr or
-