-
Notifications
You must be signed in to change notification settings - Fork 42
Improve Wiggler energy handling to fix #894 #960
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
Changes from all commits
ef2ca21
a9f5819
d12902c
79fd8ae
c5fd65f
2cbcf80
c28c514
4bdf6ef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,7 +43,7 @@ def test_exact_hamiltonian_pass_with_dls_dipole(rin, func): | |
| ('GWigSymplecticPass', 'GWigSymplecticRadPass')) | ||
| def test_gwig_symplectic_pass(rin, passmethod, func): | ||
| # Parameters copied from one of the Diamond wigglers. | ||
| wiggler = elements.Wiggler('w', 1.15, 0.05, 0.8, 3e9) | ||
| wiggler = elements.Wiggler('w', 1.15, 0.05, 0.8) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't you get an error if there energy is not defined?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The The only difference is that now a warning is issued while before the energy was silently ignored. This is the reason of the modification of the tests: avoiding this new warning. I don't like too much modifying the tests : it reveals a change of behaviour, and old lattice definitions may now suddenly throw warnings. On the other hand, this warning makes sense, silently ignoring entries is confusing. My preference is to keep this new warning, but if it looks really disturbing, it could be removed…
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wait, now I am lost... so if I understand well This is a rather significant change of behavior in my opinion that is not reflected in either the warning (that should say please use the keyword argument I do not think that this is backward compatible as script using the positional argument
was handling all case. For me there is now 2 options: I would very much prefer the first option that is simpler and cleaner but it break the rule of maintaining backward compatibility for minor releases... so I would strongly advocate for 2 until the next major release
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
No, an So there is no difference with your solution: an ignored
No, it's compatible, there will be no change in the results: the 3rd positional argument, or any This is slightly different in Matlab: in old lattices without
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah sorry, I did not look all the way down to However, I see in the passmethod that 'Energy' is interpreted, so it can be used in case the lattice energy=0.0. Is it possible that this happens if the lattice is defined as a list (allowed in pyAT)?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
all that in a single line, identical in all integrators except
If an error should be thrown for energy==0.0,, it could be added in this python definition of For lattices as "lists", the energy can be provided with an
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok I still think this is really not clean and for someone not familiar with AT it is basically impossible to understand the behavior... I guess this is the kind of things we have to live with to maintain backward/matlab compatibility so fine for the moment. |
||
| wiggler.PassMethod = passmethod | ||
| func(wiggler, rin) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use black to format the code in AT, maybe this is why this line break was there in the first place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it was previously over black's 88 line length limit and was therefore split, but now we are no longer checking wigglers it is only 86 and so can go on one line