One of the most basic ways of working with Dynac is to feed the executable an input file, and then to use plotit
to look at the output plots. Here we show how this simple workflow can be performed in Pynac. We create an empty working directory, copy the relevant files into it, and then move into that directory to work.
First we import some stuff we need.
In [1]:
from Pynac.Core import Pynac
from Pynac.Plotting import PynPlt
from bokeh.io import output_notebook
import os
import shutil
output_notebook()
In [2]:
newDir = 'workingDir'
if os.path.isdir(newDir):
shutil.rmtree(newDir)
os.mkdir(newDir)
filelist = [
'ESS_with_SC_ana.in',
'Spoke_F2F_field.txt',
'MBL_F2F_field.txt',
'HBL_F2F_field.txt',
'ESS_RFQ_out_70mA.dst',
]
for f in filelist:
shutil.copyfile('../tests/' + f, newDir + '/' + f)
os.chdir(newDir)
In [3]:
pynacObject = Pynac('ESS_with_SC_ana.in')
pynacObject.run()
In [4]:
plottingObject = PynPlt()
plottingObject.plotit()
os.chdir('..')