SimulationFramework.Modules.plotting package

Submodules

SimulationFramework.Modules.plotting.latticeDraw module

class latticeDraw(element_positions)[source]

Bases: object

colorwidths = {'aperture': ('k', 0.3), 'beam_position_monitor': ((100, 100, 100), 0.2), 'cavity': ('g', 0.35), 'collimator': ('k', 0.2), 'dipole': ('b', 0.5), 'kicker': ('m', 0.25), 'line': ('k', 0.05), 'quadrupole': ('r', 0.6), 'screen': ((150, 150, 100), 0.3), 'solenoid': ('c', 0.4), 'wall_current_monitor': ((100, 100, 200), 0.2)}
defineElements()[source]
property offset
property scale
class lineElement(start, end, color='g', width=1, scale=1)[source]

Bases: GraphicsObject

boundingRect(self) QRectF[source]
generatePicture()[source]
paint(self, painter: QPainter | None, option: QStyleOptionGraphicsItem | None, widget: QWidget | None = None)[source]
setOffset(offset)[source]
setScale(self, scale: float)[source]
class rectangleElement(start, end, color='g', width=1, scale=1)[source]

Bases: GraphicsObject

boundingRect(self) QRectF[source]
generatePicture()[source]
paint(self, painter: QPainter | None, option: QStyleOptionGraphicsItem | None, widget: QWidget | None = None)[source]
setOffset(offset)[source]
setScale(self, scale: float)[source]

SimulationFramework.Modules.plotting.multiAxisPlot module

main()[source]
class mainWindow[source]

Bases: QMainWindow

class multiAxisPlotWidget(**kwargs)[source]

Bases: QWidget

QWidget containing pyqtgraph plot showing beam parameters

addCurve(x, y, name, label, pen)[source]
addShadowPen(name)[source]
colors = [<PyQt5.QtGui.QColor object>, <PyQt5.QtGui.QColor object>, <PyQt5.QtGui.QColor object>, <PyQt5.QtGui.QColor object>, <PyQt5.QtGui.QColor object>, 'r', 'k', 'm', 'g']
highlightPlot(name)[source]

highlights a particular plot

plotParams = []
removeCurve(directory, filename=None)[source]

finds all multiaxis curves based on a set of names, and removes them

setPenAlpha(name, alpha=255, width=3)[source]
styles = [1, 2, 3, 4, 5]
updateMultiAxisPlot()[source]

update main plot

updateViews()[source]

SimulationFramework.Modules.plotting.multiPlot module

main()[source]
class mainWindow[source]

Bases: QMainWindow

class multiPlotWidget(xmin=None, ymin=None, xlabel=None, xlabelunits=None, setTitles=True, **kwargs)[source]

Bases: QWidget

QWidget containing various Twiss plots

addCurve(x, y, name, label, pen)[source]

adds a curve to the main plot

addShadowPen(name)[source]

add/remove a shadow pen to a given plot curve

add_lattice_plot(elementlist)[source]
clear()[source]
clearCurves()[source]
colors = [<PyQt5.QtGui.QColor object>, <PyQt5.QtGui.QColor object>, <PyQt5.QtGui.QColor object>, <PyQt5.QtGui.QColor object>, <PyQt5.QtGui.QColor object>, 'r', 'k', 'm', 'g']
curveClicked(name)[source]
highlightCurveSignal

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

highlightPlot(name)[source]

highlights a particular plot

multiPlotLattice

[individual plotItems for each twiss plot,]}

Type:

curves - a dictionary containing {directory

multiPlotWidgets

multiPlotLattice - holds the lattice items for each Twiss plot

plotParams = []
reScaleLattice(p)[source]
removeCurve(name)[source]

finds all curves based on a key name, and removes them

removeData(name)[source]
removeShadowPen(name)[source]

add/remove a shadow pen to a given plot curve

setPenAlpha(name, alpha=255, width=3)[source]

change the alpha channel and width of a curves pen

set_horizontal_axis_label(label=None, units=None)[source]
styles = [1, 2, 3, 4, 5]
unHighlightCurveSignal

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

unHighlightPlot(name)[source]

highlights a particular plot

updateCurve(x, y, name, label)[source]

updates a curve to the main plot

updateCurveHighlights()[source]

SimulationFramework.Modules.plotting.plotting module

ASTRA_TW_FieldMap(fielddat, start, stop, cells, p)[source]
add_fieldmaps_to_axes(lattice, axes, bounds=None, sections='All', fields=['cavity', 'solenoid'], include_labels=True, verbose=False)[source]

Adds fieldmaps to an axes.

add_magnets_to_axes(lattice, axes, bounds=None, sections='All', magnets=['quadrupole', 'dipole', 'sextupole', 'beam_position_monitor', 'screen'], include_labels=True, kinetic_energy=None, verbose=False)[source]

Adds magnets to an axes.

fieldmap_data(element)[source]

Loads the fieldmap in absolute coordinates.

If a fieldmaps dict is given, these will be used instead of loading the file.

find_nearest(array, value)[source]
general_plot(framework_object, ykeys=[], ykeys2=[], xkey='z', limits=None, nice=True, include_layout=False, include_labels=True, include_legend=True, include_particles=False, fields=['cavity', 'solenoid'], magnets=['quadrupole', 'dipole', 'beam_position_monitor', 'screen', 'wall_current_monitor', 'aperture'], grid=False, **kwargs)[source]
getattrsplit(self, attr)[source]
load_elements(lattice, bounds=None, sections='All', types=['cavity', 'solenoid'], kinetic_energy=None, verbose=False, scale=1)[source]
class magnet_plotting_data(kinetic_energy=None)[source]

Bases: object

aperture(e)[source]
beam_position_monitor(e)[source]
dipole(e)[source]
full_rectangle(e, half_height, width=0)[source]
half_rectangle(e, half_height)[source]
quadrupole(e)[source]
screen(e)[source]
sextupole(e)[source]
wall_current_monitor(e)[source]
plot(framework_object, ykeys=['sigma_x', 'sigma_y'], ykeys2=['sigma_z'], xkey='z', limits=None, nice=True, include_layout=False, include_labels=True, include_legend=True, include_particles=False, fields=['cavity', 'solenoid'], magnets=['quadrupole', 'dipole', 'beam_position_monitor', 'screen', 'wall_current_monitor', 'aperture'], grid=False, **kwargs)[source]

Plots stat output multiple keys.

If a list of ykeys2 is given, these will be put on the right hand axis. This can also be given as a single key.

Logical switches, all default to True:

nice: a nice SI prefix and scaling will be used to make the numbers reasonably sized.

include_legend: The plot will include the legend

include_layout: the layout plot will be displayed at the bottom

include_labels: the layout will include element labels.

Copied almost verbatim from lume-impact’s Impact.plot.plot_stats_with_layout

plot_fieldmaps(lattice, sections='All', include_labels=True, limits=None, figsize=(12, 4), fields=['cavity', 'solenoid'], magnets=['quadrupole', 'dipole', 'beam_position_monitor', 'screen'], **kwargs)[source]

Simple fieldmap plot

trans(M)[source]

Module contents