Skip to content

Scripts

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: interpolateFieldmap(fourCoefs, r, z, cavity_info)
  • Script: interpolateFieldmapVarZnR.m

Also: - Input: rfdata (array of Fourier coefficients)
- Output: longitudinal and radial electric field and transverse magnetic field at one position (z, r)
- Script: 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 loads INEG-ECAT.Ez and writes INEG-ECAT.T7 in T7 format. In MATLAB ranges use the form [start:step:end]; the example computes the field on ~1000 points in z (0–0.01 m) and ~100 points in r (0–0.001 m).

Converting non‑uniform ASTRA field map to uniform OPAL field map

  • Input: ASTRA field map filename and field frequency
  • Output: OPAL field map test.T7
  • Script: NonUniform2Uniform.m

Run with Octave or MATLAB:

octave --eval "NonUniform2Uniform('ASTRA_fm.dat', 2997.912)"

Converting HFSS to OPAL field maps

  • Input:
  • Directory containing Ez.fld, Ex.fld and Hy.fld
  • Number of sampling points in z
  • Number of sampling points in r
  • Field frequency
  • Output: OPAL field map named <directory>.opal
  • Script: hfss_to_opal.m

Comparing different reconstruction methods for field maps

Small collection of MATLAB scripts to compare bi‑linear, bi‑spline and Fourier interpolation methods: compare_reconstruction_methods.tar.gz

Visualize T7 file of a standing wave cavity

  • Input: filename of 2D T7 file (standing wave cavity)
  • Output: PostScript visualization using gnuplot (pm3d map)
  • Script: plotSWpcolor.py