From 8114cf265a593df4cbfe6205183e7a94e90e61dd Mon Sep 17 00:00:00 2001 From: Yngve Levinsen <yngve@pm.me> Date: Thu, 22 Nov 2018 17:08:04 +0100 Subject: [PATCH] removing * imports --- ess/lib_tw_elem.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/ess/lib_tw_elem.py b/ess/lib_tw_elem.py index 05ac99a..2d5a9e9 100644 --- a/ess/lib_tw_elem.py +++ b/ess/lib_tw_elem.py @@ -96,7 +96,7 @@ from __future__ import print_function #---- Libs -from numpy import * +import numpy import sys import shutil @@ -110,7 +110,7 @@ c =2.99792458 def Brho(gamma): - return (10.0/c)*sqrt(gamma**2-1.0)*mass*1e-3 + return (10.0/c)*numpy.sqrt(gamma**2-1.0)*mass*1e-3 class FIELD_MAP_DATA: ''' @@ -123,7 +123,7 @@ class FIELD_MAP_DATA: # Instances self.dL =float(lin[0].split()[1])/int(lin[0].split()[0]) - self.field=array(lin[2:], dtype=float) + self.field=numpy.array(lin[2:], dtype=float) self.file_name = file_name def get_bdsim(self,path): @@ -239,10 +239,10 @@ class FIELD_MAP(ELEM): sys.exit() # Update gamma (simple ver, closer to TW) - dL=self.data.dL; V=self.Enom*array(self.data.field)*dL; phs=self.phs_rf; C=0.0; S=0.0 + dL=self.data.dL; V=self.Enom*numpy.array(self.data.field)*dL; phs=self.phs_rf; C=0.0; S=0.0 for i in range(len(V)): - C+=V[i]*cos(phs); S+=V[i]*sin(phs); self.gamma+=V[i]/mass*cos(phs) - beta=sqrt(1.0-1.0/self.gamma**2); phs+=2.0*pi*self.freq*dL/(beta*c*1e2) + C+=V[i]*numpy.cos(phs); S+=V[i]*numpy.sin(phs); self.gamma+=V[i]/mass*numpy.cos(phs) + beta=numpy.sqrt(1.0-1.0/self.gamma**2); phs+=2.0*pi*self.freq*dL/(beta*c*1e2) # Update gamma (I think this is more accurate...) ## dL=self.data.dL; V=self.Enom*array(self.data.field)*dL; phs=self.phs_rf; C=0; S=0 @@ -258,7 +258,7 @@ class FIELD_MAP(ELEM): # Option instances for other codes (MADX?) self.phs_syn=arctan(S/C) - self.E0TL =C/cos(self.phs_syn) + self.E0TL =C/numpy.cos(self.phs_syn) def get_tw(self): @@ -544,11 +544,11 @@ class GAP(ELEM): # Update gamma (and E0TL) if self.beta_s!=0.0 and self.T0!=0.0: - gamma_c =self.gamma+0.5*self.E0TL/mass*cos(self.phs_rf) - beta_c =sqrt(1.0-1.0/gamma_c**2) + gamma_c =self.gamma+0.5*self.E0TL/mass*numpy.cos(self.phs_rf) + beta_c =numpy.sqrt(1.0-1.0/gamma_c**2) k =self.beta_s/beta_c self.E0TL*=(self.T0+self.T1*(k-1.0)+0.5*self.T2*(k-1.0)**2)/self.T0 - self.gamma+=self.E0TL/mass*cos(self.phs_rf) + self.gamma+=self.E0TL/mass*numpy.cos(self.phs_rf) def get_tw(self): @@ -636,11 +636,11 @@ class DTL_CEL(ELEM): # Update gamma (and E0TL) if self.beta_s!=0.0 and self.T0!=0.0: - gamma_c =self.gamma+0.5*self.E0TL/mass*cos(self.phs_rf) - beta_c =sqrt(1.0-1.0/gamma_c**2) + gamma_c =self.gamma+0.5*self.E0TL/mass*numpy.cos(self.phs_rf) + beta_c =numpy.sqrt(1.0-1.0/gamma_c**2) k =self.beta_s/beta_c self.E0TL*=(self.T0+self.T1*(k-1.0)+0.5*self.T2*(k-1.0)**2)/self.T0 - self.gamma+=self.E0TL/mass*cos(self.phs_rf) + self.gamma+=self.E0TL/mass*numpy.cos(self.phs_rf) def get_tw(self): @@ -787,7 +787,7 @@ class BEND(ELEM): if self.plane=='0': self.tilt=0.0 if self.plane=='1': self.tilt=0.5*pi self.ds =self.rho*abs(self.angle) - self.L =2.0*self.rho*sin(0.5*abs(self.angle)) + self.L =2.0*self.rho*numpy.sin(0.5*abs(self.angle)) self.gap =0.0 # Get this from EDGE IF not exporting edge for MADX self.ff_coef1=0.0 # Get this from EDGE IF not exporting edge for MADX self.ff_coef2=0.0 # Get this from EDGE IF not exporting edge for MADX -- GitLab