def getshcol(beam,col): ''' Extract multiple columns from a shadow file (eg.'begin.dat') or a Shadow.Beam instance. The column are numbered in the fortran convention, i.e. starting from 1. It returns a np.array filled with the values of the chosen column. Inputs: beam : str instance with the name of the shadow file to be loaded. OR Shadow.Beam initialized instance. col : tuple or list instance of int with the number of columns chosen. Outputs: numpy.array 2-D with dimension R x NPOINT. Where R is the total number of column chosen Error: if an error occurs an ArgsError is raised. Possible choice for col are: 1 X spatial coordinate [user's unit] 2 Y spatial coordinate [user's unit] 3 Z spatial coordinate [user's unit] 4 X' direction or divergence [rads] 5 Y' direction or divergence [rads] 6 Z' direction or divergence [rads] 7 X component of the electromagnetic vector (s-polariz) 8 Y component of the electromagnetic vector (s-polariz) 9 Z component of the electromagnetic vector (s-polariz) 10 Lost ray flag 11 Energy [eV] 12 Ray index 13 Optical path length 14 Phase (s-polarization) 15 Phase (p-polarization) 16 X component of the electromagnetic vector (p-polariz) 17 Y component of the electromagnetic vector (p-polariz) 18 Z component of the electromagnetic vector (p-polariz) 19 Wavelength [A] 20 R= SQRT(X^2+Y^2+Z^2) 21 angle from Y axis 22 the magnituse of the Electromagnetic vector 23 |E|^2 (total intensity) 24 total intensity for s-polarization 25 total intensity for p-polarization 26 K = 2 pi / lambda [A^-1] 27 K = 2 pi / lambda * col4 [A^-1] 28 K = 2 pi / lambda * col5 [A^-1] 29 K = 2 pi / lambda * col6 [A^-1] 30 S0-stokes = |Es|^2 + |Ep|^2 31 S1-stokes = |Es|^2 - |Ep|^2 32 S2-stokes = 2 |Es| |Ep| cos(phase_s-phase_p) 33 S3-stokes = 2 |Es| |Ep| sin(phase_s-phase_p) ''' try: stp.getshcol_CheckArg(beam,col) except stp.ArgsError as e: raise e if isinstance(beam,sd.Beam): bm = beam else: bm = sd.Beam() bm.load(beam) ret = [] if isinstance(col, int): return getshonecol(bm,col) for c in col: ret.append(getshonecol(bm,c)) return tuple(ret)