User guide#
The following pages describe how to use Xplt for plotting of data from Xsuite or simmilar accelerator physics codes.
Contents
Tip
Xsuite is not an explicit dependency, rather an API assumption on available attributes, indices and units. You can use data from any source, and also custom attributes. See Common concepts on how to specify units of custom attributes.
import xplt
xplt.apply_style() # use our matplotlib style sheet
import numpy as np
import pandas as pd
# Dictionary
particles = dict(
x = np.random.normal(size=int(1e5)), # in m
px = np.random.normal(size=int(1e5)), # in rad
a = np.random.normal(size=int(1e5)), # custom attribute
)
xplt.PhaseSpacePlot(particles, kind='x-px', data_unit=dict(a="km"))
# Pandas DataFrame
df = pd.DataFrame(particles)
xplt.PhaseSpacePlot(df, kind='x-px')
...