Analysis#

class gammapy.analysis.Analysis(config)[source]#

Bases: object

Config-driven high level analysis interface.

It is initialized by default with a set of configuration parameters and values declared in an internal high level interface model, though the user can also provide configuration parameters passed as a nested dictionary at the moment of instantiation. In that case these parameters will overwrite the default values of those present in the configuration file.

Parameters
configdict or AnalysisConfig

Configuration options following AnalysisConfig schema.

Attributes Summary

config

Analysis configuration as an AnalysisConfig object.

models

Methods Summary

get_datasets()

Produce reduced datasets.

get_excess_map()

Calculate excess map with respect to the current model.

get_flux_points()

Calculate flux points for a specific model component.

get_light_curve()

Calculate light curve for a specific model component.

get_observations()

Fetch observations from the data store according to criteria defined in the configuration.

read_datasets()

Read datasets from YAML file.

read_models(path[, extend])

Read models from YAML file.

run_fit()

Fitting reduced datasets to model.

set_models(models[, extend])

Set models on datasets.

update_config(config)

Update the configuration.

write_datasets([overwrite, write_covariance])

Write datasets to YAML file.

write_models([overwrite, write_covariance])

Write models to YAML file.

Attributes Documentation

config#

Analysis configuration as an AnalysisConfig object.

models#

Methods Documentation

get_datasets()[source]#

Produce reduced datasets.

Notes

The progress bar can be displayed for this function.

get_excess_map()[source]#

Calculate excess map with respect to the current model.

get_flux_points()[source]#

Calculate flux points for a specific model component.

get_light_curve()[source]#

Calculate light curve for a specific model component.

get_observations()[source]#

Fetch observations from the data store according to criteria defined in the configuration.

read_datasets()[source]#

Read datasets from YAML file.

File names are taken from the configuration file.

read_models(path, extend=True)[source]#

Read models from YAML file.

Parameters
pathstr

Path to the model file.

extendbool, optional

Extend the exiting models on the datasets or replace them. Default is True.

run_fit()[source]#

Fitting reduced datasets to model.

set_models(models, extend=True)[source]#

Set models on datasets.

Adds FoVBackgroundModel if not present already

Parameters
modelsModels or str

Models object or YAML models string.

extendbool, optional

Extend the exiting models on the datasets or replace them. Default is True.

update_config(config)[source]#

Update the configuration.

write_datasets(overwrite=True, write_covariance=True)[source]#

Write datasets to YAML file.

File names are taken from the configuration file.

Parameters
overwritebool, optional

Overwrite existing file. Default is True.

write_covariancebool, optional

Save covariance or not. Default is True.

write_models(overwrite=True, write_covariance=True)[source]#

Write models to YAML file.

File name is taken from the configuration file.