Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mbtrack2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PA
Collective Effects
mbtrack2
Commits
6593babf
Commit
6593babf
authored
3 months ago
by
Vadim Gubaidulin
Browse files
Options
Downloads
Patches
Plain Diff
Added a test to check the tune shifts from FBT are correct.
parent
93934fb5
No related branches found
Tags
snapArchivingServers-1.6.5
1 merge request
!32
FBT
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/physics/test_fbt_phys.py
+17
-2
17 additions, 2 deletions
tests/physics/test_fbt_phys.py
with
17 additions
and
2 deletions
tests/physics/test_fbt_phys.py
+
17
−
2
View file @
6593babf
import
h5py
as
hp
import
numpy
as
np
import
numpy
as
np
import
pytest
import
pytest
from
nafflib
import
get_tune
from
utility_test_growth_rate
import
get_growth_beam
from
utility_test_growth_rate
import
get_growth_beam
from
mbtrack2
import
(
from
mbtrack2
import
(
...
@@ -40,10 +42,10 @@ class TestFBTPhys:
...
@@ -40,10 +42,10 @@ class TestFBTPhys:
track_alive
=
False
,
track_alive
=
False
,
mpi
=
False
)
mpi
=
False
)
damping_time
=
[
50
,
100
]
damping_time
=
[
50
,
100
]
growth_rate
=
1
/
(
damping_time
[
1
]
*
demo_ring
.
T0
)
phase_diff
=
[
-
45
,
-
45
]
fbt
=
TransverseExponentialDamper
(
ring
,
fbt
=
TransverseExponentialDamper
(
ring
,
damping_time
=
damping_time
,
damping_time
=
damping_time
,
phase_diff
=
[
-
90
,
-
90
]
)
phase_diff
=
phase_diff
)
save_every
=
1
save_every
=
1
bbmon
=
BeamMonitor
(
h
=
ring
.
h
,
bbmon
=
BeamMonitor
(
h
=
ring
.
h
,
...
@@ -62,6 +64,8 @@ class TestFBTPhys:
...
@@ -62,6 +64,8 @@ class TestFBTPhys:
bbmon
.
close
()
bbmon
.
close
()
growth_rate
=
(
1
/
(
damping_time
[
1
]
*
demo_ring
.
T0
)
*
np
.
cos
(
np
.
deg2rad
(
phase_diff
[
1
])))
path
=
name
+
'
.hdf5
'
path
=
name
+
'
.hdf5
'
gr
,
gr_std
=
get_growth_beam
(
ring
,
path
,
1e3
,
2e3
)
gr
,
gr_std
=
get_growth_beam
(
ring
,
path
,
1e3
,
2e3
)
rel_error
=
np
.
abs
(
growth_rate
-
gr
)
*
100
/
growth_rate
rel_error
=
np
.
abs
(
growth_rate
-
gr
)
*
100
/
growth_rate
...
@@ -69,6 +73,17 @@ class TestFBTPhys:
...
@@ -69,6 +73,17 @@ class TestFBTPhys:
print
(
f
"
Relative error:
{
rel_error
}
% (std:
{
rel_error_std
}
%)
"
)
print
(
f
"
Relative error:
{
rel_error
}
% (std:
{
rel_error_std
}
%)
"
)
assert
rel_error
<
5
assert
rel_error
<
5
with
hp
.
File
(
name
+
'
.hdf5
'
,
'
r
'
)
as
f
:
x
=
f
[
'
Beam
'
][
'
mean
'
][
0
,
0
,
:]
t
=
get_tune
(
x
)
np
.
testing
.
assert_allclose
(
(
np
.
abs
(
t
)
-
(
demo_ring
.
tune
[
0
]
-
int
(
demo_ring
.
tune
[
0
]))),
np
.
abs
(
np
.
sin
(
np
.
deg2rad
(
phase_diff
[
0
]))
/
(
2
*
np
.
pi
*
damping_time
[
0
])),
rtol
=
5e-2
)
def
test_firdamper_growth_rate_chroma0
(
self
,
demo_ring
,
tmp_path
):
def
test_firdamper_growth_rate_chroma0
(
self
,
demo_ring
,
tmp_path
):
ring
=
demo_ring
ring
=
demo_ring
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment