Skip to content
Snippets Groups Projects
Commit b4fd9de1 authored by Yngve Levinsen's avatar Yngve Levinsen
Browse files

Fixed flake8 errors in four more files

parent 99257257
No related branches found
No related tags found
No related merge requests found
from icalendar import Calendar, Event, Timezone
import pytz
from icalendar import Calendar, Event
from datetime import datetime
import os
......
......@@ -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)
......
......@@ -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
......
......@@ -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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment