atcollab / at

Accelerator Toolbox
Apache License 2.0
48 stars 31 forks source link

Scattering rate #624

Closed swhite2401 closed 1 year ago

swhite2401 commented 1 year ago

This implements the request of #622. A new function is added to derive the scattering rate. The interface is identical to the one of the lifetime calculation.

swhite2401 commented 1 year ago

@bdalena I have used your formula, could you please check that everything is fine on your side? You can call the new function as follows:

scatter, *_ = ring.get_scattering_rate(emity=emity, bunch_curr=bunch_curr, refpts=refpts)

swhite2401 commented 1 year ago

@lfarv , @oscarxblanco , could you please take a look at this on e for approval when you have time?

I have been asked by @bdalena to add the calculation of scattering rate, it makes use of the same algorithm as the lifetime with minor variations, so this is for the most part reshuffling code and introducing a new function to output the requested quantities.

I have checked the lifetime part and results are identical.

oscarxblanco commented 1 year ago

@swhite2401 yes, I will do a test that will be provided by @bdalena and Mihail Miceski. After that I could review.

o

oscarxblanco commented 1 year ago

@swhite2401 Using the input from @bdalena and Mihail Miceski I checked that the function returns w/o issues. Based on their test I created another test which calculates the scattering rate without the momentum aperture input using the current SOLEIL lattice, and it also returns w/o issues. I launch another test using the flag use_mp from the get_scattering_rate function call and confirm it used the available cores through htop.

In addition, I compared the rate equations with the piwinski article and they are written almost in the same way. I was not able to follow the construction of B1 and B2, I would trust @bdalena's and Mihail Miceski's cross check.

I add a folder with the scripts used for these tests, except the SOLEIL II lattice that I won't provide.

I think this branch could be safely merged.

test_scattering_rate.zip

swhite2401 commented 1 year ago

Ok great thanks a lot, I merge then!