-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Matching paired quadrupoles #270
Comments
Hi Alberto,
I think the easiest way would be to implement such things as a constraint, this could be done quickly but is not very effective, since you would have an extra dimension in the optimization problem that is not needed.
What you describe is what is done in mad-x, where you would say something like Q1.k1 := k, Q2.k1 := -k; vary, k in matching etc.
But how to best do it in python without creating ugly syntax, that one should look into, I’ll see if I can come up with something…Or maybe someone else can do it faster.
Ilya
… On Jan 17, 2025, at 09:36, Alberto de la Ossa ***@***.***> wrote:
Hello!
Ocelot's match function is working well for me to find the quadrupoles strengths to match the Twiss parameters of the beam at a certain element location. 👍
In my script, match is varying the strength of 4 quadrupoles to find the optimum.
Let's call these quadrupoles Q1, Q2, Q3 and Q4.
My question: is it possible to use match in a way that the strengths are paired, e.g. Q1.k1 = Q2.k1 and Q3.k1 = -Q4.k1?
A trick that seems to work is to make, for example, Q2 = Q1, and remove Q2 from the list of varying elements.
However, this does not work like this for the case where Q3.k1 = -Q4.k1, because Q4 = - Q3 is not allowed.
Any ideas?
Cheers.
—
Reply to this email directly, view it on GitHub <#270>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABVBP2PMXJTKNT4AJCUVXBT2LC6ILAVCNFSM6AAAAABVLMWL6GVHI2DSMVQWIX3LMV43ASLTON2WKOZSG44TIOBXHEZTAMA>.
You are receiving this because you are subscribed to this thread.
|
Hello Ilya, Line 122 in 0d19cf5
One just needs to add the coupled quads as a tuple to the list of varying parameters for match .However, the way is implemented does not allow for "anti coupling", i.e. quads of opposite strengths. I think that a similar and more general approach would be to pass a dictionary with the quads as keys and the coupling parameters as values, e.g.: vars = [{Q1: 1, Q2: 1}, {Q3: 1, Q4: -1}] I have just given it a try in this PR #275 and it seems to work well. |
Hello!
Ocelot's
match
function is working well for me to find the quadrupole's strengths to match the Twiss parameters of the beam at a certain element location. 👍In my script,
match
is varying the strength of 4 quadrupoles to find the optimum.Let's call these quadrupoles
Q1
,Q2
,Q3
andQ4
.My question: is it possible to use
match
in a way that the strengths are paired, e.g.Q1.k1 = Q2.k1
andQ3.k1 = -Q4.k1
?A trick that seems to work is to make, for example,
Q2 = Q1
, and remove Q2 from the list of varying elements.However, this does not work like this for the case where
Q3.k1 = -Q4.k1
, becauseQ4 = - Q3
is not allowed.Any ideas?
Cheers.
The text was updated successfully, but these errors were encountered: