Skip to content
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

Equilibrium emittance in presence of SR and IBS #157

Draft
wants to merge 146 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
9d60d14
Add function to compute the equilibrium emittance in presence of SR a…
Jan 3, 2025
3d49542
Fix small bug with 'excitation' constraint.
Jan 3, 2025
5aed27d
Add tests.
Jan 3, 2025
e76d4a2
Additional fixes and simplifications.
Jan 9, 2025
60584cc
Proper initialization of the emittances when forcing an emittance cou…
Jan 10, 2025
a104d83
Remove 'natural_emittances' from 'ibs_rates' to avoid potential confu…
Jan 13, 2025
2e706f0
Remove last 'natural_emittances' traces
Jan 13, 2025
9a5d910
imports shuffle, xo class for derivatives to simplify passing data ar…
fsoubelet Jan 13, 2025
98eed04
rename function to explicit name and make private
fsoubelet Jan 13, 2025
e6468ce
return as classes and beware of order in call line
fsoubelet Jan 13, 2025
717f6ac
unpack as tuple, specify comment
fsoubelet Jan 13, 2025
896060d
rename to emittance_derivatives
fsoubelet Jan 13, 2025
87caa65
commented out code to return a Table for the user's enjoyment
fsoubelet Jan 13, 2025
e1fd86a
do not export private function
fsoubelet Jan 13, 2025
4b3deaf
rename params that are not used in private function anymore - emittan…
fsoubelet Jan 13, 2025
25b2c64
explicitely name attributions
fsoubelet Jan 13, 2025
6b4357d
docstring rework and TODOs
fsoubelet Jan 13, 2025
59c9a00
input_sigma_zeta and input_sigma_delta are not in this function, remo…
fsoubelet Jan 13, 2025
53d3511
replace call of intermediate badly named natural_emittance_[xyz] to d…
fsoubelet Jan 13, 2025
692b664
also remove attribution to vars, could add later a check for presence…
fsoubelet Jan 13, 2025
57270e4
remove damping rates from parameters and take it directly from the Tw…
fsoubelet Jan 13, 2025
2e46884
and rework the return statement in docstring
fsoubelet Jan 13, 2025
8c20bfc
commented out potential check for presence of expected attributes in …
fsoubelet Jan 13, 2025
7363448
asserts and checks as high as possible
fsoubelet Jan 13, 2025
25f5b99
comments to walk through the function, pretty clean already
fsoubelet Jan 13, 2025
eb8c687
one last todo
fsoubelet Jan 13, 2025
d858ab0
Merge pull request #1 from SebastienJoly/cosmetics
SebastienJoly Jan 14, 2025
da11a19
bunch_intensity -> total_beam_intensity to mimic the rest of the APIs
fsoubelet Jan 14, 2025
02124e5
pass kwargs to IBS growth rates method, document in docstring
fsoubelet Jan 14, 2025
4d66bb8
remove bunched=True as it is default, and with kwargs passing the use…
fsoubelet Jan 14, 2025
ff81624
no default for formalism, place it as second arg to mimic API pf IBS …
fsoubelet Jan 14, 2025
d94f1a9
add formalism to main function as the user NEEDS to be able to choose…
fsoubelet Jan 14, 2025
f4fa9db
some walkthrough
fsoubelet Jan 14, 2025
447a104
reworking of the docstring, part1
fsoubelet Jan 14, 2025
3e44bf5
reworking of the docstring, part2
fsoubelet Jan 14, 2025
6f89e98
natural emittances is not a param anymore, remove from docstring
fsoubelet Jan 14, 2025
7a48a4c
clarify rtol
fsoubelet Jan 14, 2025
369f660
clear up call to _ibs_rates_and_emittance_derivatives which was using…
fsoubelet Jan 14, 2025
d5b3650
propagate kwargs to inner function
fsoubelet Jan 14, 2025
f514a23
rework the whole emittance constraint thing in docstring, should be c…
fsoubelet Jan 14, 2025
7dcbfe6
commented out code for Table return, and global quantities included
fsoubelet Jan 14, 2025
d73c041
commented out docstring for when we return a table
fsoubelet Jan 14, 2025
6effcb5
use new parameter names in warning
fsoubelet Jan 14, 2025
69c577a
some harmless renaming
fsoubelet Jan 14, 2025
e8f6948
some todo
fsoubelet Jan 14, 2025
b876bb1
put back this piece of docstring
fsoubelet Jan 14, 2025
cbde1b3
fix my mess of overriding names
fsoubelet Jan 14, 2025
7234e33
small correction to emittance_coupling_factor
fsoubelet Jan 14, 2025
6ae0a8f
typos
fsoubelet Jan 14, 2025
42a1b94
verbose flag and xobjects print
fsoubelet Jan 15, 2025
2619c33
todo for emittance constraint checks
fsoubelet Jan 15, 2025
b7d9270
review changes for emittance constraint
fsoubelet Jan 15, 2025
34f953c
only transverse constraints enforced in loop
fsoubelet Jan 15, 2025
77f4008
correct info on default value
fsoubelet Jan 15, 2025
51749da
typo
fsoubelet Jan 15, 2025
39f9504
add todo for api changes
fsoubelet Jan 15, 2025
5d77c42
should be elif
fsoubelet Jan 15, 2025
079e5f7
Merge pull request #2 from SebastienJoly/api_changes
SebastienJoly Jan 15, 2025
db29a81
file rename
fsoubelet Jan 15, 2025
3754409
Merge pull request #3 from SebastienJoly/rename
fsoubelet Jan 15, 2025
21b85a0
return a Table, add return docstring and build
fsoubelet Jan 15, 2025
d43cf4b
do not change names from the TwissTable, be explicit in those we retu…
fsoubelet Jan 15, 2025
f508b00
proper numpy arrays for columns, fix varname not updated
fsoubelet Jan 15, 2025
e89f859
function rename, and fix in docstring
fsoubelet Jan 15, 2025
8b43266
update main docstring chunk, fix return type
fsoubelet Jan 15, 2025
c97746d
imports order
fsoubelet Jan 15, 2025
71bfb16
also here
fsoubelet Jan 15, 2025
c97cdde
private function explicitely requires individual (geometric) emittanc…
fsoubelet Jan 15, 2025
cb0e623
public function checks for correct radiation state of TwissTable firs…
fsoubelet Jan 15, 2025
9dbc735
check for valid emittance_constraint and if it is, warn if coupling f…
fsoubelet Jan 15, 2025
8d9cc79
move these up
fsoubelet Jan 15, 2025
cac2b79
this todo has been done
fsoubelet Jan 15, 2025
7d8ebfc
commented out check for when we require emittances
fsoubelet Jan 15, 2025
95a8145
no umpacking, let's be verbose
fsoubelet Jan 15, 2025
c661d70
type hint
fsoubelet Jan 15, 2025
41da9b9
type hints and tweaks
fsoubelet Jan 15, 2025
361f6e3
avoid attribute access in loop for print
fsoubelet Jan 15, 2025
8385252
use logging.warning instead of warning module
fsoubelet Jan 15, 2025
86a2079
TYPE CHECKING guard
fsoubelet Jan 15, 2025
a98eb87
constraint first as it makes the conditionals clearer
fsoubelet Jan 15, 2025
9dc4390
also add sigma_zeta and sigma_delta into the result table
fsoubelet Jan 16, 2025
e41b2e4
also add these to docstring
fsoubelet Jan 16, 2025
54124e0
typo fix and note admonition about required radiation config
fsoubelet Jan 16, 2025
604f7c4
make it very clear we recompute the emittance
fsoubelet Jan 16, 2025
40a585e
consistency in units
fsoubelet Jan 16, 2025
9ad6de7
also speficy in docstring that overwriting args force eps_zeta recompute
fsoubelet Jan 16, 2025
eb6ef54
Merge pull request #4 from SebastienJoly/apis
SebastienJoly Jan 17, 2025
aa3ba4d
create checks for important params, shuffle some comments around
fsoubelet Jan 17, 2025
8f87d39
start taking from normalized emittances if they are provided, compute…
fsoubelet Jan 17, 2025
c685455
shuffle around a bit
fsoubelet Jan 17, 2025
646ac2b
if no initial emittance, take the SR eq value, log and set a flag
fsoubelet Jan 17, 2025
a84c63f
use starting_gemitt_[x,y,zeta] and different logic for renormalization
fsoubelet Jan 17, 2025
90bb403
and use these new variables, will need to run tests here
fsoubelet Jan 17, 2025
233c649
todo for discussion and review with Seb
fsoubelet Jan 17, 2025
f64a8c7
docstring for the starting emittance parameters
fsoubelet Jan 17, 2025
7bc2f65
remove initial_emittances from params and docstring
fsoubelet Jan 17, 2025
df3744e
start warning admonition with TODO
fsoubelet Jan 17, 2025
a5b4512
no more trace of input_emittances
fsoubelet Jan 17, 2025
97ed5c5
some formatting
fsoubelet Jan 17, 2025
cfe428d
simpler message
fsoubelet Jan 17, 2025
4c5c10c
also check for provided values, should be renormalized if given as tw…
fsoubelet Jan 17, 2025
248ba6e
docstring warning about providing values and constraint
fsoubelet Jan 17, 2025
8cbbddc
one more todo, suggestion for behaviour
fsoubelet Jan 17, 2025
4dd19e9
tstep parameter commented out everywhere, for later feature if we wan…
fsoubelet Jan 21, 2025
79fd22d
todo for later on sigma_zeta/delta
fsoubelet Jan 21, 2025
f19f08e
start name with eq_ for stored results
fsoubelet Jan 21, 2025
0b74c9c
also in the docstring
fsoubelet Jan 21, 2025
e666d05
remove unused imports
fsoubelet Jan 21, 2025
e8f7237
ref for derivatives computation
fsoubelet Jan 21, 2025
62dca8b
log here that we would renormalize
fsoubelet Jan 21, 2025
1365649
use starting_gemitt here as discussed
fsoubelet Jan 21, 2025
c778699
Merge pull request #5 from SebastienJoly/user_api_force
fsoubelet Jan 22, 2025
12bc224
Merge branch 'xsuite:main' into feature/equilibrium_emittance
fsoubelet Jan 27, 2025
3fd39b0
tstep parameter, with docstring, and some comments
fsoubelet Jan 27, 2025
93b4313
some ibs conftest tweaks
fsoubelet Jan 27, 2025
837e4e3
file rename
fsoubelet Jan 27, 2025
8b718eb
quick formatting
fsoubelet Jan 27, 2025
da230df
unused import
fsoubelet Jan 27, 2025
98b9afa
fixture for BESSY3 line
fsoubelet Jan 27, 2025
3911909
comments
fsoubelet Jan 27, 2025
9c230c5
use set bunch intensity
fsoubelet Jan 27, 2025
e372849
gianni prefers tw to twiss
fsoubelet Jan 27, 2025
400dcc8
use xo.assert_allclose
fsoubelet Jan 27, 2025
7d60a98
adding debug logs and clearing name
fsoubelet Jan 27, 2025
7870504
more debug
fsoubelet Jan 27, 2025
cbfc7b6
replace in progress
fsoubelet Jan 27, 2025
30ed006
some comments here
fsoubelet Jan 29, 2025
7d3cd9e
first test adapted to new API, parametrized over values of coupling c…
fsoubelet Jan 29, 2025
6a786ee
a better name
fsoubelet Jan 29, 2025
c8b7683
comments fixes
fsoubelet Jan 29, 2025
5d7c7d8
same parametrized test for excitation constraint
fsoubelet Jan 29, 2025
9d87d06
some docstrings in the tests
fsoubelet Jan 29, 2025
6495ad4
remove this test as it's the first one
fsoubelet Jan 29, 2025
649f5d2
test for no constraint but Y does not pass
fsoubelet Jan 29, 2025
92080bb
test is good
fsoubelet Jan 29, 2025
f21d52e
remove auto added garbage
fsoubelet Jan 30, 2025
3cbb2fa
Merge pull request #6 from SebastienJoly/tstep_and_tests
fsoubelet Jan 30, 2025
03b0a9c
use xo function
fsoubelet Jan 30, 2025
d380f32
Remove obsolete logger message
Jan 30, 2025
0517f4e
Merge pull request #7 from SebastienJoly/remove_redundant_logger_info
fsoubelet Jan 31, 2025
8b67852
behaviour tests for missing elements
fsoubelet Jan 31, 2025
221f668
test invalid constraint
fsoubelet Jan 31, 2025
6c3112a
some
fsoubelet Jan 31, 2025
1c0521a
also include correct sigma_zeta and sigma_delta using longitudinal ratio
fsoubelet Feb 5, 2025
3b50667
todo for later
fsoubelet Feb 5, 2025
871e859
Merge pull request #8 from SebastienJoly/behaviour_tests
fsoubelet Feb 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
one more todo, suggestion for behaviour
fsoubelet committed Jan 17, 2025
commit 8cbbddc1a437200fdd759e6a50f745a0a1bc40a1
3 changes: 2 additions & 1 deletion xfields/ibs/_equilibrium.py
Original file line number Diff line number Diff line change
@@ -350,6 +350,7 @@ def compute_equilibrium_emittances_from_sr_and_ibs(
assert gemitt_zeta is None, "Cannot provide both 'gemitt_zeta' and 'nemitt_zeta'"
gemitt_zeta = nemitt_zeta / (twiss.beta0 * twiss.gamma0)
# ---------------------------------------------------------------------------------------------
# TODO: We can just check if ONE (or more) is None and say we take all 3 from TwissTable in this case -> any(emit is None for emit in (gemitt_x, gemitt_y, gemitt_zeta))
# Take default values from the TwissTable if no initial emittances are provided. In this case we
# need to renormalize with the emittance_constraint so we add a flag to know we need to do that
_renormalize_transverse_emittances = False
@@ -374,7 +375,7 @@ def compute_equilibrium_emittances_from_sr_and_ibs(
starting_gemitt_y = gemitt_y
starting_gemitt_zeta = gemitt_zeta
# ---------------------------------------------------------------------------------------------
# TODO: Decide with Seb if this is ok - we renormalize EVEN if just 1 value was taken from TwissTable SR eq
# TODO: Decide with Seb if this is ok - we renormalize EVEN if just 1 value was taken from TwissTable SR eq -> not case if we do the TODO from above
# If we need to renormalize the transverse emittances, we so now. If emittance_coupling_factor is
# non-zero, transverse emittances are modified accordingly (used convention is valid for arbitrary
# damping partition numbers and emittance_coupling_factor values).