bayspec.model.local package

Submodules

bayspec.model.local.additive module

Additive photon-spectrum components shipped with bayspec.

Each class implements a concrete analytic family (power-law, cutoff power-law, Band function, blackbody, synchrotron, etc.) and returns the photon flux density \(N(E, T)\) from func(). Most components expose a vfv_peak configuration flag that switches between peak-energy and break-energy parameterizations, and every component accepts an optional redshift configuration that blueshifts E by 1 + redshift before evaluation.

class bayspec.model.local.additive.pl[source]

Bases: Additive

Single power-law photon spectrum.

func(E, T=None, O=None)[source]

Return the power-law photon flux density \(A (E/E_0)^\alpha\).

class bayspec.model.local.additive.cpl[source]

Bases: Additive

Power law with an exponential high-energy cutoff (vfv_peak aware).

property params

Return the parameter dict chosen by the vfv_peak config flag.

func(E, T=None, O=None)[source]

Return the cutoff power-law \(A (E/E_0)^\alpha e^{-E/E_c}\).

class bayspec.model.local.additive.sbpl[source]

Bases: Additive

Smoothly broken power law (Kaneko et al. 2006, 10.1086/505911).

property params

Return the parameter dict chosen by the vfv_peak config flag.

func(E, T=None, O=None)[source]

Return the sbpl photon spectrum joining two power laws at Eb.

slope_func(E, T=None, O=None)[source]

Return the local spectral slope of the sbpl model at E.

class bayspec.model.local.additive.csbpl[source]

Bases: Additive

Smoothly broken power law with an added exponential cutoff.

property params

Return the parameter dict chosen by the vfv_peak config flag.

func(E, T=None, O=None)[source]

Return the sbpl photon spectrum with exponential cutoff.

class bayspec.model.local.additive.dsbpl[source]

Bases: Additive

Double smoothly broken power law (three segments, two smooth breaks).

func(E, T=None, O=None)[source]

Return the dsbpl photon spectrum, joining three power laws.

slope_func(E, T=None, O=None)[source]

Return the local spectral slope of the dsbpl model at E.

class bayspec.model.local.additive.tsbpl[source]

Bases: Additive

Triple smoothly broken power law (four segments, three smooth breaks).

func(E, T=None, O=None)[source]

Return the tsbpl photon spectrum, joining four power laws.

slope_func(E, T=None, O=None)[source]

Return the local spectral index of the tsbpl model at E.

class bayspec.model.local.additive.sb2pl[source]

Bases: Additive

Smoothly broken power law variant (Ravasio et al. 2018, 10.1051/0004-6361/201732245).

property params

Return the parameter dict chosen by the vfv_peak config flag.

func(E, T=None, O=None)[source]

Return the sb2pl photon spectrum (convex join of two power laws).

class bayspec.model.local.additive.csb2pl[source]

Bases: Additive

Convex 2-segment smoothly broken power law with an exponential cutoff.

property params

Return the parameter dict chosen by the vfv_peak config flag.

func(E, T=None, O=None)[source]

Return the csb2pl photon spectrum (convex sb2pl plus cutoff).

class bayspec.model.local.additive.sb3pl[source]

Bases: Additive

Convex 3-segment smoothly broken power law.

func(E, T=None, O=None)[source]

Return the sb3pl spectrum (convex join of three power laws).

class bayspec.model.local.additive.sb4pl[source]

Bases: Additive

Convex 4-segment smoothly broken power law.

func(E, T=None, O=None)[source]

Return the sb4pl photon spectrum (convex join of four power laws).

class bayspec.model.local.additive.band[source]

Bases: Additive

Band function (Band et al. 1993, 10.1086/172995).

func(E, T=None, O=None)[source]

Return the Band-function photon spectrum; piecewise below/above Ebreak.

class bayspec.model.local.additive.cband[source]

Bases: Additive

Band function augmented with an exponential high-energy cutoff.

func(E, T=None, O=None)[source]

Return the cband spectrum: Band function with exponential cutoff.

class bayspec.model.local.additive.dband[source]

Bases: Additive

Double Band function (two adjoining Band segments).

func(E, T=None, O=None)[source]

Return the dband spectrum with three piecewise Band-like segments.

class bayspec.model.local.additive.bb[source]

Bases: Additive

Single-temperature blackbody photon spectrum.

func(E, T=None, O=None)[source]

Return the single-temperature blackbody photon flux density.

class bayspec.model.local.additive.mbb[source]

Bases: Additive

Multi-color (multi-temperature) blackbody (Hou et al. 2018, 10.3847/1538-4357/aadc07).

func(E, T=None, O=None)[source]

Return the multi-colour blackbody via Gauss-Legendre quadrature.

class bayspec.model.local.additive.hlecpl[source]

Bases: Additive

High-latitude-emission curvature model for a cutoff power law (time-dependent).

func(E, T, O=None)[source]

Return the time-dependent HLE cutoff-power-law at (E, T).

class bayspec.model.local.additive.hleband[source]

Bases: Additive

High-latitude-emission curvature model for a Band function (time-dependent).

func(E, T, O=None)[source]

Return the time-dependent HLE Band-function at (E, T).

class bayspec.model.local.additive.zxhsync[source]

Bases: Additive

Time-dependent synchrotron model (ZXH provider, reads an external .o kernel).

func(E, T, O=None)[source]

Return the ZXH synchrotron spectrum via the external kernel.

property luminosity_distance

Luminosity distance in cm at the configured redshift (Planck18 cosmology).

elecspec(ielec_list=None)[source]

Generate the electron spectrum for each step ielec_list: list of steps return: list of electron spectra

lightcurve(response_list, time_list, tarr)[source]

Generate the model-predicted counts spectrum for each time response_list: list of response files time_list: list of times tarr: time array of the light curve return: list of model-predicted counts spectrum for each time

class bayspec.model.local.additive.katu[source]

Bases: Additive

External KATU provider invoked through a TOML-configured subprocess.

func(E, T, O=None)[source]

Return the KATU photon spectrum via the external binary.

set_cfg(key, value)[source]

Set a nested KATU TOML key a.b.c in mo_cfg to value.

bayspec.model.local.mathematic module

Dimensionless mathematical components, evaluated independently of energy.

class bayspec.model.local.mathematic.const[source]

Bases: Mathematic

Scalar constant with a single free parameter C.

func(E, T=None, O=None)[source]

Return the current value of C regardless of E, T, O.

Module contents

Local spectral components shipped with bayspec.

Re-exports every additive, multiplicative, and mathematical component defined in the submodules and tracks them in local_models for discoverability.

class bayspec.model.local.pl[source]

Bases: Additive

Single power-law photon spectrum.

func(E, T=None, O=None)[source]

Return the power-law photon flux density \(A (E/E_0)^\alpha\).

class bayspec.model.local.cpl[source]

Bases: Additive

Power law with an exponential high-energy cutoff (vfv_peak aware).

property params

Return the parameter dict chosen by the vfv_peak config flag.

func(E, T=None, O=None)[source]

Return the cutoff power-law \(A (E/E_0)^\alpha e^{-E/E_c}\).

class bayspec.model.local.sbpl[source]

Bases: Additive

Smoothly broken power law (Kaneko et al. 2006, 10.1086/505911).

property params

Return the parameter dict chosen by the vfv_peak config flag.

func(E, T=None, O=None)[source]

Return the sbpl photon spectrum joining two power laws at Eb.

slope_func(E, T=None, O=None)[source]

Return the local spectral slope of the sbpl model at E.

class bayspec.model.local.csbpl[source]

Bases: Additive

Smoothly broken power law with an added exponential cutoff.

property params

Return the parameter dict chosen by the vfv_peak config flag.

func(E, T=None, O=None)[source]

Return the sbpl photon spectrum with exponential cutoff.

class bayspec.model.local.dsbpl[source]

Bases: Additive

Double smoothly broken power law (three segments, two smooth breaks).

func(E, T=None, O=None)[source]

Return the dsbpl photon spectrum, joining three power laws.

slope_func(E, T=None, O=None)[source]

Return the local spectral slope of the dsbpl model at E.

class bayspec.model.local.tsbpl[source]

Bases: Additive

Triple smoothly broken power law (four segments, three smooth breaks).

func(E, T=None, O=None)[source]

Return the tsbpl photon spectrum, joining four power laws.

slope_func(E, T=None, O=None)[source]

Return the local spectral index of the tsbpl model at E.

class bayspec.model.local.sb2pl[source]

Bases: Additive

Smoothly broken power law variant (Ravasio et al. 2018, 10.1051/0004-6361/201732245).

property params

Return the parameter dict chosen by the vfv_peak config flag.

func(E, T=None, O=None)[source]

Return the sb2pl photon spectrum (convex join of two power laws).

class bayspec.model.local.csb2pl[source]

Bases: Additive

Convex 2-segment smoothly broken power law with an exponential cutoff.

property params

Return the parameter dict chosen by the vfv_peak config flag.

func(E, T=None, O=None)[source]

Return the csb2pl photon spectrum (convex sb2pl plus cutoff).

class bayspec.model.local.sb3pl[source]

Bases: Additive

Convex 3-segment smoothly broken power law.

func(E, T=None, O=None)[source]

Return the sb3pl spectrum (convex join of three power laws).

class bayspec.model.local.sb4pl[source]

Bases: Additive

Convex 4-segment smoothly broken power law.

func(E, T=None, O=None)[source]

Return the sb4pl photon spectrum (convex join of four power laws).

class bayspec.model.local.band[source]

Bases: Additive

Band function (Band et al. 1993, 10.1086/172995).

func(E, T=None, O=None)[source]

Return the Band-function photon spectrum; piecewise below/above Ebreak.

class bayspec.model.local.cband[source]

Bases: Additive

Band function augmented with an exponential high-energy cutoff.

func(E, T=None, O=None)[source]

Return the cband spectrum: Band function with exponential cutoff.

class bayspec.model.local.dband[source]

Bases: Additive

Double Band function (two adjoining Band segments).

func(E, T=None, O=None)[source]

Return the dband spectrum with three piecewise Band-like segments.

class bayspec.model.local.bb[source]

Bases: Additive

Single-temperature blackbody photon spectrum.

func(E, T=None, O=None)[source]

Return the single-temperature blackbody photon flux density.

class bayspec.model.local.mbb[source]

Bases: Additive

Multi-color (multi-temperature) blackbody (Hou et al. 2018, 10.3847/1538-4357/aadc07).

func(E, T=None, O=None)[source]

Return the multi-colour blackbody via Gauss-Legendre quadrature.

class bayspec.model.local.hlecpl[source]

Bases: Additive

High-latitude-emission curvature model for a cutoff power law (time-dependent).

func(E, T, O=None)[source]

Return the time-dependent HLE cutoff-power-law at (E, T).

class bayspec.model.local.hleband[source]

Bases: Additive

High-latitude-emission curvature model for a Band function (time-dependent).

func(E, T, O=None)[source]

Return the time-dependent HLE Band-function at (E, T).

class bayspec.model.local.zxhsync[source]

Bases: Additive

Time-dependent synchrotron model (ZXH provider, reads an external .o kernel).

func(E, T, O=None)[source]

Return the ZXH synchrotron spectrum via the external kernel.

property luminosity_distance

Luminosity distance in cm at the configured redshift (Planck18 cosmology).

elecspec(ielec_list=None)[source]

Generate the electron spectrum for each step ielec_list: list of steps return: list of electron spectra

lightcurve(response_list, time_list, tarr)[source]

Generate the model-predicted counts spectrum for each time response_list: list of response files time_list: list of times tarr: time array of the light curve return: list of model-predicted counts spectrum for each time

class bayspec.model.local.katu[source]

Bases: Additive

External KATU provider invoked through a TOML-configured subprocess.

func(E, T, O=None)[source]

Return the KATU photon spectrum via the external binary.

set_cfg(key, value)[source]

Set a nested KATU TOML key a.b.c in mo_cfg to value.

class bayspec.model.local.const[source]

Bases: Mathematic

Scalar constant with a single free parameter C.

func(E, T=None, O=None)[source]

Return the current value of C regardless of E, T, O.

class bayspec.model.local.hecut[source]

Bases: Multiplicative

High-energy exponential cutoff above a configurable threshold energy.

func(E, T=None, O=None)[source]

Return 1 below threshold_energy and exp((ethr - E) / Ec) above.

class bayspec.model.local.wabs[source]

Bases: Multiplicative

Wisconsin ISM photoelectric absorption (angr abundances).

func(E, T=None, O=None)[source]

Return \(\exp(-N_H \, \sigma(E))\) using the tabulated cross section.

class bayspec.model.local.phabs[source]

Bases: Multiplicative

Photoelectric absorption using the aspl abundance table.

func(E, T=None, O=None)[source]

Return \(\exp(-N_H \, \sigma(E))\) using the tabulated cross section.

class bayspec.model.local.tbabs[source]

Bases: Multiplicative

Tuebingen-Boulder ISM absorption using the wilm abundance table.

func(E, T=None, O=None)[source]

Return \(\exp(-N_H \, \sigma(E))\) using the tabulated cross section.

class bayspec.model.local.tinvabs[source]

Bases: Multiplicative

Exponentially-decaying absorption column \(N_H(T) = N_{H,0} e^{-T/\tau}\).

Delegates the energy-dependent absorption to an inner tbabs while updating its \(N_H\) per unique T value.

func(E, T, O=None)[source]

Absorb E by a column that decays with T.

Parameters:
  • E – Energies in keV.

  • T – Times; E and T must match in scalar-ness and shape.

  • O – Unused.

Returns:

Per-sample attenuation factor.

Raises:

ValueError – If E and T shapes disagree.

bayspec.model.local.list_local_models()[source]

Return the names of every registered local model class.