Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ess-python-tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ESS Beam Physics
ess-python-tools
Commits
b4fd9de1
Commit
b4fd9de1
authored
5 years ago
by
Yngve Levinsen
Browse files
Options
Downloads
Patches
Plain Diff
Fixed flake8 errors in four more files
parent
99257257
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Vacations/convert.py
+1
-2
1 addition, 2 deletions
Vacations/convert.py
ess/SP_Relativity.py
+10
-10
10 additions, 10 deletions
ess/SP_Relativity.py
ess/installed.py
+0
-3
0 additions, 3 deletions
ess/installed.py
examples/fieldmap/example.py
+1
-1
1 addition, 1 deletion
examples/fieldmap/example.py
with
12 additions
and
16 deletions
Vacations/convert.py
+
1
−
2
View file @
b4fd9de1
from
icalendar
import
Calendar
,
Event
,
Timezone
import
pytz
from
icalendar
import
Calendar
,
Event
from
datetime
import
datetime
import
os
...
...
This diff is collapsed.
Click to expand it.
ess/SP_Relativity.py
+
10
−
10
View file @
b4fd9de1
...
...
@@ -62,7 +62,7 @@ def beta_from_gamma(gamma):
raises
------
if given gamma is smaller than one raises a warning
if given gamma is smaller than one raises a warning
"""
if
gamma
<
1
:
print
(
"
gamma cannot be less than one
"
)
...
...
@@ -124,9 +124,9 @@ def energy(gamma_beta, mass=proton_mass_in_MeV):
-------
returns kinetic energy of the particle in MeV.
example:
sprel.energy(2.55, 938)
example:
sprel.energy(2.55, 938)
> 1453.8999999999999
if gamma_beta < 1 the value is beta
example:
...
...
@@ -146,24 +146,24 @@ def emit_geo(u_up_array):
----------
u_up_array: array like
a 2D array containing that has u_up_array[:,:2] as coordinates in u and u
'
returns
-------
geometrical emittance of the distribution/array in units of pi.mm.mrad
"""
import
numpy
as
np
u_shift
=
u_up_array
[:,
0
]
#
x
up_shift
=
u_up_array
[:,
1
]
#
x'
u_shift
=
u_up_array
[:,
0
]
# x
up_shift
=
u_up_array
[:,
1
]
# x'
u
=
u_shift
-
np
.
average
(
u_shift
)
up
=
up_shift
-
np
.
average
(
up_shift
)
u2
=
np
.
square
(
u
)
#
x2
u2
=
np
.
square
(
u
)
# x2
u2ave
=
np
.
average
(
u2
)
# <x2>
# print(u2ave)
up2
=
np
.
square
(
up
)
#
x'2
up2
=
np
.
square
(
up
)
# x'2
up2ave
=
np
.
average
(
up2
)
# <x'2>
# print(up2ave)
uup
=
np
.
multiply
(
u
,
up
)
#
x.x'
uup
=
np
.
multiply
(
u
,
up
)
# x.x'
uupave
=
np
.
average
(
uup
)
# <x.x'>
uupave2
=
uupave
**
2
# <x.x'>2
# print(uupave2)
...
...
This diff is collapsed.
Click to expand it.
ess/installed.py
+
0
−
3
View file @
b4fd9de1
...
...
@@ -10,9 +10,6 @@ def get_installed_packages():
import
pip
installed_packages
=
pip
.
get_installed_distributions
()
installed_packages_list
=
sorted
(
[
"
%s==%s
"
%
(
i
.
key
,
i
.
version
)
for
i
in
installed_packages
]
)
return
installed_packages
...
...
This diff is collapsed.
Click to expand it.
examples/fieldmap/example.py
+
1
−
1
View file @
b4fd9de1
...
...
@@ -4,7 +4,7 @@ import os
"""
Example
The parameters in the following six rows define the path to your fieldmap, no name is needed, this script
The parameters in the following six rows define the path to your fieldmap, no name is needed, this script
scans the folder and converts all files, assumes all are binary fieldmaps, to ASCII fieldmaps.
The dimension of the field is also needed.
If you need to cut the field, the n_enter and n_exit should be adjusted.
...
...
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