API

NuFlux.FluxBinInfoType
FluxBinInfo

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.
source
NuFlux.FluxBinInfoMethod
FluxBinInfo(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.
source
NuFlux.FluxTableType
FluxTable

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).
source
NuFlux._getbinindexMethod
_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 containing x.
source
NuFlux._getbinmidsMethod
_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.
source
NuFlux._makerangeMethod
_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.
source
NuFlux.fluxMethod
flux(f, energy)

Arguments

  • flux: Flux data
  • energy: Energy in GeV
  • interpol: Interpolate the data

Returns

  • Float64: The flux value at the given energy.
source
NuFlux.fluxMethod
flux(f, energy, cosθ)

Arguments

  • flux: Flux data
  • energy: Energy in GeV
  • cosθ: Cosine of the zenith angle
  • interpol: Interpolate the data

Returns

  • Float64: The flux value at the given energy and zenith angle.
source
NuFlux.fluxMethod
flux(f, energy, cosθ, ϕ)

Arguments

  • flux: Flux data
  • energy: Energy in GeV
  • cosθ: Cosine of the zenith angle
  • ϕ: Azimuth angle
  • interpol: Interpolate the data

Returns

  • Float64: The flux value at the given energy, zenith angle, and azimuth angle.
source
NuFlux.parsefluxbininfoMethod
parsefluxbininfo(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.
source
NuFlux.readfluxfileMethod
readfluxfile(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 of FluxTable instances representing the flux data indexed by PDG ID.
source
NuFlux.readfluxfileMethod
readfluxfile(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 of FluxTable instances representing the flux data.
source