Home > lattice > element_creation > atidtable.m

atidtable

PURPOSE ^

atidtable(FAMNAME,Nslice,filename,Energy,method)

SYNOPSIS ^

function Elem = atidtable(fname, Nslice, filename, Energy, method)

DESCRIPTION ^

 atidtable(FAMNAME,Nslice,filename,Energy,method)

 FamName    family name
 Nslice    number of slices (1 means the wiggler is represented by a
           single kick in the center of the device).
 filename    name of file with wiggler tracking tables.
 Energy    Energy of the machine, needed for scaling
 method    tracking function. Defaults to 'IdTablePass'

 The tracking table is described in
 P. Elleaume, "A new approach to the electron beam dynamics in undulators
 and wigglers", EPAC92.

 returns assigned structure with class 'KickMap'

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function Elem = atidtable(fname, Nslice, filename, Energy, method)
0002 % atidtable(FAMNAME,Nslice,filename,Energy,method)
0003 %
0004 % FamName    family name
0005 % Nslice    number of slices (1 means the wiggler is represented by a
0006 %           single kick in the center of the device).
0007 % filename    name of file with wiggler tracking tables.
0008 % Energy    Energy of the machine, needed for scaling
0009 % method    tracking function. Defaults to 'IdTablePass'
0010 %
0011 % The tracking table is described in
0012 % P. Elleaume, "A new approach to the electron beam dynamics in undulators
0013 % and wigglers", EPAC92.
0014 %
0015 % returns assigned structure with class 'KickMap'
0016 
0017 %---------------------------------------------------------------------------
0018 % Modification Log:
0019 % -----------------
0020 % 13-09-2007:  Created by M. Munoz, based in J. Safranek code.
0021 % 17-11-2008:  Modificated by Z.Martí
0022 % 23-02-2012:  further modifications by B. Nash: reads in only matlab file
0023 %---------------------------------------------------------------------------
0024 
0025 if nargin < 5, method='IdTablePass'; end
0026 Elem.FamName=fname;
0027 Elem.Nslice=Nslice;
0028 Elem.PassMethod=method;
0029 
0030 
0031 factor=1/((Energy/0.299792458)^2);
0032 factor1=-1/((Energy/0.299792458));
0033     
0034 % Read the file, first check if its a matlab file
0035 %[pathstr, name, ext] = fileparts(filename)
0036 %if  ~isequal(ext,'.mat');
0037  
0038     D=load(filename);
0039     xtable=(D.xtable)';
0040     ytable=(D.ytable)';
0041     xkick1=factor1*D.xkick1;
0042     ykick1=factor1*D.ykick1;
0043     xkick=factor*D.xkick;
0044     ykick=factor*D.ykick;
0045     L=D.Len;
0046 % Sort arrays in ascending order and transpose (needed for "IdTablePass.c")
0047 
0048 [xtable indx]=sort(xtable); %#ok<TRSRT>
0049 [ytable indy]=sort(ytable); %#ok<TRSRT>
0050 
0051 xkick=xkick(indx,indy);
0052 ykick=ykick(indx,indy);
0053 
0054 xkick=xkick';
0055 ykick=ykick';
0056 xkick1=xkick1';
0057 ykick1=ykick1';
0058 
0059 
0060 Elem.Length= L;
0061 Elem.xtable = xtable;
0062 Elem.ytable = ytable;
0063 Elem.xkick = xkick;
0064 Elem.ykick = ykick;
0065 Elem.xkick1 = xkick1;
0066 Elem.ykick1 = ykick1;
0067 
0068 Elem.Class  = 'KickMap'

Generated on Thu 24-Aug-2017 18:47:33 by m2html © 2005