astromodels.functions.template_model module

exception astromodels.functions.template_model.IncompleteGrid[source]

Bases: RuntimeError

exception astromodels.functions.template_model.MissingDataFile[source]

Bases: RuntimeError

class astromodels.functions.template_model.TemplateModel(model_name: str, other_name: str | None = None, log_interp: bool = True)[source]

Bases: Function1D

description :

A template model

latex :


parameters :
K :

desc : Normalization (freeze this to 1 if the template provides the normalization by itself) initial value : 1.0

scale :
descScale for the independent variable. The templates are handled as if they contains the fluxes

at E = scale * x.This is useful for example when the template describe energies in the rest frame, at which point the scale describe the transformation between rest frame energy and observer frame energy. Fix this to 1 to neutralize its effect.

initial value : 1.0 min : 1e-5


desc: redshift the energies initial value: 0. min: 0 fix: True


Table models can consume a lot of memory. If are creating lots of table models in memory for simulations, you may want to call clean on the model try and remove some of the memory consumed by the models


property data_file
evaluate(x, K, scale, redshift, *args)[source]
static info()
class astromodels.functions.template_model.TemplateModelFactory(name: str, description: str, energies: ndarray, names_of_parameters: List[str], interpolation_degree: int = 1, spline_smoothing_factor: int = 0)[source]

Bases: object

add_interpolation_data(differential_fluxes: ndarray, **parameters_values_input: Dict[str, float])[source]
define_parameter_grid(parameter_name: str, grid: ndarray) None[source]

Define the parameter grid for this parameter. Pass the name of the parameter and the array of values that it will take in the grid

save_data(overwrite: bool = False)[source]
exception astromodels.functions.template_model.ValuesNotInGrid[source]

Bases: ValueError