1515@date: 13.06.2017
1616'''
1717
18- from __future__ import division , print_function
18+
1919
2020from scipy .constants import c
2121
@@ -82,7 +82,7 @@ def __init__(self, length, mesh, fields, wrt_beam_centroid=False,
8282 poissonsolver = None ,
8383 gradient = lambda * args , ** kwargs : None ,
8484 mesh = mesh )
85- self .fields = map (pm .ensure_same_device , fields )
85+ self .fields = list ( map (pm .ensure_same_device , fields ) )
8686 self .wrt_beam_centroid = wrt_beam_centroid
8787
8888 def track (self , beam ):
@@ -94,7 +94,7 @@ def track(self, beam):
9494 beam .y - my ,
9595 beam .z - mz ] # zip will cut to #fields
9696
97- mesh_fields_and_mp_coords = zip (self .fields , mp_coords )
97+ mesh_fields_and_mp_coords = list ( zip (self .fields , mp_coords ) )
9898
9999 # electric fields at each particle position in lab frame [V/m]
100100 part_fields = self .pypic .field_to_particles (* mesh_fields_and_mp_coords )
@@ -149,7 +149,7 @@ def __init__(self, slicer, *args, **kwargs):
149149 # require 2D!
150150 assert self .pypic .mesh .dimension == 2 , \
151151 'mesh needs to be two-dimensional!'
152- assert all (map ( lambda f : f .ndim == 2 , self .fields ) ), \
152+ assert all ([ f .ndim == 2 for f in self .fields ] ), \
153153 'transverse field components need to be two-dimensional arrays!'
154154 #
155155
@@ -167,7 +167,7 @@ def track(self, beam):
167167 mp_coords = [beam .x - mx ,
168168 beam .y - my ,
169169 beam .z ] # zip will cut to #fields
170- mesh_fields_and_mp_coords = zip (self .fields , mp_coords )
170+ mesh_fields_and_mp_coords = list ( zip (self .fields , mp_coords ) )
171171
172172 # electric fields at each particle position in lab frame [V/m]
173173 part_fields = self .pypic .field_to_particles (* mesh_fields_and_mp_coords )
0 commit comments