Segment-by-Segment

Main Model

This is the main model for the Segment-by-Segment application.

class omc3_gui.segment_by_segment.main_model.MeasurementListModel(*args: Any, **kwargs: Any)[source]
class ColorIDs(*values)[source]
class omc3_gui.segment_by_segment.main_model.SegmentTableModel(*args: Any, **kwargs: Any)[source]

Data Model for the table of segments.

Hint: Uses Qt.UserRole to retrieve the actual segment.

columnCount(parent=qtpy.QtCore.QModelIndex)[source]

Returns the number of columns in the model.

data(index: qtpy.QtCore.QModelIndex, role=qtpy.QtCore.Qt.ItemDataRole.DisplayRole)[source]

Return the data, depending on index and role.

flags(index)[source]

Set the flags for the given index. At the moment: all elements are editable and selectable.

headerData(section, orientation, role=qtpy.QtCore.Qt.ItemDataRole.DisplayRole)[source]

Sets the header of the table.

rowCount(parent=qtpy.QtCore.QModelIndex)[source]

Returns the number of rows in the model.

setData(index, value, role)[source]

Set the data, depending on index and role.

Measurement Model

This module contains the model for the Optics Measurement in the Segment-by-Segment application.

class omc3_gui.segment_by_segment.measurement_model.OpticsMeasurement(measurement_dir: DirectoryPath = PosixPath('to_be_defined'), model_dir: DirectoryPath = PosixPath('to_be_defined'), accel: str = None, output_dir: DirectoryPath = None, corrections: FilePath = None, year: str = None, ring: int = None, beam: int = None, _segments: list[SegmentDataModel] = <factory>)[source]

Class to load and hold the optics-measurement folder. This class also stores the meta-data for the loaded measurement, which can then be passed on to the segment-by-segment. The omc3_gui.utils.dataclass_ui.metafield() is used to provide hints about the fields for the GUI.

copy() OpticsMeasurement[source]

Creates a copy of the measurement.

classmethod from_json(path: Path, measurement_dir: Path | None = None) OpticsMeasurement[source]

Creates an OpticsMeasurement from a folder, by trying to parse information from the data in the folder.

Parameters:

path (Path) -- Path to the folder.

Returns:

OpticsMeasurement instance.

Return type:

OpticsMeasurement

classmethod from_path(path: Path) OpticsMeasurement[source]

Creates an OpticsMeasurement from a folder, by trying to parse information from the data in the folder.

Parameters:

path (Path) -- Path to the folder.

Returns:

OpticsMeasurement instance.

Return type:

OpticsMeasurement

classmethod get_comment(name: str) str[source]

Returns the comment for the field named name.

classmethod get_label(name: str) str[source]

Returns the label for the field named name.

property id: str

Unique identifier for the measurement, used in the ItemModel.

quick_check() None[source]

Tests for completeness of the definition (e.g. after loading).

tooltip() str[source]

Returns a string with information about the measurement, as to be used in a tool-tip.

omc3_gui.segment_by_segment.measurement_model.map_lhc_year(year: str | None) str[source]

Maps the input year to the corresponding available model year.

Measurement View

This module contains the view for the measurement dialog.

class omc3_gui.segment_by_segment.measurement_view.OpticsMeasurementDialog(*args: Any, **kwargs: Any)[source]

Segment Model

This module contains the model for the Segments in the Segment-by-Segment application.

class omc3_gui.segment_by_segment.segment_model.SegmentDataModel(measurement: OpticsMeasurement, name: str = 'to_be_defined', start: str | None = None, end: str | None = None, _data: SegmentDiffs | None = None)[source]

“ Container for the segment data, which is also used in the Segment creation dialog.

to_input_string()[source]

String representation of the segment as used in inputs.

class omc3_gui.segment_by_segment.segment_model.SegmentItemModel(name: str, start: str = None, end: str = None)[source]

Model for a segment item in the Segment-Table of the Segment-by-Segment application. Each item has name, start and end and attached a list of actual segment-obejcts

property id: str

Unique identifier for the segment.

to_input_string()[source]

String representation of the segment as used in inputs.

tooltip() str[source]

Returns a string with information about the segment, as to be used in a tool-tip.

Hint: Use fully HTML compatible strings, otherwise Qt will revert to plain text.

e.g. use <br> instead of n. Also &nbsp; instead of whitespaces, as they are collapsed in HTML.

omc3_gui.segment_by_segment.segment_model.SegmentTuple

alias of Segment

omc3_gui.segment_by_segment.segment_model.compare_segments(a: SegmentDataModel | SegmentItemModel, b: SegmentDataModel | SegmentItemModel) bool[source]

Checks if two Segments have the same definition.

omc3_gui.segment_by_segment.segment_model.get_segments_from_directory(directory: Path) list[Segment][source]

Parse segments from a directory.

This function needs to be kept synchronized with omc3.segment_by_segment.segments.SegmentDiffs.

omc3_gui.segment_by_segment.segment_model.is_element(segment: SegmentItemModel | SegmentDataModel) bool[source]

Checks if the segment is an element-segment.

omc3_gui.segment_by_segment.segment_model.to_input_string(segment: SegmentItemModel | SegmentDataModel) str[source]

Convert the segment to the string representation as used in inputs.

Segment View

This module contains the view for the segment dialog.

class omc3_gui.segment_by_segment.segment_view.SegmentDialog(*args: Any, **kwargs: Any)[source]

Defaults

Defaults for segment by segment.

Help Dialogs

omc3_gui.segment_by_segment.help_view.show_help_dialog()[source]

Displays the help dialog for the segment-by-segment GUI.

Settings

Global Settings for the Segment-by-Segment application.

class omc3_gui.segment_by_segment.settings.MainSettings(cwd: 'Path' = PosixPath('/home/runner/work/omc3_gui/omc3_gui'), autoload_segments: 'bool' = True, autodefault_segments: 'bool' = False, suggest_correctors: 'bool' = True)[source]
class omc3_gui.segment_by_segment.settings.PlotSettings(show_model: 'bool' = False, show_legend: 'bool' = True, marker_size: 'float' = 8.5, expected: 'bool' = False, forward: 'bool' = True, backward: 'bool' = False, connect_x: 'bool' = True, connect_y: 'bool' = False, reset_zoom: 'bool' = True, same_start: 'bool' = True, model_s: 'bool' = False)[source]
class omc3_gui.segment_by_segment.settings.Settings(main: 'MainSettings' = <factory>, plotting: 'PlotSettings' = <factory>)[source]