Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nmap2024
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Egenolf, Thilo
nmap2024
Commits
77dbc164
Unverified
Commit
77dbc164
authored
6 months ago
by
tegenolf
Committed by
GitHub
6 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Add config file for week 8
parent
0d67f30b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
week8/config8.py
+69
-0
69 additions, 0 deletions
week8/config8.py
with
69 additions
and
0 deletions
week8/config8.py
0 → 100644
+
69
−
0
View file @
77dbc164
#!/usr/bin/env python
import
warnings
warnings
.
filterwarnings
(
'
ignore
'
)
import
numpy
as
np
np
.
random
.
seed
(
0
)
import
matplotlib
import
matplotlib.pyplot
as
plt
import
seaborn
as
sns
sns
.
set_context
(
'
talk
'
,
font_scale
=
1.2
,
rc
=
{
'
lines.linewidth
'
:
3
})
sns
.
set_style
(
'
ticks
'
,
{
'
grid.linestyle
'
:
'
none
'
,
'
axes.edgecolor
'
:
'
0
'
,
'
axes.linewidth
'
:
1.2
,
'
legend.frameon
'
:
True
,
'
xtick.direction
'
:
'
out
'
,
'
ytick.direction
'
:
'
out
'
,
'
xtick.top
'
:
True
,
'
ytick.right
'
:
True
,
})
from
scipy.constants
import
m_p
,
c
,
e
import
sys
from
cpymad.madx
import
Madx
from
scipy.interpolate
import
interp1d
import
PyNAFF
import
pysixtrack
from
pysixtrack
import
elements
def
M_drift
(
L
):
return
np
.
array
([
[
1
,
L
],
[
0
,
1
]
])
def
M_dip_x
(
L
,
rho0
):
return
np
.
array
([
[
np
.
cos
(
L
/
rho0
),
rho0
*
np
.
sin
(
L
/
rho0
)],
[
-
1
/
rho0
*
np
.
sin
(
L
/
rho0
),
np
.
cos
(
L
/
rho0
)]
])
def
M_dip_y
(
L
,
rho0
):
return
M_drift
(
L
)
def
M_quad_x
(
L
,
k
):
ksq
=
np
.
sqrt
(
k
+
0j
)
return
np
.
array
([
[
np
.
cos
(
ksq
*
L
),
1
/
ksq
*
np
.
sin
(
ksq
*
L
)],
[
-
ksq
*
np
.
sin
(
ksq
*
L
),
np
.
cos
(
ksq
*
L
)]
]).
real
def
M_quad_y
(
L
,
k
):
ksq
=
np
.
sqrt
(
k
+
0j
)
return
np
.
array
([
[
np
.
cosh
(
ksq
*
L
),
1
/
ksq
*
np
.
sinh
(
ksq
*
L
)],
[
ksq
*
np
.
sinh
(
ksq
*
L
),
np
.
cosh
(
ksq
*
L
)]
]).
real
def
track
(
M
,
u
,
up
):
'''
Apply M to each individual [u;up] vectors value.
'''
return
np
.
einsum
(
'
ij...,...j->i...
'
,
M
,
np
.
vstack
((
u
,
up
)).
T
)
def
track_sext_4D
(
x
,
xp
,
y
,
yp
,
mL
):
xp
+=
0.5
*
mL
*
(
y
*
y
-
x
*
x
)
yp
+=
mL
*
x
*
y
return
x
,
xp
,
y
,
yp
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