TableInterpolationSpectrum#

class ctao_cr_spectra.spectral.TableInterpolationSpectrum(energy, flux, log_energy=True, log_flux=True, reference_energy=<Quantity 1. TeV>)#

Bases: object

Spectrum interpolating tabulated values.

By default, flux is interpolated linearly in log-log space.

Methods Summary

__call__(energy)

Evaluate the flux at a given energy.

from_file(path[, log_energy, log_flux, ...])

Create a TableInterpolationSpectrum instance from file.

from_table(table[, log_energy, log_flux, ...])

Create a TableInterpolationSpectrum instance from table.

Methods Documentation

__call__(energy)#

Evaluate the flux at a given energy.

Parameters:
energyastropy.units.Quantity

The energy at which to evaluate the flux.

Returns:
astropy.units.Quantity

The flux at the given energy.

classmethod from_file(path, log_energy=True, log_flux=True, reference_energy=<Quantity 1. TeV>)#

Create a TableInterpolationSpectrum instance from file.

Parameters:
clsclass

The class itself (implicit).

pathstr

The path to the data file.

log_energybool, optional

Whether to log-transform the energy values. Defaults to True.

log_fluxbool, optional

Whether to log-transform the flux values. Defaults to True.

reference_energyastropy.units.Quantity, optional

The reference energy for normalization. Defaults to 1 TeV.

Returns:
instance

An instance of the class populated with data from the file.

classmethod from_table(table: ~astropy.table.table.QTable, log_energy=True, log_flux=True, reference_energy=<Quantity 1. TeV>)#

Create a TableInterpolationSpectrum instance from table.

Parameters:
clsclass

The class itself (implicit).

tableastropy.table.QTable

Table containing energy and flux data.

log_energybool, optional

Whether to log-transform the energy values. Defaults to True.

log_fluxbool, optional

Whether to log-transform the flux values. Defaults to True.

reference_energyastropy.units.Quantity, optional

The reference energy for normalization. Defaults to 1 TeV.

Returns:
instance

An instance of the class populated with data from the table.