def calc_brho(energy): electron_rest_energy_GeV = units.joule_2_eV(consts.electron_rest_energy) / 1e9 gamma = energy/electron_rest_energy_GeV beta = math.sqrt(((gamma-1.0)/gamma)*((gamma+1.0)/gamma)) velocity = consts.light_speed * beta brho = beta * (energy * 1e9) / consts.light_speed return brho, velocity, beta, gamma
def calc_brho(energy): electron_rest_energy_GeV = units.joule_2_eV( consts.electron_rest_energy) / 1e9 gamma = energy / electron_rest_energy_GeV beta = math.sqrt(((gamma - 1.0) / gamma) * ((gamma + 1.0) / gamma)) velocity = consts.light_speed * beta brho = beta * (energy * 1e9) / consts.light_speed return brho, velocity, beta, gamma
def gamma(energy): '''Gamma from energy[GeV].''' return energy * 1.0e9 / units.joule_2_eV(const.electron_rest_energy)
def critical_energy(gamma, rho): '''Critical energy [keV] from ebeam gamma factor and bending radius [m].''' return (3 * units.joule_2_eV(const.reduced_planck_constant) * const.light_speed * math.pow(gamma, 3)/ (2.0 * rho)) / 1000
def id_mean_power(energy, current, period, nr_periods, k): '''insertion device mean power from beam energy [GeV], current [mA], ID period [mm], ID nr periods and k see Handbook of Acc. Physics, eq.(14), pg 189''' cst = math.pi * 1e9 * const.rad_cgamma * (units.joule_2_eV(const.electron_rest_energy)/1.0e9)**2 return (cst * energy * k**2 * nr_periods / (period/1000.0))/1000.0
def id_deflection_parameter(field, period): '''insertion device deflection parameter from field [T] and period [mm]''' return 1e-9 * period * field * const.light_speed / (units.joule_2_eV(const.electron_rest_energy)/1.0e6) / (2*math.pi)