madgui.widget.twisswidget module

Classes

TwissWidget(session, model[, name, …])

TwissFigure(figure, session, matcher)

A figure containing some X/Y twiss parameters.

CaptureTool(plot)

MatchTool(plot, scene, matcher)

This toolbar item performs (when checked) simple interactive matching via mouse clicks into the plot window.

InfoTool(plot, scene)

Opens info boxes when clicking on an element.

CompareTool(plot, scene)

Display a precomputed reference curve for comparison.

PlotInfo(name, title, curves)

CurveInfo(table, xname, name, label, style)

UserData(name, data, style)

MouseEvent(button, x, y, axes, elem, guiEvent)

KeyboardEvent(key, guiEvent)

class madgui.widget.twisswidget.CaptureTool(plot)[source]

Bases: object

Methods

action()

onToggle(active)

Update enabled state to match the UI.

setChecked(checked)

Attributes

active

bool(x) -> bool

action()[source]
active = False
onToggle(active)[source]

Update enabled state to match the UI.

setChecked(checked)[source]
class madgui.widget.twisswidget.CompareTool(plot, scene)[source]

Bases: object

Display a precomputed reference curve for comparison.

The reference curve is NOT visible by default.

Methods

action()

activate()

Attributes

short

str(object=’’) -> str

text

str(object=’’) -> str

action()[source]
activate()[source]
icon = 23
short = 'Show reference curve'
text = 'Load data file for comparison.'
class madgui.widget.twisswidget.CurveInfo(table, xname, name, label, style)

Bases: tuple

Attributes

label

Alias for field number 3

name

Alias for field number 2

style

Alias for field number 4

table

Alias for field number 0

xname

Alias for field number 1

property label

Alias for field number 3

property name

Alias for field number 2

property style

Alias for field number 4

property table

Alias for field number 0

property xname

Alias for field number 1

class madgui.widget.twisswidget.InfoTool(plot, scene)[source]

Bases: madgui.widget.twisswidget.CaptureTool

Opens info boxes when clicking on an element.

Methods

activate()

Start select mode.

advance_selection(move_step)

deactivate()

Stop select mode.

onClick(event)

Display a popup window with info about the selected element.

onKey(event)

onMotion(event)

Attributes

mode

str(object=’’) -> str

short

str(object=’’) -> str

text

str(object=’’) -> str

activate()[source]

Start select mode.

advance_selection(move_step)[source]
deactivate()[source]

Stop select mode.

icon = 9
mode = 'INFO'
onClick(event)[source]

Display a popup window with info about the selected element.

onKey(event)[source]
onMotion(event)[source]
short = 'element info'
text = 'Show element info boxes'
class madgui.widget.twisswidget.KeyboardEvent(key, guiEvent)

Bases: tuple

Attributes

guiEvent

Alias for field number 1

key

Alias for field number 0

property guiEvent

Alias for field number 1

property key

Alias for field number 0

class madgui.widget.twisswidget.MatchTool(plot, scene, matcher)[source]

Bases: madgui.widget.twisswidget.CaptureTool

This toolbar item performs (when checked) simple interactive matching via mouse clicks into the plot window.

Methods

activate()

Start matching mode.

addConstraints(constraints)

Add constraint and perform matching.

add_constraint(event, name)

Add constraint at cursor location.

clearConstraints()

Remove all constraints.

deactivate()

Stop matching mode.

onClick(event)

Handle clicks into the figure in matching mode.

removeConstraint(elem, axis)

Remove the constraint for elem.

remove_constraint(event, name)

Remove constraint nearest to cursor location.

Attributes

icon

mode

str(object=’’) -> str

short

str(object=’’) -> str

text

str(object=’’) -> str

activate()[source]

Start matching mode.

addConstraints(constraints)[source]

Add constraint and perform matching.

add_constraint(event, name)[source]

Add constraint at cursor location.

clearConstraints()[source]

Remove all constraints.

deactivate()[source]

Stop matching mode.

property icon
mode = 'MATCH'
onClick(event)[source]

Handle clicks into the figure in matching mode.

removeConstraint(elem, axis)[source]

Remove the constraint for elem.

remove_constraint(event, name)[source]

Remove constraint nearest to cursor location.

short = 'match constraints'
text = 'Match for desired target value'
class madgui.widget.twisswidget.MouseEvent(button, x, y, axes, elem, guiEvent)

Bases: tuple

Attributes

axes

Alias for field number 3

button

Alias for field number 0

elem

Alias for field number 4

guiEvent

Alias for field number 5

x

Alias for field number 1

y

Alias for field number 2

property axes

Alias for field number 3

property button

Alias for field number 0

property elem

Alias for field number 4

property guiEvent

Alias for field number 5

property x

Alias for field number 1

property y

Alias for field number 2

class madgui.widget.twisswidget.PlotInfo(name, title, curves)

Bases: tuple

Attributes

curves

Alias for field number 2

name

Alias for field number 0

title

Alias for field number 1

property curves

Alias for field number 2

property name

Alias for field number 0

property title

Alias for field number 1

class madgui.widget.twisswidget.TwissFigure(figure, session, matcher)[source]

Bases: object

A figure containing some X/Y twiss parameters.

Methods

add_curve(name, data, style)

attach(plot)

del_curve(name)

destroy()

draw_idle()

Draw the figure on its canvas.

format_coord(ax, x, y)

get_curve_by_name(name)

get_element_by_mouse_position(axes, pos)

Find an element close to the mouse cursor.

get_graph_columns()

Get a set of all columns used in any graph.

get_graph_info(name, xlim)

Get the data for a particular graph.

get_graphs()

Get a list of graph names.

hide_monitor_readouts()

on_model_updated()

Update existing plot after TWISS recomputation.

on_readouts_updated(*_)

plot_twiss_curve(ax, info)

plot_user_curve(ax, info)

reset()

Reset figure and plot.

set_graph(graph_name)

show_monitor_readouts(monitors)

Attributes

buttonPress

Signal<<class ‘madgui.widget.twisswidget.MouseEvent’>>

graph_changed

Signal<>

keyPress

Signal<<class ‘madgui.widget.twisswidget.KeyboardEvent’>>

mouseMotion

Signal<<class ‘madgui.widget.twisswidget.MouseEvent’>>

show_indicators

snapshot_num

int(x=0) -> integer

add_curve(name, data, style)[source]
attach(plot)[source]
buttonPress

Signal<<class ‘madgui.widget.twisswidget.MouseEvent’>>

del_curve(name)[source]
destroy()[source]
draw_idle()[source]

Draw the figure on its canvas.

format_coord(ax, x, y)[source]
get_curve_by_name(name)[source]
get_element_by_mouse_position(axes, pos)[source]

Find an element close to the mouse cursor.

get_graph_columns()[source]

Get a set of all columns used in any graph.

get_graph_info(name, xlim)[source]

Get the data for a particular graph.

get_graphs()[source]

Get a list of graph names.

graph_changed

Signal<>

graph_name = None
hide_monitor_readouts()[source]
keyPress

Signal<<class ‘madgui.widget.twisswidget.KeyboardEvent’>>

mouseMotion

Signal<<class ‘madgui.widget.twisswidget.MouseEvent’>>

on_model_updated()[source]

Update existing plot after TWISS recomputation.

on_readouts_updated(*_)[source]
plot_twiss_curve(ax, info)[source]
plot_user_curve(ax, info)[source]
reset()[source]

Reset figure and plot.

set_graph(graph_name)[source]
property show_indicators
show_monitor_readouts(monitors)[source]
snapshot_num = 0
xlim = None
class madgui.widget.twisswidget.TwissWidget(session, model, name=None, show_indicators=True, settings={})[source]

Bases: PyQt5.QtWidgets.QWidget

Methods

change_figure(index)

create_menu(menubar)

from_session(session, name)

toggleIndicators()

toggleShareAxes()

update_window_title()

change_figure(index)[source]
create_menu(menubar)[source]
classmethod from_session(session, name)[source]
toggleIndicators()[source]
toggleShareAxes()[source]
update_window_title()[source]
class madgui.widget.twisswidget.UserData(name, data, style)

Bases: tuple

Attributes

data

Alias for field number 1

name

Alias for field number 0

style

Alias for field number 2

property data

Alias for field number 1

property name

Alias for field number 0

property style

Alias for field number 2