A package of utility routines for the simulation of high energy accelerators and storage rings.
AcceleratorSimUtils is part of the SciBmad project.
calc_E_kinetic(...)- Calculate kinetic energy.calc_γ(...)- Calculate relativistic gamma factor.calc_E_tot(...)- Calculate total energy.calc_pc(...)- Calculate momentum * c.calc_β(...)- Calculate velocity/c.calc_1β(...)- Calculate1 - β.calc_changed_energy(...)- Calculate the new energy and momentum given initial momentum and energy change.
modulo2(x, amp)- Calculatex + 2 * n * ampwhere the output is in the range[-amp, amp).one_cos(x)- Calculate1 - cos(x)to machine precision forxnear zero.sqrt_one(x)- Calculatesqrt(1+x) - 1to machine precision.un_sinc(x, n)- Calculatenth derivative ofsin(x)/xto machine precision.un_cosc(x, n)- Calculatenth derivative of(1 - cos(x)) / x^2to machine precision.
gen_pinknoise(beta, size, dt, f0)- Random number generator that has a "pink noise spectrum.