Useful (and not so useful) Scripts
Converting rfdata to T7
Input: 1D field map (on axis longitudinal electrical field).
Output: T7-like 2d field data
Calls function interpolateFieldmap(fourCoefs,r,z,cavity_info).
interpolateFieldmapVarZnR.m
Input: rfdata (array of fourier coefficients).
Output: longitudinal and radial electrical field and transverse magnetic field at one position (z,r).
interpolateFieldmap.m
Example:
>> interpolateFieldmapVarZnR('INEG-ECAT.Ez',[0.0:0.01/1000:0.01],[0.0:0.001/100:0.001],[0.01,0.000001],40);
This function call loads the file INEG-ECAT.Ez and writes the file INEG-ECAT.T7 in T7 file format.
Note that in Matlab, ranges are given in the format [start:step-size:end]. Therefore, in the example given above, the field
is calculated for 1000 points in z spread between 0.0 and 1 cm (0.01 m) and for 100 points in r spread between 0 and 0.1 cm (0.001 m).
Converting non-uniform ASTRA field map to uniform OPAL field map
Input: Filename of the ASTRA field map, frequency of the field
Output: OPAL field map 'test.T7'
NonUniform2Uniform.m
To run use Matlab or Octave:
octave --eval "NonUniform2Uniform('ASTRA_fm.dat', 2997.912)"
Converting HFSS to OPAL field maps
Input:
- Directory name where the files Ez.fld, Ex.fld and Hy.fld reside
- number of sampling points in z direction
- number of sampling points in r direction
- frequency of the fields
Output: OPAL field map with name <directory>.opal
hfss_to_opal.m
Comparing different reconstruction methods for field maps
Small collection of matlab scripts to compare reconstruction methods using bi-linear interpolation, bi-spline interpolation and fourier interpolation:
compare_reconstruction_methods.tar.gz.
Visualize T7 file of a standing wave cavity
Input: filename of 2D T7 file of standing wave cavity
Output: postscript of visualization using gnuplot and 'pm3d map' therein
plotSWpcolor.py.
Last update:
Christof.Kraus@psi.ch