ess.lib_tw¶
Main description of this module is not written yet
API Documentation¶
Classes and functions for TraceWin
Note for clean-up
Old LATTICE and MATCH classes can be deleted once trajectory correction is established with new classes.
-
class
ess.lib_tw.
DENSITY
(file_name)[source]¶ Note instances are not identical for Nrun=1 and Nrun>1.
Be careful with # of steps for an envelope file.
When Nrun>1, ave and rms in a file are sum and squared sum.
Double check before a production !!!!
Dim of arrays:
Nelem(Nidx): idx_elem, s, Nptcl, Ibeam
4 x Nelem(Nidx): apt # x, y, dx, dy 3 x Nelem(Nidx): accpt # phs+, phs-, ken 7 x Nelem(Nidx): cent_(..), sig, xmax, xmin # x, y, phs, ken, r, z, dpp 3 x Nelem(Nidx): eps # x, y, phs
Nrun x Nelem: loss Nelem : loss_num_(..), loss_pow_(..)
Nelem x Nstep: den
History:
2015.11.12: Baseline ver
2016.03.29: Adapted to ver 9 (apt includes shifts)
-
class
ess.lib_tw.
DST
(file_name, unit_x='cm', unit_px='rad', unit_z='rad', unit_pz='MeV')[source]¶ Class for a TraceWin’s .dst file.
TraceWin seems using beta and gamma for each particle so the conversion to (z,z’) is based on this assumption.
2015.10.06
-
class
ess.lib_tw.
PARTRAN
(file_name)[source]¶ Note:
The list not complete. Add parameters as needed.
History:
2016-02-17: Changed how to identify the line of indices.
2016-02-17: Added a logic to avoid #/0 for LEBT.
2020-08-28: Adopted to python3.
2020-08-28: 99% emittance added.
2020-08-28: alfz was wrong (in power of gamma) and fixed.
-
class
ess.lib_tw.
PROJECT
(file_name_proj='proj.ini')[source]¶ This is for running multiple simulations 1-by-1 under 1 project.
Maybe not very useful…
2015.10.15
-
ess.lib_tw.
loss_elem2den
(s, loss, file_name_dt='', dlt_dt=5e-06)[source]¶ This function calculates loss density [W/m] from s and loss together with the file of the DTL’s cell and DT lengths.
2016.01.15
-
ess.lib_tw.
partran_end_all
(file_name_in_all, file_name_out)[source]¶ Reads multiple partran1.out files and extracts the data at the end.
The same format as partran1.out allows to be used by PARTRAN class.
The elem # is replaced with the file #.
2015.11.25
-
ess.lib_tw.
plt2x
(path_file)[source]¶ Extract x and etc from a TraceWin’s binary .plt file. The units are (cm,rad,cm,rad,rad,MeV,loss).
Output: x (Nelem,Nptcl,7)
For binary characters see https://docs.python.org/2/library/struct.html
2014.10.06
-
ess.lib_tw.
x2dst
(x, mass, freq, Ibeam, path_file='part_dtl1_new.dst')[source]¶ Output a TraceWin’s .dst file from x and etc.
Input: x (Nptcl,6)
For binary characters see https://docs.python.org/2/library/struct.html
2014.10.03
-
ess.lib_tw.
x2plt
(x, mass, freq, Ibeam, i_unk, i_elem, s, phs, ken, path_file='dtl1_new.plt')[source]¶ Output a TraceWin’s .plt file from x and etc.
Input: x (Nelem,Nptcl,7)
For binary characters see https://docs.python.org/2/library/struct.html
2014.10.07