Tutorial : SDDSCommandΒΆ

This is a very short tutorial on the SDDSCommand class.

[1]:
from pyelegantsdds.sdds import SDDSCommand
[2]:
%load_ext autoreload
%autoreload 2
[3]:
# Path to Pelegant singularity container
sif = "PATH_TO_SIF_PELEGANT"
[4]:
sddscommand = SDDSCommand(sif)
sddscommand.command
[4]:
{}

The getCommand method returns the command string that can be executed and updates the command property.

[5]:
sddscommand.getCommand('sddsquery',columnList=None,file='temp.sdds')
[5]:
'/home/mti/gitlab-hzb/containers/bin/pelegant.sif sddsquery -columnList temp.sdds'
[6]:
sddscommand.command
[6]:
{'NAME': 'sddsquery', 'columnList': None, 'file': 'temp.sdds'}

The runCommand allows to execute the command.

[7]:
sddscommand.runCommand()
Running command /home/mti/gitlab-hzb/containers/bin/pelegant.sif sddsquery -columnList temp.sdds

The class contains a special method to generate the command to convert a data table in plain format to sdds format.

[8]:
sddscommand.get_particles_plain_2_SDDS_command()
[8]:
'/home/mti/gitlab-hzb/containers/bin/pelegant.sif plaindata2sdds temp_plain_particles.dat temp_particles_input.txt -inputMode=ascii -outputMode=ascii "-separator=  " -column=x,double,units=m -column=xp,double -column=y,double,units=m -column=yp,double -column=t,double,units=s -column=p,double,units="m$be$nc" -columns=particleID,long -noRowCount'