TemplateNDSpatialModel#

class gammapy.modeling.models.TemplateNDSpatialModel[source]#

Bases: SpatialModel

A model generated from a ND map where extra dimensions define the parameter space.

Parameters:
mapWcsNDMap or HpxNDMap

Map template.

metadict, optional

Meta information, meta[‘filename’] will be used for serialisation.

interp_kwargsdict

Interpolation keyword arguments passed to gammapy.maps.Map.interp_by_pix. Default arguments are {‘method’: ‘linear’, ‘fill_value’: 0, “values_scale”: “log”}.

copy_databool

Create a deepcopy of the map data or directly use the original. Default is True. Use False to save memory in case of large maps.

Attributes Summary

Methods Summary

evaluate(lon, lat[, energy])

from_dict(data)

Create a spatial model from a dictionary.

to_dict([full_output])

Create dictionary for YAML serialisation.

write([overwrite, filename])

Write the map.

Attributes Documentation

default_parameters = <gammapy.modeling.parameter.Parameters object>#
is_energy_dependent#
map#

Template map as a WcsNDMap or HpxNDMap.

tag = ['TemplateNDSpatialModel', 'templateND']#

Methods Documentation

evaluate(lon, lat, energy=None, **kwargs)[source]#
classmethod from_dict(data)[source]#

Create a spatial model from a dictionary.

Parameters:
datadict

Dictionary containing model parameters.

kwargsdict

Keyword arguments passed to from_parameters.

to_dict(full_output=False)[source]#

Create dictionary for YAML serialisation.

write(overwrite=False, filename=None)[source]#

Write the map.

Parameters:
overwritebool, optional

Overwrite existing file. Default is False, which will raise a warning if the template file exists already.

filenamestr, optional

Filename of the template model. By default, the template model will be saved with the TemplateNDSpatialModel.filename attribute. If filename is provided, this attribute will be used.

__init__(map, interp_kwargs=None, meta=None, filename=None, copy_data=True)[source]#
classmethod __new__(*args, **kwargs)#