ThorstenHellert / SC

6 stars 4 forks source link

Length calculation of a support structure across injection point in SCgetSupportRoll.m #36

Open yhidaka opened 8 months ago

yhidaka commented 8 months ago

Hi Thorsten,

I am an accelerator physicist at NSLS-II, currently looking into implementing a similar code as SC with Python and ELEGANT.

I could be wrong, but while trying to understand the flow of support structure roll calculations in SCgetSupportRoll.m, I noticed that the length of a support structure used to compute pitch and yaw might be wrong, if diff(ords)<0 (i.e., the case when the structure starts near the end of a ring, comes around to the beginning of the ring, and ends near the beginning of the ring).

In Lines 79, 80, 82, and 83, I suppose (C-s0(ords(1))-s0(ords(2))) corresponds to the length of the structure. But I think this should be (C-s0(ords(1))+s0(ords(2))) instead (the second minus sign is changed to a plus). Am I wrong?

ThorstenHellert commented 8 months ago

Yes that is correct. I have already updated my code (I refactored the function significantly) but I haven’t pushed it because I didn’t had time to thoroughly test it. I’m sorry for the time you wasted on this!

Regarding implementing a "similar code as SC with Python and ELEGANT”: maybe you want to take a look at

Lukas Malina's this year’s ICALEPCS contribution "Python Library for Simulated Commissioning of Storage-Ring Accelerators” (FR2AO05) or https://github.com/lmalina/pySC/tree/master.

Cheers!

On Nov 2, 2023, at 14:28, yhidaka @.***> wrote:

Hi Thorsten,

I am an accelerator physicist at NSLS-II, currently looking into implementing a similar code as SC with Python and ELEGANT.

I could be wrong, but while trying to understand the flow of support structure roll calculations in SCgetSupportRoll.m, I noticed that the length of a support structure used to compute pitch and yaw might be wrong, if diff(ords)<0 (i.e., the case when the structure starts near the end of a ring, comes around to the beginning of the ring, and ends near the beginning of the ring).

In Lines 79, 80, 82, and 83, I suppose (C-s0(ords(1))-s0(ords(2))) corresponds to the length of the structure. But I think this should be (C-s0(ords(1))+s0(ords(2))) instead (the second minus sign is changed to a plus). Am I wrong?

— Reply to this email directly, view it on GitHub https://github.com/ThorstenHellert/SC/issues/36, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEHUUFWQUNYWW6LMHGU3OMTYCQF6BAVCNFSM6AAAAAA63RBQNCVHI2DSMVQWIX3LMV43ASLTON2WKOZRHE3TKMBWGMYDANI. You are receiving this because you are subscribed to this thread.

yhidaka commented 8 months ago

Thank you very much for your prompt reply!

Also, thanks for the pointer to pySC. I'll certainly take a look.