Skip to content
Snippets Groups Projects
Commit c287a490 authored by Ryoichi Miyamoto's avatar Ryoichi Miyamoto
Browse files

An example for loss_elem2den func in lib_tw added.

parent da6cb2ad
No related branches found
No related tags found
No related merge requests found
......@@ -46,6 +46,45 @@ lat.get_tw(file_name_lat_new)
# if lat.lst[i].typ=='STEERER' : lat.lst[i].Bx =0.0; lat.lst[i].By =0.0
```
lib_tw includes a function to convert loss/elem to loss/elem-length. An example:
```
# An example to make a bar plot with an output file of this script can be found in
# https://gitlab01.esss.lu.se/ess-bp/pgfplots-examples/tree/master/loss.den
from ess import lib_tw
file_name_den ='density_file_name'
file_name_ptrn='partran_out_file_name'
file_name_dt ='len.dt_dtl.v85.txt' # File with (half cell length) vs (drift tube length)
#-- An example for a density file
den=DENSITY(file_name_den)
s_from_den =den.s
loss_from_den=den.loss_pow # For a file w/ single run
#loss_from_den=den.loss_pow[Nrun] # For a file w/ multi runs (e.g., file from an error study)
loss_den_from_den=loss_elem2den(s_from_den,loss_from_den,file_name_dt,dtl_dt=5e-6)
# Note:
# - Be careful with the number of runs.
# - The instances for losses are "loss_pow", "loss_num", "loss_pow_ave", and etc for DENSITY class.
# - If file_name_dt isn't given, the half-cell lengths are used in stead of drift-tube lnegths.
# - dlt_dt is a small number used to identify DTL_CEL elements.
#-- An example for a partran out file
ptrn=PARTRAN(file_name_ptrn)
loss_den_from_ptrn=ptrn.loss_den(file_name_dt,dtl_dt=5e-6)
# Note:
# - For PARTRAN class, loss_elem2den function is already implemented as a method.
```
### Library
To be done..
......
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