atcollab / at

Accelerator Toolbox
Apache License 2.0
48 stars 31 forks source link

Energy loss relative tolerance #596

Closed swhite2401 closed 1 year ago

swhite2401 commented 1 year ago

The function get_timelag_fromU0 for lattice with very large U0 and multiple RF harmonics. The reason is that for multiple harmonic a least square fit is use to compute the synchronous phase, the quantity to minimize is the difference between U0 and the accelerating voltage. However using the absolute difference, the tolerance was becoming too tight for very large U0. This value is now normalized to U0. In addition, the tolerance was reduced to 1.0e-9 and set as an optional argument.

A small modification to envelope_parameters() is also propose to prevent attribute errors when voltage<U0. The function now simply returns a NaN.