Skip to content
Snippets Groups Projects
Commit f7d07484 authored by Yngve Levinsen's avatar Yngve Levinsen
Browse files

added tracewin script (to execute batch tracewin)

parent e22140d4
No related branches found
No related tags found
No related merge requests found
......@@ -6,4 +6,5 @@ setup(name='Yngve Tools',
author='Yngve Inntjore Levinsen',
author_email='yngve.levinsen@esss.se',
packages=['ess'],
scripts=['tracewin'],
)
tracewin 0 → 100644
#!/usr/bin/env python
import argparse
import os
parser = argparse.ArgumentParser(description="Creates a TraceWin batch command")
parser.add_argument('-p', '--project', dest='project',
help="Project file", required=True)
parser.add_argument('-l', '--lattice', dest='lattice',
help="Lattice/structure file (.dat) to use")
parser.add_argument('-f', '--freq', dest='frequency',
help="Bunch Frequency of beam 1 [MHz]")
parser.add_argument('-c', '--current', dest='current',
help="Beam Current of beam 1 [mA]")
parser.add_argument('-n', '--npart', dest='npart',
help="Number of particles in beam 1")
parser.add_argument('-e', '--energy', dest='energy',
help="Input beam energy for beam 1 [MeV]")
parser.add_argument('-o', '--output', dest='outpath',
help="Path to calculation directory")
parser.add_argument('-r', '--seed', dest='seed',
help="Initial random seed", type=int)
args = parser.parse_args()
# A list to be filled depending on arguments given...
cmd = ["TraceWin64_noX11", "'"+args.project+"'"]
if args.lattice:
cmd.append("dat_file="+args.lattice)
if args.frequency:
cmd.append("freq1="+args.lattice)
if args.current:
cmd.append("current1="+args.current)
if args.npart:
cmd.append("npart1="+args.npart)
if args.energy:
cmd.append("energy1="+args.energy)
if args.outpath:
cmd.append("path_cal='"+os.path.abspath(args.outpath)+"'")
if args.seed:
cmd.append("random_seed="+str(args.seed))
# For now we just print the command:
print ' '.join(cmd)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment