brace.UI.PlotConfiguration package¶
Submodules¶
brace.UI.PlotConfiguration.ConfigurePlotHelpers module¶
- class brace.UI.PlotConfiguration.ConfigurePlotHelpers.HideableElementsGraphicsLayoutWidget(parent=None, show=False, size=None, title=None, **kargs)[source]¶
Bases:
GraphicsLayoutWidgetA GraphicsLayoutWidget subclass that allows for legend elements to be hidden with L and R for the legs.
- keyPressEvent(ev: QKeyEvent) None[source]¶
Toggles the visibility of the legend if H is pressed, Left legs when L is pressed, and Right legs when R is pressed. Simulator legs are also included when available.
- Parameters:
ev (QtGui.QKeyEvent) – The event for the GraphicsLayoutWidget
- Returns:
None
- Return type:
None
- setLeftLineEntries(leftLineEntries: list[PlotDataItem], leftLineFromLegend: PlotDataItem = None) None[source]¶
Sets in the left line entries that should be hidden when “L” is pressed or the legend item is toggled.
- Parameters:
leftLineEntries (list[PlotDataItem]) – List of lines that should be toggled together.
leftLineFromLegend (PlotDataItem) – The line (from a legend) that dictates how the linked lines are toggled together.
- Returns:
None
- Return type:
None
- setLegendEntries(legendsToHide: list[LegendItem]) None[source]¶
Sets in the legend items to hide when the “H” hotkey is pressed
- Parameters:
legendsToHide (list[LegendItem]) – The legend items that should be hidden.
- Returns:
None
- Return type:
None
- setRightLineEntries(rightLineEntries: list[PlotDataItem], rightLineFromLegend: PlotDataItem = None) None[source]¶
Sets in the right line entries that should be hidden when “R” is pressed or the legend item is toggled.
- Parameters:
rightLineEntries (list[PlotDataItem]) – List of lines that should be toggled together.
rightLineFromLegend (PlotDataItem) – The line (from a legend) that dictates how the linked lines are toggled together.
- Returns:
None
- Return type:
None
- setSimLeftLineEntries(simLeftLineEntries: list[PlotDataItem], simLeftLineFromLegend: PlotDataItem = None) None[source]¶
Sets in the left line simulator entries, which are a subset of lines that are hidden together, but should be hidden together.
- Parameters:
simLeftLineEntries (list[PlotDataItem]) – List of left simulator lines.
simLeftLineFromLegend (PlotDataItem) – The line from the legend that should toggle visibility of the simulator lines.
- Returns:
None
- Return type:
None
- setSimRightLineEntries(simRightLineEntries: list[PlotDataItem], simRightLineFromLegend: PlotDataItem = None) None[source]¶
Sets in the right line simulator entries, which are a subset of lines that are hidden together, but should be hidden together.
- Parameters:
simRightLineEntries (list[PlotDataItem]) – List of left simulator lines.
simRightLineFromLegend (PlotDataItem) – The line from the legend that should toggle visibility of the simulator lines.
- Returns:
None
- Return type:
None
- staticMetaObject = PySide6.QtCore.QMetaObject("HideableElementsGraphicsLayoutWidget" inherits "GraphicsLayoutWidget": )¶
- toggleAllFromLegend(event: QMouseEvent) None[source]¶
Toggles all of the lines from the legend. All of the respective lines will be toggled when the legend point is clicked.
- Parameters:
event (QtGui.QMouseEvent) – The event containing a leg element where all leg elements should be toggled together.
- Returns:
None
- Return type:
None
- toggleLeg(lineFromLegend: PlotDataItem, legToHide: list[PlotDataItem], visible: bool = None) bool[source]¶
Helper function that toggles the lines visibility based on the first element.
- Parameters:
lineFromLegend (PlotDataItem) – The line from the legend whose line visibility serves as the basis for the rest of the lines.
legToHide (list[PlotDataItem]) – The list of lines whose line visibility should be toggled.
visible (bool) – Whether or not the line should be visible. None indicates true toggling based on previous state.
- Returns:
Whether or not the leg was set to visible or hidden.
- Return type:
bool
- class brace.UI.PlotConfiguration.ConfigurePlotHelpers.MplBasePlot(matplotlibwidget: MatplotlibWidget, **kwargs)[source]¶
Bases:
objectWrapping object for the Matplotlib-based plots for opening the files in the file viewer. Objects should similarly subclass this object for added functionality over the MatplotlibWidget (provided by pyqtgraph).
- addFsrPlot(fsrAxes: Axes) tuple[Line2D, Line2D][source]¶
Adds an easy set of FSR plots for the graph, returning a tuple of the lines for left and right.
- Parameters:
fsrAxes (Axes) – The plots that should have the leg lines added.
- Returns:
Tuple of lines for the left and right legs.
- Return type:
tuple[Line2D, Line2D]
- addKneeAnglePlot(kneeAngleAxes: Axes) tuple[Line2D, Line2D][source]¶
Adds an easy set of knee angle plots for the graph, returning a tuple of the lines for left and right.
- Parameters:
kneeAngleAxes (Axes) – The plots that should have the leg lines added.
- Returns:
Tuple of lines for the left and right legs.
- Return type:
tuple[Line2D, Line2D]
- addOnPickEvent(legend: Legend, linesByLabel: dict[str, Line2D]) None[source]¶
Adds in the event for each of the lines by the label, setting in how far to click before it is selected.
- Parameters:
legend (Legend) – The legend item that references the line object.
linesByLabel (dict[str, Line2D]) – A dictionary of labels and the lines that connects the line to legend.
- Returns:
None
- Return type:
None
- addPickableLegend(axes: Axes, lines: list[Line2D], numCols: int = None, fontsize: str = 'medium') tuple[Legend, dict[str, Line2D]][source]¶
Adds a legend where the lines are pickable given a set of lines.
- Parameters:
axes (Axes) – The Axes objects where the legend should be.
lines (list[Line2D]) – The list of lines that should be on the legend.
numCols (int) – The number of columns in the legend.
fontsize (str) – The size of the font in the legend.
- Returns:
A tuple of the Legend and lines labeled by name.
- Return type:
tuple[Legend, dict[str, Line2D]]
- addThresholdLines(colors: list[str], labels: list[str], thresholdNames: list[str], isLeft: bool, **kwargs) list[Line2D][source]¶
Add threshold lines to the plot. Left is considered dash line, while right is considered solid line.
- Parameters:
axes (Axes) – The axes (plot) to add the lines.
colors (list[str]) – list of colors that are zipped with the threshold names.
labels (list[str]) – list of string labels that are zipped with the threshold names.
thresholdNames (list[str]) – list of threshold names to be used (left and right are automatically appended)
isLeft (bool) – Whether or not the threshold line is left or right.
- Returns:
List of threshold line objects that were added.
- Return type:
list[Line2D]
- addTorquePlot(torqueAxes: Axes) tuple[Line2D, Line2D][source]¶
Adds an easy set of torque plots for the graph, returning a tuple of the lines for left and right.
- Parameters:
torqueAxes (Axes) – The plots that should have the leg lines added.
- Returns:
Tuple of lines for the left and right legs.
- Return type:
tuple[Line2D, Line2D]
- addWindowedAngularVelocityPlot(windowedAngularVelocityAxes: Axes) tuple[Line2D, Line2D][source]¶
Adds an easy set of windowed angular velocity plots for the graph, returning a tuple of the lines for left and right.
- Parameters:
windowedAngularVelocityAxes (Axes) – The plots that should have the leg lines added.
- Returns:
Tuple of lines for the left and right legs.
- Return type:
tuple[Line2D, Line2D]
- getAxes() Axes[source]¶
Gets the Matplotlib axes of the graph.
- Returns:
The Axes of the plots.
- Return type:
matplotlib.Axes
- getAxesMaps() dict[type, dict[str, Line2D]][source]¶
Gets the hierarchical structure of the graph lines by NamedTuple type, then by attribute name.
- Returns:
Line2D oriented by NamedTuple type attributes
- Return type:
dict[type, dict[str, Line2D]]
- getFigure() Figure[source]¶
Gets the Matplotlib figure of the graph.
- Returns:
The Figure of the plots.
- Return type:
matplotlib.Figure
- getFigureAxesAxesMapTriple() tuple[Figure, Axes, dict[type, dict[str, Line2D]]][source]¶
Returns the triple of the three components of Figure, Axes, and mapping of Line2Ds.
- Returns:
The triple of components.
- Return type:
tuple[Figure, Axes, dict[type, dict[str, Line2D]]]
- on_pick(event)[source]¶
Callback function to handle legend picking. Handles toggling visibility of the lines if selected from the legend. More fine-grained than the hotkeys.
- on_press(event) None[source]¶
Callback function to handle hotkey changes. Namely “H” toggles legend visibility, “L” toggles left, and “R” toggles right leg visibilities.
- static removeTickNumbers(axes: ndarray) None[source]¶
Removes all of the tick numbers on all of the axes except for the last one.
- Parameters:
axes (Axes) – Axes containing the plots.
- Returns:
None
- Return type:
None
- setHideableLegends(legends: list[Legend]) None[source]¶
Sets in the legends that are hideable with “H”.
- Parameters:
legends (list[Legend]) – List of legends that should be hideable with “H”.
- Returns:
None
- Return type:
None
- setHideableLines(leftLines: list[Line2D], rightLines: list[Line2D]) None[source]¶
Sets in the lines for left and right that are hideable with “L” and “R” respectively.
- Parameters:
leftLines (list[Line2D]) – Left lines to be hidden with “L”.
rightLines (list[Line2D]) – Right lines to be hidden with “R”.
- Returns:
None
- Return type:
None
- abstractmethod updateFinalPlotMatplotlib(**kwargs) None[source]¶
Method that can be used to update the plots at the final moment after autoscaling for fitting the plots has been used. May be used to override any changes.
- Params kwargs:
Keyword arguments that may be used in final fitting of plots.
:types dict[str, Any] :return: None :rtype: None
- class brace.UI.PlotConfiguration.ConfigurePlotHelpers.PyQTBasePlot(graphicsLayoutWidget: HideableElementsGraphicsLayoutWidget, simulator: bool = False, **kwargs)[source]¶
Bases:
object- getFigureAxesAxesMapTriple() tuple[HideableElementsGraphicsLayoutWidget, list[PlotItem], dict[type, dict[str, PlotDataItem]]][source]¶
Returns the triple containing the widget, the plots, and map of maps with the lines. Namely the axisMaps is referenced by type, then by attribute name for each line.
- Returns:
Tuple containing the figure widget, the plots, and the lines for the relevant attributes for the NamedTuple datatype.
- Return type:
tuple[HideableElementsGraphicsLayoutWidget, list[PlotItem], dict[type, dict[str, PlotDataItem]]]
- getSimulatorAxisMaps() dict[type, dict[str, PlotDataItem]][source]¶
Gets specifically the simulator lines addressed first by type then by NamedTuple attributes.
- Returns:
The dictionary of types, which contains a dictionary of lines referenced by attribute names.
- Return type:
dict[type, dict[str, PlotDataItem]]
- brace.UI.PlotConfiguration.ConfigurePlotHelpers.addFsrPlot(fig: PlotItem, row: int, axisLabelFont: QFont, lineFontSize: int = 2) tuple[PlotItem, PlotDataItem, PlotDataItem][source]¶
Adds a basic FSR plot onto the plots. Plots are arranged in a single column, but placement of the plot can be changed with the row parameter.
- Parameters:
fig (PlotItem) – The plot that should have the FSR plot added.
row (int) – The row that this plot should be added onto.
xGraphLim (int) – The maximum limits at which x-axis should be initially set for this plot.
axisLabelFont (QtGui.QFont) – The font that should be used on the left side of the plot.
lineFontSize (int) – The size of the line for this plot. Default: 2.
- Returns:
Tuple of the plots, line for the left leg, and line for the right leg.
- Return type:
tuple[PlotItem, PlotDataItem, PlotDataItem]
- brace.UI.PlotConfiguration.ConfigurePlotHelpers.addKneeAnglePlot(fig: PlotItem, row: int, xGraphLim: int, axisLabelFont: QFont, lineFontSize: int = 2) tuple[PlotItem, PlotDataItem, PlotDataItem][source]¶
Adds a basic knee angle plot onto the plots. Plots are arranged in a single column, but placement of the plot can be changed with the row parameter.
- Parameters:
fig (PlotItem) – The plot that should have the knee angle plot added.
row (int) – The row that this plot should be added onto.
xGraphLim (int) – The maximum limits at which x-axis should be initially set for this plot.
axisLabelFont (QtGui.QFont) – The font that should be used on the left side of the plot.
lineFontSize (int) – The size of the line for this plot. Default: 2.
- Returns:
Tuple of the plots, line for the left leg, and line for the right leg.
- Return type:
tuple[PlotItem, PlotDataItem, PlotDataItem]
- brace.UI.PlotConfiguration.ConfigurePlotHelpers.addLegLegend(plot: PlotItem, leftLeg: PlotDataItem, rightLeg: PlotDataItem) LegendItem[source]¶
Adds the legend that contains the left and right legs as items.
- Parameters:
plot (PlotItem) – The plot to add the threshold lines into.
leftLeg (PlotDataItem) – The line that corresponds to the left leg (often the knee angle line).
rightLeg (PlotDataItem) – The line that corresponds to the right leg (often the knee angle line).
- Returns:
The legend containing the left and right legs.
- Return type:
LegendItem
- brace.UI.PlotConfiguration.ConfigurePlotHelpers.addSimKneeAngleLines(fig: PlotItem, lineFontSize: int = 0) tuple[PlotDataItem, PlotDataItem][source]¶
Adds the simulator lines for the plot into the knee angle. These are not really used (inputs are not duplicated), but are a reference point for setting lines together.
- Parameters:
fig (PlotItem) – The plot where the knee angle lines are to be added.
lineFontSize (int.) – Size of the line font. Default: 0.
- Returns:
Tuple of the simulator lines.
- Return type:
tuple[PlotDataItem, PlotDataItem]
- brace.UI.PlotConfiguration.ConfigurePlotHelpers.addSimStateLines(fig: PlotItem, lineFontSize: int = 1) tuple[PlotDataItem, PlotDataItem][source]¶
Adds the simulator state lines for the state plots. The simulator will use Dotted lines over the normal solid lines.
- Parameters:
fig (PlotItem) – The plot that should have the simulator lines attached.
lineFontSize (int) – The font size that should be used in the lines. Default: 1.
- Returns:
Tuple of two lines representing the left and right simulator lines.
- Return type:
tuple[PlotDataItem, PlotDataItem]
- brace.UI.PlotConfiguration.ConfigurePlotHelpers.addSimTorqueLines(fig: PlotItem, lineFontSize: int = 1) tuple[PlotDataItem, PlotDataItem][source]¶
Adds the simulator torque lines for the torque plots. The simulator will use Dotted lines over the normal solid lines.
- Parameters:
fig (PlotItem) – The plot that should have the simulator lines attached.
lineFontSize (int) – The font size that should be used in the lines. Default: 1.
- Returns:
Tuple of two lines representing the left and right simulator lines.
- Return type:
tuple[PlotDataItem, PlotDataItem]
- brace.UI.PlotConfiguration.ConfigurePlotHelpers.addThresholdLegend(plot: PlotItem, thresholdLines: list[PlotDataItem]) LegendItem[source]¶
Adds a legend to the plot using the threshold lines as items.
- Parameters:
plot (PlotItem) – the plot to add the threshold lines into.
thresholdLines (list[PlotDataItem]) – List of threshold lines.
- Returns:
Legend that contains the threshold lines
- Return type:
LegendItem
- brace.UI.PlotConfiguration.ConfigurePlotHelpers.addThresholdLines(plot: PlotItem, defaultThresholdValues: list[float], colors: list[str], leftThresholdNames: list[str], rightThresholdNames: list[str], lineFontSize: int = 2) list[PlotDataItem][source]¶
Adds threshold lines for the plots in pyqtgraph.
- Parameters:
plot (PlotItem) – the plot to add the threshold lines into.
defaultThresholdValues (list[float]) – The default threshold values that should be initially set.
colors (list[str]) – The colors that should be used for the lines.
leftThresholdNames (list[str]) – List of names to be used on the left side.
rightThresholdNames (list[str]) – List of names to be used on the right side.
lineFontSize (int) – The side of the threshold line.
- Returns:
list of threshold lines that were added.
- Return type:
list[PlotDataItem]
- brace.UI.PlotConfiguration.ConfigurePlotHelpers.addTorquePlot(fig: PlotItem, row: int, axisLabelFont: QFont, lineFontSize: int = 2) tuple[PlotItem, PlotDataItem, PlotDataItem][source]¶
Adds a basic torque plot onto the plots. Plots are arranged in a single column, but placement of the plot can be changed with the row parameter.
- Parameters:
fig (PlotItem) – The plot that should have the torque plot added.
row (int) – The row that this plot should be added onto.
xGraphLim (int) – The maximum limits at which x-axis should be initially set for this plot.
axisLabelFont (QtGui.QFont) – The font that should be used on the left side of the plot.
lineFontSize (int) – The size of the line for this plot. Default: 2.
- Returns:
Tuple of the plots, line for the left leg, and line for the right leg.
- Return type:
tuple[PlotItem, PlotDataItem, PlotDataItem]
- brace.UI.PlotConfiguration.ConfigurePlotHelpers.addWindowedAngularVelocityPlot(fig: PlotItem, row: int, axisLabelFont: QFont, lineFontSize: int = 2) tuple[PlotItem, PlotDataItem, PlotDataItem][source]¶
Adds a basic windowed angular velocity plot onto the plots. Plots are arranged in a single column, but placement of the plot can be changed with the row parameter.
- Parameters:
fig (PlotItem) – The plot that should have the windowed angular velocity plot added.
row (int) – The row that this plot should be added onto.
xGraphLim (int) – The maximum limits at which x-axis should be initially set for this plot.
axisLabelFont (QtGui.QFont) – The font that should be used on the left side of the plot.
lineFontSize (int) – The size of the line for this plot. Default: 2.
- Returns:
Tuple of the plots, line for the left leg, and line for the right leg.
- Return type:
tuple[PlotItem, PlotDataItem, PlotDataItem]
- brace.UI.PlotConfiguration.ConfigurePlotHelpers.getLeftLabelFontFormat(ptSize: int = 12) QFont[source]¶
Creates the font format for the left axis of each graph.
- Parameters:
ptSize (int) – The size of the font.
- Returns:
The font to use in the graphs.
- Return type:
QtGui.QFont
- brace.UI.PlotConfiguration.ConfigurePlotHelpers.setGraphLayout(graphicsLayoutWidget: GraphicsLayoutWidget) None[source]¶
Sets the GraphicLayoutWidget to minimal margins and little spacing.
- Params graphicsLayoutWidget:
The GraphicsLayoutWidget to change.
- Returns:
None
- Return type:
None