From b4fd9de1d0e397ce9e7a135b3ee15c57b6366919 Mon Sep 17 00:00:00 2001 From: Yngve Levinsen <yngve.levinsen@esss.se> Date: Wed, 14 Aug 2019 16:20:17 +0200 Subject: [PATCH] Fixed flake8 errors in four more files --- Vacations/convert.py | 3 +-- ess/SP_Relativity.py | 20 ++++++++++---------- ess/installed.py | 3 --- examples/fieldmap/example.py | 2 +- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/Vacations/convert.py b/Vacations/convert.py index a4dac54..381195e 100644 --- a/Vacations/convert.py +++ b/Vacations/convert.py @@ -1,5 +1,4 @@ -from icalendar import Calendar, Event, Timezone -import pytz +from icalendar import Calendar, Event from datetime import datetime import os diff --git a/ess/SP_Relativity.py b/ess/SP_Relativity.py index 2c7b64d..3885399 100644 --- a/ess/SP_Relativity.py +++ b/ess/SP_Relativity.py @@ -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) diff --git a/ess/installed.py b/ess/installed.py index c848a84..94e537b 100644 --- a/ess/installed.py +++ b/ess/installed.py @@ -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 diff --git a/examples/fieldmap/example.py b/examples/fieldmap/example.py index eba98e2..ac361bc 100644 --- a/examples/fieldmap/example.py +++ b/examples/fieldmap/example.py @@ -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. -- GitLab