API
NuFlux.Flux
NuFlux.FluxBinInfo
NuFlux.FluxBinInfo
NuFlux.FluxTable
NuFlux._getbinindex
NuFlux._getbinmids
NuFlux._makerange
NuFlux.flux
NuFlux.flux
NuFlux.flux
NuFlux.parsefluxbininfo
NuFlux.readfluxfile
NuFlux.readfluxfile
NuFlux.Flux
— TypeAbstract type representing a neutrino flux model.
NuFlux.FluxBinInfo
— TypeFluxBinInfo
A struct representing bin information for a flux table.
Fields
CosZenithBin::Tuple{Rational, Rational}
: Tuple of (min, max) cosine of the zenith angle for the bin.AzimutBin::Tuple{Rational, Rational}
: Tuple of (min, max) azimuth angle for the bin.
NuFlux.FluxBinInfo
— MethodFluxBinInfo(cosZmin, cosZmax, azimutmin, azimutmax)
Construct a FluxBinInfo
instance from the given bin edges.
Arguments
cosZmin
: Minimum cosine of the zenith angle.cosZmax
: Maximum cosine of the zenith angle.azimutmin
: Minimum azimuth angle.azimutmax
: Maximum azimuth angle.
NuFlux.FluxTable
— TypeFluxTable
A struct representing a tabulated neutrino flux model.
Fields
coszentihbinedges::Vector{Float64}
: Bin edges for the cosine of the zenith angle.azimuthbinedges::Vector{Float64}
: Bin edges for the azimuth angle.energies::Vector{Float64}
: Energy values in GeV.particle::Particle
: The particle type (e.g., neutrino or antineutrino).flux::Array{Float64, 3}
: A 3D array of flux values, indexed by (cosθ, ϕ, energy).
NuFlux._getbinindex
— Method_getbinindex(binedges, x)
Find the index of the bin that contains the value x
.
Arguments
binedges
: A vector of bin edges.x
: The value to find the bin for.
Returns
Int
: The index of the bin containingx
.
NuFlux._getbinmids
— Method_getbinmids(binedges)
Calculate the midpoints of bins given their edges.
Arguments
binedges
: A vector of bin edges.
Returns
Vector{Float64}
: A vector of bin midpoints.
NuFlux._makerange
— Method_makerange(x)
Create a range from a vector of values, ensuring constant spacing.
Arguments
x
: A vector of values.
Returns
StepRangeLen
: A range with constant spacing.
Throws
ErrorException
: If the spacing between values is not constant.
NuFlux.flux
— Methodflux(f, energy)
Arguments
flux
: Flux dataenergy
: Energy in GeVinterpol
: Interpolate the data
Returns
Float64
: The flux value at the given energy.
NuFlux.flux
— Methodflux(f, energy, cosθ)
Arguments
flux
: Flux dataenergy
: Energy in GeVcosθ
: Cosine of the zenith angleinterpol
: Interpolate the data
Returns
Float64
: The flux value at the given energy and zenith angle.
NuFlux.flux
— Methodflux(f, energy, cosθ, ϕ)
Arguments
flux
: Flux dataenergy
: Energy in GeVcosθ
: Cosine of the zenith angleϕ
: Azimuth angleinterpol
: Interpolate the data
Returns
Float64
: The flux value at the given energy, zenith angle, and azimuth angle.
NuFlux.parsefluxbininfo
— Methodparsefluxbininfo(line)
Parse a line of text into a FluxBinInfo
instance.
Arguments
line
: A string containing bin edge information.
Returns
FluxBinInfo
: A struct containing the parsed bin edges.
NuFlux.readfluxfile
— Methodreadfluxfile(io)
Read a flux file and construct a vector of FluxTable
instances.
Arguments
io
: An IO stream or file path to the flux data.
Returns
Dict{FluxTable}
: A dictionary ofFluxTable
instances representing the flux data indexed by PDG ID.
NuFlux.readfluxfile
— Methodreadfluxfile(filepath::String)
Read a flux file from a file path and construct a vector of FluxTable
instances.
Arguments
filepath
: Path to the flux data file.
Returns
Vector{FluxTable}
: A vector ofFluxTable
instances representing the flux data.