modeling - Models and fitting

Introduction

gammapy.modeling contains all the functionality related to modeling and fitting data. This includes spectral, spatial and temporal model classes, as well as the fit and parameter API. An overview of all the available models can be found in the Model gallery. In general the models are grouped into the following categories:

  • SpectralModel: models to describe spectral shapes of sources

  • SpatialModel: models to describe spatial shapes (morphologies) of sources

  • TemporalModel: models to describe temporal flux evolution of sources, such as light and phase curves

  • SkyModel and SkyDiffuseCube: model to combine the spectral and spatial model components

The models follow a naming scheme which contains the category as a suffix to the class name.

Tutorials

Tutorials that show examples using gammapy.modeling:

Reference/API

gammapy.modeling Package

Models and fitting.

Functions

plot_corner(sampler, dataset[, nburn])

Corner plot for each parameter explored by the walkers.

plot_trace(sampler, dataset)

Plot the trace of walkers for every steps

run_mcmc(dataset[, nwalkers, nrun, threads])

Run the MCMC sampler.

uniform_prior(value, umin, umax)

Uniform prior distribution.

Classes

Dataset

Dataset abstract base class.

Datasets(datasets)

Dataset collection.

Fit(datasets)

Fit class.

Parameter(name, factor[, unit, scale, min, …])

A model parameter.

Parameters([parameters, covariance])

Parameters container.

gammapy.modeling.models Package

Built-in models in Gammapy.

Functions

create_crab_spectral_model([reference])

Create a Crab nebula reference spectral model.

create_cosmic_ray_spectral_model([particle])

Cosmic a cosmic ray spectral model at Earth.

Classes

SkyModelBase(**kwargs)

Sky model base class

Models([models])

Sky model collection.

SkyModel(spectral_model[, spatial_model, …])

Sky model component.

SkyDiffuseCube(map[, norm, tilt, reference, …])

Cube sky map template model (3D).

BackgroundModel(map[, norm, tilt, …])

Background model.

Absorption(energy, param, data[, filename, …])

Gamma-ray absorption models.

SpatialModel(**kwargs)

Spatial model base class.

SpectralModel(**kwargs)

Spectral model base class.

TemporalModel(**kwargs)

Temporal model base class.

ConstantSpatialModel(**kwargs)

Spatially constant (isotropic) spatial model.

TemplateSpatialModel(map[, norm, meta, …])

Spatial sky map template model (2D).

DiskSpatialModel(**kwargs)

Constant disk model.

GaussianSpatialModel(**kwargs)

Two-dimensional Gaussian model.

PointSpatialModel(**kwargs)

Point Source.

ShellSpatialModel(**kwargs)

Shell model.

ConstantSpectralModel(**kwargs)

Constant model.

CompoundSpectralModel(model1, model2, operator)

Arithmetic combination of two spectral models.

PowerLawSpectralModel(**kwargs)

Spectral power-law model.

PowerLaw2SpectralModel(**kwargs)

Spectral power-law model with integral as amplitude parameter.

SmoothBrokenPowerLawSpectralModel(**kwargs)

Spectral smooth broken power-law model.

ExpCutoffPowerLawSpectralModel(**kwargs)

Spectral exponential cutoff power-law model.

ExpCutoffPowerLaw3FGLSpectralModel(**kwargs)

Spectral exponential cutoff power-law model used for 3FGL.

SuperExpCutoffPowerLaw3FGLSpectralModel(**kwargs)

Spectral super exponential cutoff power-law model used for 3FGL.

SuperExpCutoffPowerLaw4FGLSpectralModel(**kwargs)

Spectral super exponential cutoff power-law model used for 4FGL.

LogParabolaSpectralModel(**kwargs)

Spectral log parabola model.

TemplateSpectralModel(energy, values[, …])

A model generated from a table of energy and value arrays.

GaussianSpectralModel(**kwargs)

Gaussian spectral model.

AbsorbedSpectralModel(spectral_model, …[, …])

Spectral model with EBL absorption.

NaimaSpectralModel(radiative_model[, …])

A wrapper for Naima models.

ScaleSpectralModel(model[, norm])

Wrapper to scale another spectral model by a norm factor.

ConstantTemporalModel(**kwargs)

Constant temporal model.

PhaseCurveTemplateTemporalModel(table[, …])

Temporal phase curve model.

LightCurveTemplateTemporalModel(table[, …])

Temporal light curve model.

Variables

SPATIAL_MODELS

Built-in spatial models.

TEMPORAL_MODELS

Built-in temporal models.

SPECTRAL_MODELS

Built-in spectral models.