PowerLaw#

class ctao_cr_spectra.spectral.PowerLaw(normalization, index, e_ref=<Quantity 1. TeV>)#

Bases: object

A power law with normalization, reference energy and index.

Index includes the sign:

\[\Phi(E, \Phi_0, \gamma, E_\text{ref}) = \Phi_0 \left(\frac{E}{E_\text{ref}}\right)^{\gamma}\]
Attributes:
normalization: astropy.units.Quantity[flux]

\(\Phi_0\),

index: float

\(\gamma\)

e_ref: astropy.units.Quantity[energy]

\(E_\text{ref}\)

Attributes Summary

is_diffuse

Returns True if the normalization has units of diffuse flux rather than point-like flux.

Methods Summary

__call__(energy)

Evaluate the flux at a given energy.

compute_events_rate(inner, outer, area, ...)

Integrate all the quantities from the spectrum (except time).

compute_number_events(inner, outer, ...)

Integrate all the quantities from the spectrum and derive the total number of events.

integrate_area(area)

Integrate this powerlaw over the given observatory area.

integrate_cone(inner, outer)

Integrate this powerlaw over solid angle in the given cone.

integrate_energy(energy_min, energy_max)

Integrate this powerlaw over the given energy range.

integrate_time(obs_time)

Integrate this powerlaw over the given observation time.

Attributes Documentation

is_diffuse#

Returns True if the normalization has units of diffuse flux rather than point-like flux.

Methods Documentation

__call__(energy)#

Evaluate the flux at a given energy.

Parameters:
energyastropy.units.Quantity

The energy at which to evaluate the flux. Should be in units of energy.

Returns:
astropy.units.Quantity

The flux at the given energy.

compute_events_rate(inner, outer, area, energy_min, energy_max)#

Integrate all the quantities from the spectrum (except time).

Derive the events rate expected for an integration in a region of space (inner, outer), over the area of the observatory (area) and over an energy range (energy).

Parameters:
innerastropy.units.Quantity[angle]

inner opening angle of cone

outerastropy.units.Quantity[angle]

outer opening angle of cone

area: astropy.units.Quantity[area]

Observation time to integrate the flux.

energy_min: astropy.units.Quantity[energy]

Minimum energy in the integration.

energy_max: astropy.units.Quantity[energy]

Maximum energy in the integration.

Returns:
float:

events rate integrated from the spectral distribution.

compute_number_events(inner, outer, obs_time, area, energy_min, energy_max)#

Integrate all the quantities from the spectrum and derive the total number of events.

Parameters:
innerastropy.units.Quantity[angle]

inner opening angle of cone

outerastropy.units.Quantity[angle]

outer opening angle of cone

obs_time: astropy.units.Quantity[time]

Observation time to integrate the flux.

area: astropy.units.Quantity[area]

Observation time to integrate the flux.

energy_min: astropy.units.Quantity[energy]

Minimum energy in the integration.

energy_max: astropy.units.Quantity[energy]

Maximum energy in the integration.

Returns:
float:

number of events integrated from the spectral distribution.

integrate_area(area)#

Integrate this powerlaw over the given observatory area.

Parameters:
area: astropy.units.Quantity[area]

Observation time to integrate the flux.

Returns:
integratedPowerLaw

A new area integrated powerlaw instance.

integrate_cone(inner, outer)#

Integrate this powerlaw over solid angle in the given cone.

Parameters:
innerastropy.units.Quantity[angle]

inner opening angle of cone

outerastropy.units.Quantity[angle]

outer opening angle of cone

Returns:
integratedPowerLaw

A new powerlaw instance with new normalization with the integration result.

Raises:
ValueError:

if the normalization unit does not allow a cone integration. if the inner radius is larger than outer radius.

integrate_energy(energy_min, energy_max)#

Integrate this powerlaw over the given energy range.

Parameters:
energy_min: astropy.units.Quantity[energy]

Minimum energy in the integration.

energy_max: astropy.units.Quantity[energy]

Maximum energy in the integration.

Returns:
integratedPowerLaw

A new area integrated powerlaw instance.

integrate_time(obs_time)#

Integrate this powerlaw over the given observation time.

Parameters:
obs_time: astropy.units.Quantity[time]

Observation time to integrate the flux.

Returns:
integratedPowerLaw

A new time integrated powerlaw instance.