R. De Maria, Michi Hostettler, Guido Sterbini
Swan has been used to perform machine studies since the its very begginng using:
With time new packages interacting with accelerator data have been introduced in LCG and therefore usable for all users:
pytimber
wraps the accellent CALS (Cern Accelerator Logging Service) Java API to extract any machine measurements available in the Logging database.
jpype
to instantiate a JVM and execute Java Codecmmnbuild-dep-manager
(T. Levens et al.) to resolve the Java dependencies of CALS (and other CO libraries) and instantiate Jpype pip install pytimber
) but needs to be used within the CERN networkimport pytimber
db=pytimber.LoggingDB()
atlas='ATLAS:LUMI_TOT_INST'
data=db.get([atlas],'2018-09-10 4:00:00','2018-09-10 18:00:00')
%matplotlib notebook
import matplotlib.pyplot as plt
t,v=data[atlas]
plt.plot(t,v*1e30*98*1e-27)
plt.ylabel("Collision per second")
pytimber.set_xaxis_date()
...not all useful information for machine studies are stored in CALS...
pjsla is a wrapper of the LSA LHC Software Architecure library and it is used controls the LHC and other machine. Nornally operates in the technical network, but a read-only proxy is available in the from the GPN and therefore Swan.
cmmnbuild-dep-manager
as pytimber
for Java dependencies managementpip install pjlsa
) but needs to be used within the CERN networkimport pjlsa
lsa=pjlsa.LSAClient()
WARNING:cmmnbuild_dep_manager:JVM is already started
ts,data=lsa.getTrims('PHYSICS-6.5TeV-30cm-120s-2018_V1','LHCBEAM/IP5-XING-H-MURAD')['LHCBEAM/IP5-XING-H-MURAD']
print("Timestamp segment values")
for tts, dd in zip(ts,data):
print(pytimber.dumpdate(tts),dd[0], dd[1])
Timestamp segment values 2018-03-11 18:57:47.717 [ 0. 120.] [150. 150.] 2018-03-18 21:06:40.438 [ 0. 120.] [160. 160.]
...we have seen a value of the crossing angle, how can we plot beam trajectories...
cpymad(https://github.com/hibtc/cpymad) is a wrapper of the MAD-X(https://cern.ch/mad) software which allow to perform beam dynamics simulation. MAD-X is written in C and it has a rich (but still limited) scripting abilities. Integration in Python fills the gap for more complex interaction.
cpymad
use cython to access the internal data structure and function in MAD-Xlibmadx
Madx
spawns a sub process instantiating libmadx and comunicate with libmadx through an ad-hoc RPC classpip install cpymad
) and outside CERN/eos/project/a/abpdata/lhc/optics
, but soon a new repository /eos/project/a/acc-model/
will contain all informationfrom cpymad.madx import Madx
madx = Madx(stdout=False) # start MAD-X
#Load models
madx.options.echo=False; madx.options.warn=False
madx.call("/eos/project/a/abpdata/lhc/optics/runII/2018/lhc_as-built.seq")
madx.call("/eos/project/a/abpdata/lhc/optics/runII/2018/PROTON/opticsfile.22_ctpps2")
madx.call("/eos/project/a/abpdata/lhc/optics/runII/2018/toolkit/macro.madx")
madx.options.echo=False;madx.options.warn=True;
# Set energy in GeV
madx.exec_("mk_beam(6500)")
# Set crossing angle
on_x1=150 # same as LHCBEAM/IP5-XING-H-MURAD
madx.use(sequence="lhcb1")
twiss=madx.twiss()
s1=twiss.s;x1=twiss.x
madx.use(sequence="lhcb2")
twiss=madx.twiss()
s2=twiss.s;x2=twiss.x
plt.figure()
plt.plot(s1,x1,label="Beam 1")
plt.plot(s2,x2,label="Beam 1")
plt.xlim(13000,13700)
plt.legend()
plt.xlabel('s [m]')
plt.ylabel('x [m]');
cpymad
is actively maintained by T. Glassle and a new community at CERN is assembling at CERN
sshfs
to access some data sources in technical network (under NFS(. Transfering data to EOS is not a pratical option./scratch/<user>
is a mitigation, but it is volatile and cannot be used to install additional software.