Skip to content

Placet documentation

Placet(**Placetpy_params)

Bases: Placetpy

A class used to wrap the Placet commands in a usable format within Python.

Further extends Placetpy by wrapping the commands.

Other Parameters:

Name Type Description
show_intro bool

If True (defauls is True), prints the welcome message of Placet at the start.

debug_mode bool

If True (default is False), runs Placet in debug mode.

save_logs bool

If True (default is True) , invoking save_debug_info().

send_delay float

The time delay before each data transfer to a child process (sometimes needed for stability). Default is Placet._BUFFER_MAXSIZE.

BeamAddOffset(**command_details)

Run the BeamAddOffset command in Placet TCL.

Modifies the beam by either applying the offsets, angles, or rotating it.

Parameters that are not specified are not modified.

Other Parameters:

Name Type Description
beam str

The name of the beam to modify. There is no check to verify that such a beam exists.

x float

Horizontal offset in micrometers.

y float

Vertical offset in micrometers.

angle_x float

Horizontal angle in microradians.

angle_y float

Vertical angle in microradians.

rotate float

Roll angle in radians. It is added after the offsets.

start int

First particle to offset.

end int

Last particle to offset.

BeamDump(**command_details)

Run the 'BeamDump' command in Placet.

Saves the particle beam coordinates.

Other Parameters:

Name Type Description
file str

Name of the file from where to write the particles.

beam str

Name of the beam into which to read the particles.

xaxis int

If not zero remove mean horizontal angle and offset.

yaxis int

If not zero remove mean vertical angle and offset.

binary int

If not zero write in binary format.

binary_stream str

Name of the file where to write particles to as a binary stream.

losses int

If not zero write also the lost particles into the file.

seed int

Seed to be used for transforming slices to rays.

type int

If 1 the particles distribution in energy and z comes from continuous slices.

rotate_x float

rotate the bunch in the s x plane [rad].

rotate_y float

rotate the bunch in the s y plane [rad].

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

BeamRead(**command_details)

Run 'BeamRead' command in Placet.

Reads the beam from a file. Before calling 'BeamRead', the beam has to be created

Other Parameters:

Name Type Description
file str

The name of the file to read.

binary int

If not zero read in binary format.

binary_stream str

Name of the file where to read particles from as a binary stream.

beam str

Name of the beam to be read.

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

BeamSaveAll(**command_details)

Run the 'BeamSaveAll' command in Placet.

It saves the macroparticle beam to a file.

Other Parameters:

Name Type Description
file str

File containing beam to be saved.

beam str

Name of the beam to be saved.

header int

If set to 1 write a header into the file.

axis int

If set to 1 subtract the mean position and offset.

binary int

If set to 1 binary data is saved.

bunches int

If set to 1 each bunch is saved in a different file.

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

The output file consists of:

  1. s long position along [um]
  2. weight
  3. energy [GeV]
  4. x [um]
  5. x' [um/m]
  6. y [um]
  7. y' [um/m]
  8. sigma_xx
  9. sigma_xx'
  10. sigma_x'x'
  11. sigma_yy
  12. sigma_yy'
  13. sigma_y'y'
  14. sigma_xy (always 0)
  15. 0
  16. 0
  17. 0

BeamSetToOffset(**command_details)

Run 'BeamSetToOffset' command in Placet.

Offsets the beam according to the given settings.

Other Parameters:

Name Type Description
beam str

The name of the beam.

x float

x in microns.

y float

y in microns.

angle_x float

Horizontal angle in microrads.

angle_y float

Vertical angle in microrads.

start int

First element to misalign the beam at.

end int

Last element to misalign the beam at.

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

BeamlineNew(**command_details)

Run 'BeamlineNew' command in Placet.

It is required to be called before starting declaring the beamline. All the elements declared afterwards are going to be included in the new beamline.

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

BeamlineSet(**command_details)

Run 'BeamlineSet' command in Placet TCL.

Fixes the beamline. This command is used to do some initial calculations. It must be called once but only once for a given beamline in a run.

Other Parameters:

Name Type Description
name str

Name of the beamline to create. Required

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

BpmNumberList(**command_details)

Run the 'BpmNumberList' command in Placet.

It returns the list BPMs IDs.

The following chain is executed:

% set tmp [BpmNumberList]
% puts $tmp
An alternative is the use of Beamline.

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

Returns:

Type Description
List[int]

The list with the BPMs IDs.

BpmReadings(**command_details)

Run the 'BpmReadings' command in Placet.

Reads the reading on the BPMs available in the beamlimne. Before doing so, Placet must run any kind of tracking.

Other Parameters:

Name Type Description
file str

The name of the file to store the bpm readings.

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

BpmRealign(**command_details)

Run the 'BpmRealign' command in Placet TCL.

Realigns the BPMs tranversaly such that their centers are aligned with the current beam orbit.

Other Parameters:

Name Type Description
error_x float

Error in horizontal plane.

error_y float

Error in vertical plane.

bunch int

Which bunch to use as a reference (-1: mean of all bunches).

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

CavityGetPhaseList(**command_details)

Run the 'CavityGetPhaseList' command in Placet.

It returns the list with the cavities' phases.

The following chain is executed:

% set tmp [CavityGetPhaseList]
% puts $tmp

A better alternative is the use of Beamline.

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

Returns:

Type Description
List[float]

The list of the cavities phases.

CavityNumberList(**command_details)

Run the 'CavityNumberList' command in Placet.

It returns the list cavities IDs.

The following chain is executed:

% set tmp [CavityNumberList]
% puts $tmp
An alternative is the use of Beamline.

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

Returns:

Type Description
List[int]

The list with the cavities IDs.

CavitySetGradientList(values_list, **command_details)

Run the 'CavitySetGradientList' command in Placet.

It sets the gradients of the cavities according to the input data. The length of the list must correspond to the number of cavities, otherwise Placet throws an error

A better alternative is the use of Beamline.

Parameters:

Name Type Description Default
values_list

The list with cavities gradients

required

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

CavitySetPhaseList(values_list, **command_details)

Run the 'CavitySetPhaseList' command in Placet.

It sets the phases of the cavities according to the input data. The length of the list must correspond to the number of cavities, otherwise Placet would throw an error

A better alternative is the use of Beamline.

Parameters:

Name Type Description Default
values_list List[float]

The list with cavities gradients.

required

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

Clic(**command_details)

Run 'Clic' command in Placet.

It sets the beamline misalignment according to the CLIC setup.

Other Parameters:

Name Type Description
start int

The ID of the first element to apply the misalignments.

end int

The ID of the last element to apply the misalignments.

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

CollimatorNumberList(**command_details)

Run the 'CollimatorNumberList' command in Placet.

It returns the list collimators IDs.

The following chain is executed:

% set tmp [CollimatorNumberList]
% puts $tmp

An alternative is the use of Beamline.

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

Returns:

Type Description
List[int]

The list with the colimators IDs.

DipoleNumberList(**command_details)

Run the 'DipoleNumberList' command in Placet.

It returns the list dipoles IDs.

The following chain is executed:

% set tmp [DipoleNumberList]
% puts $tmp

An alternative is the use of Beamline.

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

Returns:

Type Description
List[int]

The list with the dipoles IDs.

ElementAddOffset(index, **command_details)

Run 'ElementAddOffset' command in Placet.

Adds the given offsets to the current ones of the given element.

Parameters:

Name Type Description Default
index

The element ID.

required

Other Parameters:

Name Type Description
x float

Horizontal offset.

y float

Vertical offset.

xp float

Horizontal offset in angle [urad].

yp float

Vertical offset in angle [urad].

roll float

Roll angle [urad].

angle_x float

Same as -xp [backward compatibility].

angle_y float

Same as -yp [backward compatibility].

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

ElementGetAttribute(element_id, parameter, **command_details)

Run 'ElementGetAttribute' command in Placet.

It extracts the value of the element's parameter with the given id.

A better alternative is the use of Beamline.

Parameters:

Name Type Description Default
element_id int

ID of an element.

required
parameter str

Parameter to extract

required

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

Returns:

Type Description
float

The extracted value.

ElementSetAttributes(element_id, **command_details)

Run 'ElementSetAttributes' command in Placet.

It sets the given parameters in command_details to the given element.

The full list of the possible arguments (depends on the element type) is:

['name', 's', 'x', 'y', 'xp', 'yp', 'roll', 'length', 'synrad', 'six_dim', 'thin_lens', 'e0', 'aperture_x', 'aperture_y', 'aperture_losses', 'aperture_shape',
'strength', 'tilt', 'hcorrector', 'hcorrector_step_size', 'vcorrector', 'vcorrector_step_size', 'angle', 'E1', 'E2', 'K', 'K2', 'resolution', 'reading_x', 
'reading_y', 'scale_x', 'scale_y', 'store_bunches', 'gradient', 'phase', 'type', 'lambda', 'frequency', 'strength_x', 'strength_y', 'steps']

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

ElementSetToOffset(index, **command_details)

Run 'ElementSetToOffset' command in Placet.

Sets the given offsets to a given element.

Parameters:

Name Type Description Default
index int

The element ID.

required

Other Parameters:

Name Type Description
x float

Horizontal offset.

y float

Vertical offset.

xp float

Horizontal offset in angle [urad].

yp float

Vertical offset in angle [urad].

roll float

Roll angle [urad].

angle_x float

Same as -xp [backward compatibility].

angle_y float

Same as -yp [backward compatibility].

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

FirstOrder(**command_details)

Run "FirstOrder" command in Placet.

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

GetTransferMatrix(**command_details)

Run'GetTransferMatrix' command in Placet.

Evaluates the transfer matrix between the given elements.

The foolowing chain is executed:

% set tmp [GetTransferMatrix ..]
% puts $tmp

Other Parameters:

Name Type Description
beamline str

Name of the beamline to be saved. Required

start int

Element to start from.

end int

Element to end to.

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

Returns:

Type Description
List[float]

Resulting transfer matrix.

InjectorBeam(beam_name, **command_details)

Run the 'InjectorBeam' command in Placet.

Creates a new macroparticle beam in Placet based on the template of the InjectorBeam. It is typically used to create any type of beam.

The list of parameters is taken from Placet manual.

Other Parameters:

Name Type Description
macroparticles int

Number of macroparticles per slice.

silent int (?)

Suppress output at beam creation.

energyspread float

Energy spread of initial beam, minus value is linear spread, positive gaussian spread.

ecut float

Cut of the energy spread of initial beam.

energy_distribution float

Energy distribution of initial beam.

file str

Filename for the single bunch parameters.

bunches int

Number of bunches.

chargelist str

List of bunch charges (required).

slices int

Number of slices.

e0 float

Beam energy at entrance.

charge float

Bunch charge.

particles int

Number of particles for particle beam.

last_wgt float

Weight of the last bunch for the emittance.

distance float

Bunch distance.

overlapp float

Bunch overlap.

phase float

Bunch phase.

wake_scale_t float

Wakefield scaling transverse.

wake_scale_l float

Wakefield scaling longitudinal.

beta_x float

Horizontal beta function at entrance (required).

alpha_x float

Horizontal alpha at entrance (required).

emitt_x float

Horizontal emittance at entrance (required).

beta_y float

Vertical beta function at entrance (required).

alpha_y float

Vertical alpha at entrance (required).

emitt_y float

Vertical emittance at entrance (required).

beamload int

Spline containing the longtudinal beam loading.

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

InterGirderMove(**command_details)

Run the 'InterGirderMove' command in Placet.

It sets the alignment properties of the girder endpoints wrt the reference wire and itselves.

Other Parameters:

Name Type Description
scatter_x float

Sigma of Gaussian scattering in x view of the intersubsections between girders [micrometers].

scatter_y float

Sigma of Gaussian scattering in y view of the intersubsections between girders [micrometers].

flo_x float

Sigma of Gaussian scattering in x view of the girder connection around the intersubsection point [micrometers].

flo_y float

Sigma of Gaussian scattering in y view of the girder connection around the intersubsection point [micrometers].

cav_only int

If not zero move only the cavities on the girder.

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

MoveGirder(**command_details)

Run 'MoveGirder' command in Placet.

Other Parameters:

Name Type Description
file str

File to read.

vertical_only int

If not 0 only vertical plane is in the file.

binary int

If not 0 read as binary file.

scale float

Scaling factor for the motion.

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

MultipoleNumberList(**command_details)

Run the 'MultipoleNumberList' command in Placet.

It returns the list multipoles IDs.

The following chain is executed:

% set tmp [MultipoleNumberList -orded order]
% puts $tmp

An alternative is the use of Beamline.

Other Parameters:

Name Type Description
order int

Order of the multipoles. Required

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

Returns:

Type Description
List[int]

The list with the multipoles IDs.

QuadrupoleGetStrength(quad_number, **command_details)

Run 'QuadrupoleGetStrength' command in Placet.

It returns the strength of the quadrupole with the given number.

The following chain is executed:

% set tmp [QuadrupoleGetStrength quad_number]
% puts $tmp

A better alternative is the use of Beamline.

Parameters:

Name Type Description Default
quad_number int

The quad ID.

required

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

Returns:

Type Description
float

Quadrupole strength.

Needs to be verified!

QuadrupoleNumberList(**command_details)

Run the 'QuadrupoleNumberList' command in Placet.

It returns the list quadrupoles IDs.

The following chain is executed:

% set tmp [QuadrupoleNumberList]
% puts $tmp
An alternative is the use of Beamline.

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

Returns:

Type Description
List[int]

The list with the quadrupoles IDs.

QuadrupoleSetStrength(quad_number, value, **command_details)

Run 'QuadrupoleSetStrength' command in Placet.

It sets the given strength os the quadrupole of the given number.

Parameters:

Name Type Description Default
quad_number int

The quadrupole ID.

required
value float

Quadrupole new strengths.

required

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

QuadrupoleSetStrengthList(values_list, **command_details)

Run the 'QuadrupoleSetStrengthList' in Placet.

It sets the strengths of the quadrupoles according to the input data. The length of the list must correspond to the number of cavities, otherwise Placet throws an error.

A better alternative is the use of Beamline.

Parameters:

Name Type Description Default
values_list List[float]

The list with the quadrupoles strengths.

required

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

RandomReset(**command_details)

Run the 'RandomReset' command in Placet.

Resets the errors seed number in Placet.

Other Parameters:

Name Type Description
seed int

The seed number to set.

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

ReadAllPositions(**command_details)

Run 'ReadAllPositions' command in Placet.

Reads the elements' positions from a file and applies them to a beamline.

Other Parameters:

Name Type Description
file str

Filename to read. Required

binary int

If not 0 read as binary file.

nodrift int

If not 0 drift positions are not read.

nomultipole int

If not 0, multipoles are not read.

vertical_only int

If not 0 only vertical information are read.

positions_only int

If not 0 only positions are read.

cav_bpm int

If not 0 positions of structure BPMs are read.

cav_grad_phas int

If not 0 gradient and phase of structure are read.

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

SaveAllPositions(**command_details)

Run 'SaveAllPositions' command in Placet.

It saves all the elements positions into a file.

Other Parameters:

Name Type Description
file str

Filename to write. Required

binary int

If not 0 save as binary file.

nodrift int

If not 0 drift positions will not be saved.

vertical_only int

If not 0 only vertical information will be saved.

positions_only int

If not 0 only positions will be saved.

cav_bpm int

If not 0 positions of structure BPMs will be saved.

cav_grad_phas int

If not 0 gradient and phase of structure will be saved.

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

SetRfGradientSingle(beam_name, var1, l)

Run 'SetRFGradientSingle' command in Placet.

This function is not documented. Placet sources are not clear either. It is wrapped as it is.

Parameters:

Name Type Description Default
beam_name str

Beam name.

required
var1 float

No idea.

required
l float

No idea.

required

SurveyErrorSet(**command_details)

Run 'SurveyErrorSet' command in Placet.

It sets the alignment errors for the beamline.
When the command is invoked - it overwrittes the values already in memory. That means if one calls it with cavity_y = 5.0 that means that cavity_y property will be overwritten, others will be kept unchanged. So the values not declared are zeros by default.

The descriptions taken from the Placet Manual

Other Parameters:

Name Type Description
quadrupole_x float

Horizontal quadrupole position error [micro m].

quadrupole_y float

Vertical quadrupole position error [micro m].

quadrupole_xp float

Horizontal quadrupole angle error [micro radian].

quadrupole_yp float

Vertical quadrupole angle error [micro radian].

quadrupole_roll float

Quadrupole roll around longitudinal axis [micro radian].

cavity_x float

Horizontal structure position error [micro m].

cavity_realign_x float

Horizontal structure position error after realignment [micro m].

cavity_y float

Vertical structure position error [micro m].

cavity_realign_y float

Vertical structure position error after realignment [micro m].

cavity_xp float

Horizontal structure angle error [micro radian].

cavity_yp float

Vertical structure angle error [micro radian].

cavity_dipole_x float

Horizontal dipole kick [rad*GeV].

cavity_dipole_y float

Vertical dipole kick [rad*GeV].

piece_x float

Horizontal structure piece error [micro m].

piece_xp float

Horizontal structure piece angle error [micro radian].

piece_y float

Vertical structure piece error [micro m].

piece_yp float

Vertical structure piece angle error [micro radian].

bpm_x float

Horizontal BPM position error [micro m].

bpm_y float

Vertical BPM position error [micro m].

bpm_xp float

Horizontal BPM angle error [micro radian].

bpm_yp float

Vertical BPM angle error [micro radian].

bpm_roll float

BPM roll around longitudinal axis [micro radian].

sbend_x float

Horizontal sbend position error [micro m].

sbend_y float

Vertical sbend position error [micro m].

sbend_xp float

Horizontal sbend angle error [micro radian].

sbend_yp float

Vertical sbend angle error [micro radian].

sbend_roll float

Sbend roll around longitudinal axis [micro radian].

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

TclCall(**command_details)

Run the 'TclCall' command in Placet.

Essentially sets up the callback function for the tracking. Not sure when it is invoked (entrance or exit). It works for the beamline ext though.

Other Parameters:

Name Type Description
script str

The name of the script to be used as a callback.

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

TestFreeCorrection(**command_details)

    Corresponds to 'TestFreeCorrection' command in Placet TCL

    The full list of the command parameters:
    machines                                - Number of machines to simulate
    binlength                               - Number of quadrupoles per bin
    binoverlap                              - Overlap of bins in no of quadrupoles
    jitter_y                                - Vertical beam jitter
    jitter_x                                - Horizontal beam jitter
    bpm_resolution                  - BPM resolution
    rf_align                                - Align the RF after the correction?
    beam                                    - Name of the beam to be used for correction
    survey                                  - Type of prealignment survey to be used (default Clic)
    emitt_file                              - Filename for the results (default NULL)
    wgt0                                    - Weight for the BPM position
    wgt1                                    - Weight for the BPM resolution
    pwgt                                    - Weight for the old quadrupole position
    quad_set0                               - List of quadrupole strengths to be used
    quad_set1                               - List of quadrupole strengths to be used
    quad_set2                               - List of quadrupole strengths to be used
    load_bins                               - File with bin information to be loaded
    save_bins                               - File with bin information to be loaded
TO DO
    Add description

Not tested

TestMeasuredCorrection(**command_details)

Run the 'TestMeasuredCorrection' command in Placet.

It performes a complicated (and not obvious) correction of the beamline alignment. Normally is used for the DFS.

The parameters' description is taken from the Placet Manual.

Other Parameters:

Name Type Description
machines int

Number of machines to simulate. Default is 1.

start int

First element to be corrected.

end int

Last element but one to be corrected (<0: go to the end).

binlength int

Number of quadrupoles per bin.

correct_full_bin int

If not zero the whole bin will be corrected.

binoverlap int

Overlap of bins in no of quadrupoles.

jitter_x float

Vertical beam jitter [micro meter].

jitter_y float

Horizontal beam jitter [micro meter].

bpm_resolution float

BPM resolution [micro meter].

rf_align int(?)

Align the RF after the correction. (?)

no_acc int(?)

Switch RF off in corrected subsection. (?)

beam0 str

Name of the main beam to be used for correction.

beam1 str

Name of the first help beam to be used for correction.

beam2 str

Name of the second help beam to be used for correction.

cbeam0 str

Name of the main beam to be used for correction.

cbeam1 str

Name of the first help beam to be used for correction.

cbeam2 str

Name of the second help beam to be used for correction.

gradient1 float

Gradient for beam1.

gradient2 float

Gradient for beam2.

survey str

Type of prealignment survey to be used defaults to CLIC.

emitt_file str

Filename for the results defaults to NULL (no output).

wgt0 float

Weight for the BPM position.

wgt1 float

Weight for the BPM resolution.

wgt2 float

Second weight for the BPM resolution.

pwgt float

Weight for the old position.

quad_set0 list(?)

List of quadrupole strengths to be used.

quad_set1 list(?)

List of quadrupole strengths to be used.

quad_set2 list(?)

List of quadrupole strengths to be used.

load_bins str

File with bin information to be loaded.

save_bins str

File with bin information to be stored.

gradient_list0 list(?)

Cavity gradients for beam 0.

gradient_list1 list(?)

Cavity gradients for beam 1.

gradient_list2 list(?)

Cavity gradients for beam 2.

bin_iterations int

Number of iterations for each bin.

beamline_iterations int

Number of iterations for each machine.

correctors list

List of correctors to be used.

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

Returns:

Type Description
DataFrame

The tracking results after running TestSimpleCorrection

The columns of the resulting DataFrame: ['correction', 'beam', 'survey', 'positions_file', 'emittx', 'emitty']

The number of rows correspond to the number of the machines simulated.

TestNoCorrection(**command_details)

Run the 'TestNoCorrection' command in Placet.

It is used to do the beam tracking without applying any corrections.

The default time to executing each command in the chain here is set to 20s (might be changed later). Parameters' description is taken from Placet manual.

Other Parameters:

Name Type Description
machines int

Number of machines to simulate. Defauls is 1.

beam str

Name of the beam to be used for tracking. Required

survey str

Type of prealignment survey to be used. Default is None. It could be either built-in surveys from Placet, like

["None", "Zero", "Clic", "Nlc", "Atl", "AtlZero", "Atl2", "AtlZero2,
"Earth"]
or any procedure that was declared in Placet prior to the current function call. The list of Placet built-in surveys can be accessed at Placet.surveys.

emitt_file str

Filename for the results' file. Defaults to NULL (no output).

bpm_res float

BPM resolution. Default is 0.0.

format float

Format of the file output. (?)

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

Returns:

Type Description
DataFrame

The tracking results after running TestNoCorrection.

The columns of the resulting DataFrame: ['correction', 'beam', 'survey', 'positions_file', 'emittx', 'emitty'] The number of rows correspond to the number of the machines simulated.

TestRfAlignment(**command_details)

Run the 'TestRfAlignment' command in Placet.

It performs the RF alignment on the beamline.

The command TestRfAlignment does not produce any output inside Placet.

Other Parameters:

Name Type Description
beam str

Name of the beam to be used for correction. Required

testbeam str

Name of the beam to be used for evaluating the corrected beamline.

machines int

Number of machines.

binlength int

Length of the correction bins.

wgt0 float

Weight for the BPM position.

wgt1 float

Weight for the BPM resolution.

pwgt float

Weight for the old position.

girder int

Girder alignment model: 0 - none; 1 - per girder; 2 - per bin

bpm_resolution float

BPM resolution [micro meter].

survey str

Type of prealignment survey to be used.

emitt_file str

Filename for the results defaults to NULL (no output).

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

TestSimpleCorrection(**command_details)

Run the 'TestSimpleCorrection' command in Placet.

It is used to apply the one-to-one (1-2-1) alignmet to the beamline.

The default time to executing each command in the chain is set to 120s (might be changed later). Parameters' description is taken from the Placet manual.

Other Parameters:

Name Type Description
beam str

Name of the beam to be used for correction. Required

machines int

Number of machines to simulate. Default is 1.

start int

First element to be corrected.

end int

Last element but one to be corrected (<0: go to the end).

interleave int

Used to switch on interleaved bins (correcting only focusing quadrupoles). (?)

binlength int

Number of quadrupoles per bin.

binoverlap int

Overlap of bins in no of quadrupoles.

jitter_x float

Vertical beam jitter [micro meter].

jitter_y float

Horizontal beam jitter [micro meter].

bpm_resolution float

BPM resolution [micro meter].

testbeam str

Name of the beam to be used for evaluating the corrected beamline.

survey str

Type of prealignment survey to be used.

emitt_file str

Filename for the results.

bin_last str

Filename for the results.

bin_file_out str

Filename for the bin information.

bin_file_in str

Filename for the bin information.

correctors list

List of correctors to be used.

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

Returns:

Type Description
DataFrame

The tracking results after running TestSimpleCorrection

The columns of the resulting DataFrame: ['correction', 'beam', 'survey', 'positions_file', 'emittx', 'emitty']

The number of rows correspond to the number of the machines simulated.

TwissMain(**command_details)

Run 'TwissMain' command in Placet.

Not sure if it even works. Last checks showed it produces a blank file.

Other Parameters:

Name Type Description
file str

The name of the file to write the Twiss.

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

TwissPlotStep(**command_details)

Run "TwissPlotStep" command in Placet.

Evaluates the Twiss parameters along the beamline and saves them into a file.

Other Parameters:

Name Type Description
beam str

Name of the beam to use for the calculation. Required

file str

Name of the file where to store the results.

step float

Step size to be taken for the calculation. If less than 0 the parameters will be plotted only in the centres of the quadrupoles.

start int

(?) First particle for twiss computation.

end int

(?) Last particle for twiss computation.

list List[int]

Save the twiss parameters only at the selected elements.

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

The output file produces with this command is composed of:

  1. Element number .
  2. s: [m] Distance in the beam line.
  3. E(s): energy [GeV] ( central slice or average energy for particle beam).
  4. beta_x_m(s) [m] (of central slice ).
  5. alpha_x_m(s) [m] (of central slice ).
  6. beta_x_i(s) [m] (of average over slices).
  7. alpha_x_i(s) [m] (of average over slices).
  8. beta_y_m(s) [m] (of central slice ).
  9. alpha_y_m(s) [m] (of central slice ).
  10. beta_y_i(s) [m] (of average over slices).
  11. alpha_y_i(s) [m] (of average over slices).
  12. disp_x(s) [m/GeV] (of average over slices).
  13. disp_xp(s) [rad/GeV] (of average over slices).
  14. disp_y(s) [m/GeV] (of average over slices).
  15. disp_yp(s) [rad/GeV] (of average over slices).

WriteGirderLength(**command_details)

Run 'WriteGirderLength' command in Placet.

Needs to checked

Zero(**command_details)

Run 'Zero' command in Placet.

It resets the beamline misalignments to zeros.

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

__construct_command(command, command_params, **command_details)

Generic function for creating a PlacetCommand.

  • The Placet command is constructed and the command parameters are extracted from command_details.
  • The computing/parsing details of the command are extracted from command_details, based on the Placet._exec_params

Parameters:

Name Type Description Default
command str

Command name.

required
command_params List[str]

The full list of the arguments the corresponding command in the Placet TCL can take.

required

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters

__set_puts_command(command, command_params, **command_details)

Generic function for executing the "set-put" chain of commands in Placet.

Eg:

set tmp [command param1 param2 ..]
puts $tmp
The data read with the last puts is returned.

Parameters:

Name Type Description Default
command str

Command name.

required
command_params List[str]

The full list of the arguments the corresponding command in the Placet can take.

required

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters

declare_proc(proc, **command_details)

Declare a custom procedure in Placet.

Parameters:

Name Type Description Default
proc Callable

The function in Python.

The content of the created procedure consists of the Placet commands that Python runs. The parameter addditional_lineskip = 0 is passed, since the commands within proc() environment in Placet do not produce any output.

The function used for proc declaration should not have any return value, otherwise the execution is going to be blocked.

required

Other Parameters:

Name Type Description
name str

Name of the created procedure in Placet. If is not defined, the proc.__name__ is used as the name.

Other arguments accepted are inherited from PlacetCommand but some of them will be forcely overwritten. See the list optional parameters.

get_element_transverse_matrix(index, **command_details)

Evaluate the Transfer matrix of a given element.

Parameters:

Name Type Description Default
index int

An element ID.

required

Other Parameters:

Name Type Description
beamline str

A name of the beamline.

Returns:

Type Description
List[float]

Resulting transfer matrix.

puts(variable, **command_details)

Run the 'puts' command in Placet.

Prints the given variable in Placet, reads it and returns.

Parameters:

Name Type Description Default
variable str

Variable to evaluate

required

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

Returns:

Type Description
str

The value Placet returned.

set(variable, value, **command_details)

Run 'set' command in TCL.

Set the given variable to the given value in Placet.

Parameters:

Name Type Description Default
variable str

Variable to to be set.

required
value float

The value the variable to be set to.

required

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

Returns:

Type Description
value

The value that was set.

set_list(name, **command_details)

Declare the dictionary in Placet

Parameters:

Name Type Description Default
name str

Name of the dictionary.

required

All the keyword variables provided are going to be declared int the dictionary in Placet.

source(filename, **command_details)

Run the 'source' command in Placet.

'Sources' the given file into Placet.

Parameters:

Name Type Description Default
filename str

Name of the file to read.

required

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

wake_calc(filename, charge, a, b, sigma_z, n_slices, **command_details)

Run a custom function calc{} from "wake_calc.tcl" in Placet.

It is used to evaluate the wakefields and write the output to a file. The resulting file contains the slices weights and wakefiled parameters.

Parameters:

Name Type Description Default
filename str

The name of the file to produce.

required
charge float

The bunch charge.

required
a float

To check.

required
b float

To check.

required
sigma_z float

Bunch length in microns.

required
n_slices int

Number of slices.

required

Other arguments accepted are inherited from PlacetCommand. See the list optional parameters.

Returns:

Type Description
str

The name of the generated file.