hyp#
Spectral hypothesis models.
Classes:
|
Abstract base class for fluxes. |
|
Spline flux spectrum. |
|
Implements the Core-Corona Seyfert Galaxy neutrino flux model of A. |
|
Power law spectrum. |
|
Energy-binned spectrum. |
- class csky.hyp.Flux[source]#
Bases:
object
Abstract base class for fluxes.
This class provides basic operations for flux functions of the form dN/dE=f(E), where E is in GeV and dN/dE is in units 1/GeV/cm2/s. The main value-added from this class is counts <–> flux calculations, which are performed in terms of total signal acceptance.
Todo
Check and then document the exact units of “total signal acceptance”.
Methods:
__call__
(E)Get dN/dE given E.
to_model_norm
(ns, acc_total)Get the model normalization resulting in ns, given the total acceptance.
to_dNdE
(ns, acc_total[, E0, unit])Get dN/dE for particular reference energy and units.
to_E2dNdE
(ns, acc_total[, E0, unit])Get E0^2 * dN/dE for particular reference energy and units.
to_ns
(flux, acc_total[, E0, unit, use_E2dNdE])Get number of signal events corresponding to a particular flux.
__init__
()Attributes:
Convert to str->value fit parameter kwargs.
Get the energy range containing nonzero flux, (Emin,Emax), in GeV.
- abstract __call__(E)[source]#
Get dN/dE given E.
- Parameters:
E (float) – energy in GeV
- Returns:
dN/dE in units 1/GeV/cm2/s
- Return type:
float
- abstract property as_params#
Convert to str->value fit parameter kwargs.
- abstract property energy_range#
Get the energy range containing nonzero flux, (Emin,Emax), in GeV.
- to_model_norm(ns, acc_total)[source]#
Get the model normalization resulting in ns, given the total acceptance.
- Parameters:
ns (float) – number of signal events
acc_total (float) – total signal acceptance
- Returns:
model normalization
- Return type:
float
Todo
Check units of acc_total
This is just a semantically meaningful way of expressing
ns / acc_total
.
- to_dNdE(ns, acc_total, E0=1, unit=1)[source]#
Get dN/dE for particular reference energy and units.
- Parameters:
ns (float) – number of signal events
acc_total (float) – total signal acceptance
E0 (float) – reference energy in units
unit
* GeVunit (float) – energy unit for
E0
as well as in denominator of return value
- Returns:
dN/dE in units 1/(
unit
* GeV)/cm2/s- Return type:
float
For example, to get dN/dE at 100 TeV in units 1/TeV/cm2/s, use
to_dNdE(ns, acc_total, E0=100, unit=1000)
.Todo
Check units of acc_total
- to_E2dNdE(ns, acc_total, E0=1, unit=1)[source]#
Get E0^2 * dN/dE for particular reference energy and units.
Just like
Flux.to_dNdE()
, except multiplied by E0^2.
- to_ns(flux, acc_total, E0=1, unit=1, use_E2dNdE=True)[source]#
Get number of signal events corresponding to a particular flux.
- Parameters:
flux (float) – dN/dE or E0^2 * dN/dE(see argument
E2dNdE
)acc_total (float) – total signal acceptance
E0 (float) – reference energy in units
unit
* GeVunit (float) – energy unit for
E0
as well as in denominator of return valueE2dNdE (bool) – if true(default),
flux
gives E0^2 * dN/dE. otherwise,flux
gives dN/dE.
- Returns:
number of signal events
- Return type:
float
Todo
Check units of acc_total
- __init__()#
- class csky.hyp.SplineFluxModel(norm, psp_table, crit_log_nu_energy_lower, crit_log_nu_energy_upper)[source]#
Bases:
Flux
Spline flux spectrum.
Methods:
__init__
(norm, psp_table, ...)__call__
(E)Get dN/dE given E.
to_E2dNdE
(ns, acc_total[, E0, unit])Get E0^2 * dN/dE for particular reference energy and units.
to_dNdE
(ns, acc_total[, E0, unit])Get dN/dE for particular reference energy and units.
to_model_norm
(ns, acc_total)Get the model normalization resulting in ns, given the total acceptance.
to_ns
(flux, acc_total[, E0, unit, use_E2dNdE])Get number of signal events corresponding to a particular flux.
Attributes:
The photospline.SplineTable object that describes the neutrino flux as function of neutrino energy via B-spline interpolation.
The relative flux normalization.
The lower bound of the support of the spline interpolator
The upper bound of the support of the spline interpolator
Convert to str->value fit parameter kwargs.
Get the energy range containing nonzero flux, (Emin,Emax), in GeV.
- property psp_table#
The photospline.SplineTable object that describes the neutrino flux as function of neutrino energy via B-spline interpolation.
- property norm#
The relative flux normalization. norm=1 corresponds to the nominal model flux.
- property crit_log_nu_energy_lower#
The lower bound of the support of the spline interpolator
- property crit_log_nu_energy_upper#
The upper bound of the support of the spline interpolator
- abstract __call__(E)#
Get dN/dE given E.
- Parameters:
E (float) – energy in GeV
- Returns:
dN/dE in units 1/GeV/cm2/s
- Return type:
float
- abstract property as_params#
Convert to str->value fit parameter kwargs.
- abstract property energy_range#
Get the energy range containing nonzero flux, (Emin,Emax), in GeV.
- to_E2dNdE(ns, acc_total, E0=1, unit=1)#
Get E0^2 * dN/dE for particular reference energy and units.
Just like
Flux.to_dNdE()
, except multiplied by E0^2.
- to_dNdE(ns, acc_total, E0=1, unit=1)#
Get dN/dE for particular reference energy and units.
- Parameters:
ns (float) – number of signal events
acc_total (float) – total signal acceptance
E0 (float) – reference energy in units
unit
* GeVunit (float) – energy unit for
E0
as well as in denominator of return value
- Returns:
dN/dE in units 1/(
unit
* GeV)/cm2/s- Return type:
float
For example, to get dN/dE at 100 TeV in units 1/TeV/cm2/s, use
to_dNdE(ns, acc_total, E0=100, unit=1000)
.Todo
Check units of acc_total
- to_model_norm(ns, acc_total)#
Get the model normalization resulting in ns, given the total acceptance.
- Parameters:
ns (float) – number of signal events
acc_total (float) – total signal acceptance
- Returns:
model normalization
- Return type:
float
Todo
Check units of acc_total
This is just a semantically meaningful way of expressing
ns / acc_total
.
- to_ns(flux, acc_total, E0=1, unit=1, use_E2dNdE=True)#
Get number of signal events corresponding to a particular flux.
- Parameters:
flux (float) – dN/dE or E0^2 * dN/dE(see argument
E2dNdE
)acc_total (float) – total signal acceptance
E0 (float) – reference energy in units
unit
* GeVunit (float) – energy unit for
E0
as well as in denominator of return valueE2dNdE (bool) – if true(default),
flux
gives E0^2 * dN/dE. otherwise,flux
gives dN/dE.
- Returns:
number of signal events
- Return type:
float
Todo
Check units of acc_total
- class csky.hyp.SeyfertCoreCoronaFlux(psp_table, log_xray_lumin, src_dist, norm, lumin_scale=1.0, crit_log_energy_flux=-50, crit_log_nu_energy_lower=2.0, crit_log_nu_energy_upper=7.0)[source]#
Bases:
SplineFluxModel
Implements the Core-Corona Seyfert Galaxy neutrino flux model of A. Kheirandish et al., Astrophys.J. 922 (2021) 45 by means of B-spline interpolation.
Methods:
__init__
(psp_table, log_xray_lumin, ...[, ...])__call__
(E)The flux value dN/dE at energy E.
to_E2dNdE
(ns, acc_total[, E0, unit])Get E0^2 * dN/dE for particular reference energy and units.
to_dNdE
(ns, acc_total[, E0, unit])Get dN/dE for particular reference energy and units.
to_model_norm
(ns, acc_total)Get the model normalization resulting in ns, given the total acceptance.
to_ns
(flux, acc_total[, E0, unit, use_E2dNdE])Get number of signal events corresponding to a particular flux.
Attributes:
Get the energy range containing nonzero flux, (Emin,Emax), in GeV.
The log10 of the intrinsic source luminosity in 2-10keV x-ray band
correct normalization of model flux by relative factor
The distance to the source in units of Mpc
defines when the flux is considered to be 0
We have used hash of this representation in skyllh.core.source_hypothesis.get_fluxmodel_to_source_map() to map fluxes with KDE PDFs.
Convert to str->value fit parameter kwargs.
The lower bound of the support of the spline interpolator
The upper bound of the support of the spline interpolator
The relative flux normalization.
The photospline.SplineTable object that describes the neutrino flux as function of neutrino energy via B-spline interpolation.
- __init__(psp_table, log_xray_lumin, src_dist, norm, lumin_scale=1.0, crit_log_energy_flux=-50, crit_log_nu_energy_lower=2.0, crit_log_nu_energy_upper=7.0)[source]#
- property energy_range#
Get the energy range containing nonzero flux, (Emin,Emax), in GeV.
- property log_xray_lumin#
The log10 of the intrinsic source luminosity in 2-10keV x-ray band
- property lumin_scale#
correct normalization of model flux by relative factor
- property src_dist#
The distance to the source in units of Mpc
- property crit_log_energy_flux#
defines when the flux is considered to be 0
- property math_function_str#
We have used hash of this representation in skyllh.core.source_hypothesis.get_fluxmodel_to_source_map() to map fluxes with KDE PDFs. So far KDEs only depend on log_xray_lumin value and not on src_dist.
- __call__(E)[source]#
The flux value dN/dE at energy E. :param E: Evaluation energy [GeV] :type E: float | 1d numpy.ndarray of float
- Returns:
flux – Flux at energy E in units of GeV^-1 cm^-2 s^-1.
- Return type:
float | 1d ndarray of float
- property as_params#
Convert to str->value fit parameter kwargs.
- property crit_log_nu_energy_lower#
The lower bound of the support of the spline interpolator
- property crit_log_nu_energy_upper#
The upper bound of the support of the spline interpolator
- property norm#
The relative flux normalization. norm=1 corresponds to the nominal model flux.
- property psp_table#
The photospline.SplineTable object that describes the neutrino flux as function of neutrino energy via B-spline interpolation.
- to_E2dNdE(ns, acc_total, E0=1, unit=1)#
Get E0^2 * dN/dE for particular reference energy and units.
Just like
Flux.to_dNdE()
, except multiplied by E0^2.
- to_dNdE(ns, acc_total, E0=1, unit=1)#
Get dN/dE for particular reference energy and units.
- Parameters:
ns (float) – number of signal events
acc_total (float) – total signal acceptance
E0 (float) – reference energy in units
unit
* GeVunit (float) – energy unit for
E0
as well as in denominator of return value
- Returns:
dN/dE in units 1/(
unit
* GeV)/cm2/s- Return type:
float
For example, to get dN/dE at 100 TeV in units 1/TeV/cm2/s, use
to_dNdE(ns, acc_total, E0=100, unit=1000)
.Todo
Check units of acc_total
- to_model_norm(ns, acc_total)#
Get the model normalization resulting in ns, given the total acceptance.
- Parameters:
ns (float) – number of signal events
acc_total (float) – total signal acceptance
- Returns:
model normalization
- Return type:
float
Todo
Check units of acc_total
This is just a semantically meaningful way of expressing
ns / acc_total
.
- to_ns(flux, acc_total, E0=1, unit=1, use_E2dNdE=True)#
Get number of signal events corresponding to a particular flux.
- Parameters:
flux (float) – dN/dE or E0^2 * dN/dE(see argument
E2dNdE
)acc_total (float) – total signal acceptance
E0 (float) – reference energy in units
unit
* GeVunit (float) – energy unit for
E0
as well as in denominator of return valueE2dNdE (bool) – if true(default),
flux
gives E0^2 * dN/dE. otherwise,flux
gives dN/dE.
- Returns:
number of signal events
- Return type:
float
Todo
Check units of acc_total
- class csky.hyp.PowerLawFlux(gamma, norm=1, energy_range=(0, inf), energy_cutoff=inf)[source]#
Bases:
Flux
Power law spectrum.
Methods:
__init__
(gamma[, norm, energy_range, ...])__call__
(E)Get dN/dE given E.
to_E2dNdE
(ns, acc_total[, E0, unit])Get E0^2 * dN/dE for particular reference energy and units.
to_dNdE
(ns, acc_total[, E0, unit])Get dN/dE for particular reference energy and units.
to_model_norm
(ns, acc_total)Get the model normalization resulting in ns, given the total acceptance.
to_ns
(flux, acc_total[, E0, unit, use_E2dNdE])Get number of signal events corresponding to a particular flux.
Attributes:
Convert to str->value fit parameter kwargs.
Get the energy range containing nonzero flux, (Emin,Emax), in GeV.
- __init__(gamma, norm=1, energy_range=(0, inf), energy_cutoff=inf)[source]#
- Parameters:
gamma (float) – spectral index
norm (float) – normalization factor(at 1 GeV)
energy_range (tuple of (float, float)) – hard energy bounds(flux is zero elsewhere)
energy_cutoff (float) – exponential cutoff energy(in GeV)
- __call__(E)[source]#
Get dN/dE given E.
- Parameters:
E (float) – energy in GeV
- Returns:
dN/dE in units 1/GeV/cm2/s
- Return type:
float
- property as_params#
Convert to str->value fit parameter kwargs.
- property energy_range#
Get the energy range containing nonzero flux, (Emin,Emax), in GeV.
- to_E2dNdE(ns, acc_total, E0=1, unit=1)#
Get E0^2 * dN/dE for particular reference energy and units.
Just like
Flux.to_dNdE()
, except multiplied by E0^2.
- to_dNdE(ns, acc_total, E0=1, unit=1)#
Get dN/dE for particular reference energy and units.
- Parameters:
ns (float) – number of signal events
acc_total (float) – total signal acceptance
E0 (float) – reference energy in units
unit
* GeVunit (float) – energy unit for
E0
as well as in denominator of return value
- Returns:
dN/dE in units 1/(
unit
* GeV)/cm2/s- Return type:
float
For example, to get dN/dE at 100 TeV in units 1/TeV/cm2/s, use
to_dNdE(ns, acc_total, E0=100, unit=1000)
.Todo
Check units of acc_total
- to_model_norm(ns, acc_total)#
Get the model normalization resulting in ns, given the total acceptance.
- Parameters:
ns (float) – number of signal events
acc_total (float) – total signal acceptance
- Returns:
model normalization
- Return type:
float
Todo
Check units of acc_total
This is just a semantically meaningful way of expressing
ns / acc_total
.
- to_ns(flux, acc_total, E0=1, unit=1, use_E2dNdE=True)#
Get number of signal events corresponding to a particular flux.
- Parameters:
flux (float) – dN/dE or E0^2 * dN/dE(see argument
E2dNdE
)acc_total (float) – total signal acceptance
E0 (float) – reference energy in units
unit
* GeVunit (float) – energy unit for
E0
as well as in denominator of return valueE2dNdE (bool) – if true(default),
flux
gives E0^2 * dN/dE. otherwise,flux
gives dN/dE.
- Returns:
number of signal events
- Return type:
float
Todo
Check units of acc_total
- class csky.hyp.BinnedFlux(bins_energy, flux, max_energy_approx_gamma=1000000.0)[source]#
Bases:
Flux
Energy-binned spectrum.
Methods:
__init__
(bins_energy, flux[, ...])Construct a BinnedFlux.
to_E2dNdE
(ns, acc_total[, E0, unit])Get E0^2 * dN/dE for particular reference energy and units.
to_dNdE
(ns, acc_total[, E0, unit])Get dN/dE for particular reference energy and units.
to_model_norm
(ns, acc_total)Get the model normalization resulting in ns, given the total acceptance.
to_ns
(flux, acc_total[, E0, unit, use_E2dNdE])Get number of signal events corresponding to a particular flux.
__call__
(E)Get dN/dE given E.
Attributes:
Convert to str->value fit parameter kwargs.
Get the energy range containing nonzero flux, (Emin,Emax), in GeV.
- __init__(bins_energy, flux, max_energy_approx_gamma=1000000.0)[source]#
Construct a BinnedFlux.
- Parameters:
bins_energy (ndarray of float) – energy bin edges(up to or including Emax of highest energy bin)
flux (ndarray of float) – average dN/dE, in 1/GeV/cm2/s, for each energy bin
max_energy_approx_gamma (float) – maximum energy(in GeV) to consider when computing approximate average spectral index(used by :meth:BinnedFlux.as_params)
- to_E2dNdE(ns, acc_total, E0=1, unit=1)#
Get E0^2 * dN/dE for particular reference energy and units.
Just like
Flux.to_dNdE()
, except multiplied by E0^2.
- to_dNdE(ns, acc_total, E0=1, unit=1)#
Get dN/dE for particular reference energy and units.
- Parameters:
ns (float) – number of signal events
acc_total (float) – total signal acceptance
E0 (float) – reference energy in units
unit
* GeVunit (float) – energy unit for
E0
as well as in denominator of return value
- Returns:
dN/dE in units 1/(
unit
* GeV)/cm2/s- Return type:
float
For example, to get dN/dE at 100 TeV in units 1/TeV/cm2/s, use
to_dNdE(ns, acc_total, E0=100, unit=1000)
.Todo
Check units of acc_total
- to_model_norm(ns, acc_total)#
Get the model normalization resulting in ns, given the total acceptance.
- Parameters:
ns (float) – number of signal events
acc_total (float) – total signal acceptance
- Returns:
model normalization
- Return type:
float
Todo
Check units of acc_total
This is just a semantically meaningful way of expressing
ns / acc_total
.
- to_ns(flux, acc_total, E0=1, unit=1, use_E2dNdE=True)#
Get number of signal events corresponding to a particular flux.
- Parameters:
flux (float) – dN/dE or E0^2 * dN/dE(see argument
E2dNdE
)acc_total (float) – total signal acceptance
E0 (float) – reference energy in units
unit
* GeVunit (float) – energy unit for
E0
as well as in denominator of return valueE2dNdE (bool) – if true(default),
flux
gives E0^2 * dN/dE. otherwise,flux
gives dN/dE.
- Returns:
number of signal events
- Return type:
float
Todo
Check units of acc_total
- __call__(E)[source]#
Get dN/dE given E.
- Parameters:
E (float) – energy in GeV
- Returns:
dN/dE in units 1/GeV/cm2/s
- Return type:
float
- property as_params#
Convert to str->value fit parameter kwargs.
- property energy_range#
Get the energy range containing nonzero flux, (Emin,Emax), in GeV.