PhysicsTools
Documentation for PhysicsTools.
PhysicsTools.Utils.CategoricalSetDistribution
PhysicsTools.Utils.apply_rot
PhysicsTools.Utils.cart_to_sph
PhysicsTools.Utils.fast_linear_interp
PhysicsTools.Utils.fast_linear_interp
PhysicsTools.Utils.fwhm
PhysicsTools.Utils.rand_gamma
PhysicsTools.Utils.repeat_for
PhysicsTools.Utils.sample_cherenkov_track_direction
PhysicsTools.Utils.sph_to_cart
PhysicsTools.Utils.split_by
PhysicsTools.Utils.split_by!
PhysicsTools.Utils.CategoricalSetDistribution
— TypeCategoricalSetDistribution{T, U<:Real}
Represents a Categorical distribution on a set
Examples
p = CategoricalSetDistribution(Set([:EMinus, :EPlus]), Categorical([0.1, 0.9])) rand(p)
– returns:EMinus
with 10% probability and:Eplus
with 90% probabilityp = CategoricalSetDistribution(Set([:EMinus, :EPlus]), [0.1, 0.9])
– convenience constructor
PhysicsTools.Utils.apply_rot
— Methodapply_rot(a, b, operand)
Calculates rotation matrix obtained by rotating a to b. Apply to operand. Apply the resulting rotation to operand.
PhysicsTools.Utils.cart_to_sph
— Methodcart_to_sph(x::Real, y::Real, z::Real)
Convert cartesian to spherical coordinates. Assumes x, y, z represent a unit vector. Uses ISO convetion (inclination, azimuth).
PhysicsTools.Utils.fast_linear_interp
— Methodfast_linear_interp(x_eval::Number, xs::AbstractVector, ys::AbstractVector)
Linearly interpolate xs -> ys and evaluate x_eval on interpolation. Assume xs are sorted in ascending order.
PhysicsTools.Utils.fast_linear_interp
— Methodfast_linear_interp(x_eval::Number, knots::AbstractVector, lower::Number, upper::Number)
Linearly interpolate knots and evaluate x_eval on interpolation. Assume knots are equidistant in (lower, upper).
PhysicsTools.Utils.fwhm
— Methodfwhm(d::UnivariateDistribution, xmode::Real; xlims=(-20, 20))
Calculate FWHM of a univariate distribution
PhysicsTools.Utils.rand_gamma
— Methodrand_gamma(shape, scale)
Sample gamma variates when shape > 1
PhysicsTools.Utils.repeat_for
— Methodrepeat_for(x::AbstractMatrix, n::AbstractVector)
Repeat each slice along the second dimension of x for n times
PhysicsTools.Utils.sample_cherenkov_track_direction
— MethodPhysicsTools.Utils.sph_to_cart
— Methodsph_to_cart(theta::Real, phi::Real)
Convert spherical to cartesian coordinates.
Uses ISO convention (inclination, azimuth).
PhysicsTools.Utils.split_by!
— Methodsplit_by!(x::AbstractVector, n::AbstractVector, out)
Write output into out
PhysicsTools.Utils.split_by
— Methodsplit_by(x::AbstractVector, n::AbstractVector)
Split vector x into parts, where the split indices are given by vector n.