-
Notifications
You must be signed in to change notification settings - Fork 29
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
Handle diffusion element in radiation_off() #453
Conversation
The suffix "Element" is usually not part of the class name of Elements (ex.: "Dipole", "RFCavity'",...). So why not using "QuantumDiffusion" as class name ? |
It is also probably necessary to turn off |
Whatever we do, we have to modify |
Yes please do! You may allow rename the |
For the By the way I forgot to modify the |
The branch is now a major update: since it looked difficult for the
And 2 new properties:
The value of these properties depend of course on the longitudinal motion status. In the We also introduce 3 mixin classes: The The The Summary:To handle |
The
|
@swhite2401 : I cannot put you in reviewers since you initiated the PR… Can you have a look? |
@lfarv, this is indeed a major change and very difficult to review... I hope you have done all the proper testing... I have several comments:
I might have more comments later |
Hi again. I won't be available too much for the few next days, so I'll comment on a few points you mentioned, and we'll have some time to think about it:
I agree, the If you have a good idea, I take it! Similarly, |
Good idea. I'm not fan of numerous keywords, and as I wrote above, I would not like to add more than what is proposed here. So specialised functions are welcome. Concerning the function name, I don't consider that this PR introduces "new functionalities" in the function: it simply tries to deal with new elements modifying the particle momentum, and therefore inducing longitudinal motion. So we can prepare a list of new functions, starting with the most useful ones, additional ones may be added later. |
I don't think so. Here is why:
Finally, you may notice that for acting on a single class, like controlling collective effects, the new Anyway, this will wait for a few days before we make the final decision, and it's 2 lines to change when we decide… Maybe @MJGaughran and @lnadolski can give there opinion? |
The problem with grouping is that we lose the possibility to control things individually, for instance if you group quantum diffusion with your longitudinal kicker, how would you turn one on and not the other (using this function of course...). How about we define a dictionary, |
What I am saying is that now you control suddenly a lot more elements with this function, I gave an example in my earlier comment: the |
I would even issue a deprecation warning |
Concerning individual control, alternatively to the (possibly infinite) set of specialised functions, I have another proposal: a new method
As soon as there are several It could also be a single method This is simple, self-explanatory and accepts new element classes without modification. |
Ha ! My previous attempts to set warnings to push users to write better code always triggered a bunch of negative comments: "My code was working well and now I get warnings, please remove that"… So I'm very cautious. Here it's even not an incitation to improve the code: there is no benefit in changing the function to the new one, they are identical. It's only a good practice in new code to use the new meaningful name instead of the confusing old one. Anyway I'll implement the alias. |
I understand, but if you apply your script right now on a lattice with quantum diffusion and collective effects, they will also be turned on: they are on for ever. And you'll get random or wrong results. The new default does not change anything. On the other hand, with your proposal, a single OFF + ON sequence will kill your diffusion or collective effects, without notice. No perfect solution. Concerning the drawbacks of grouping, I agree with you, but the purpose of these methods is to globally kill and restore the longitudinal motion. Pushing to the extreme, for acting on a single element, you still need to take it individually. Important point also: most of these problems may be mitigated by using Let's wait for other opinions, we'll see I a few days. |
No perfect solution in fact...maybe someone comes up with better ideas |
Right, I take it back...but at some point we will have to remove useless function. Anyway deprecation warnings only makes if we increment versions |
Why would you only want to act on the 'standard' set, and not all classes 'involving synchrotron radiation'? If enabling radiative effects does nothing on higher-order multipoles, why do they have the 'Rad' string in the Pass Method? Happy for you to leave the code as-is, but better docs are always appreciated. |
The "StrMPoleSymplectic4Pass" method is used for all multipole orders, from quadrupole to infinite order. So it has to have a corresponding "Rad" method. As a consequence it has always been possible to turn on radiation on a dodecapole, let's say. I do not want to remove this possibility. However, in normal conditions, there is strictly no interest in doing that: you increase a lot the computing time and get no benefit. So the present To turn on everything (strongly discouraged), there is at the moment the I don't think there is any need to advertise the private |
152a299
to
c8d88bd
Compare
I think the code is fine. This just needs to be mentioned somewhere such as the Radiative class docstrings etc. |
Apparently there are very few occurrences of
Now take your time to test, it's finally a critical update! |
0216e7b
to
0b300a4
Compare
@swhite: is this now OK for you ? |
…oid confusion and remove it from the doc
b9f4ec4
to
7aadc88
Compare
As suggested in #451 a separated PR is created to introduce a
QuantDiffElement
and set its passmethod toIdentityPass
orQuantDiffPass
usingLattice.radiation_off/on()