roi_plot

Parent classes for any widget that plots data

class pdsspect.roi_plot.ROIPlotModel(image_set)[source]

Bases: object

Model for ROI Plot and accompanying widget

Parameters:image_set (PDSSpectImageSet) – pdsspect model
selected_colors

list – Colors to display in the histogram

latex_units

list of 3 str – The latex strings of pdsspect_image_set.PDSSpectImageSet.accepted_units

add_selected_color(color)[source]

Select a color and inform views to display new color

Parameters:color (str) – The color to add
has_multiple_views

bool – True if there are multiple views, False otherwise

image_set

PDSSpectImageSet – Image set that corresponds with the current view

image_sets

list – All the image sets, including the current one

register(view)[source]

Register view with the model

remove_selected_color(color)[source]

Remove a selected color and inform views to not display the color

Parameters:color (str) – The color to remove
unit

str – Latex version of pdsspect_image_set.PDSSpectImageSet.unit

unregister(view)[source]

Unregister view with the model

view_index

int – The index of the view to display the ROI data

If there are not multiple views, view_index is automatically -1.

class pdsspect.roi_plot.ROIPlotController(model, view)[source]

Bases: object

Controller for ROI plot and accompanying widget

Parameters:
model

ROIPlotModel – The model

view

QtWidgets.QWidget – The view

color_state_changed(color)[source]

Select or remove the color when a checkbox color changes

Parameters:color (str) – The name of the checkbox whose state changed
remove_color(color)[source]

Remove a given color

Parameters:color (str) – The color to remove
select_color(color)[source]

Selected a given color

Parameters:color (str) – The color to select
set_view_index(index)[source]

Set the index of the view

Parameters:index (int) – Index of the view
class pdsspect.roi_plot.ROIPlotWidget(model)[source]

Bases: PyQt5.QtWidgets.QWidget, pdsspect.pdsspect_image_set.PDSSpectImageSetViewBase

Widget to hold the histogram and checkboxs

Checkboxes are created in create_color_checkbox() which is why they do not appear in the __init__() method.

Parameters:model (ROIPlotModel) – The model
model

ROIPlotModel – The model

controller

ROIPlotController – The controller

checkbox_layout

QtWidgets.QVBoxLayout – Place the checkboxes vertically

main_layout

QtWidgets.QGridLayout – Place in grid layout so histogram stretches while boxes are stationary

roi_plot

ROIPlot – The plot of ROI data

save_btn

QtWidgets.QPushButton – Save the plot as an image

red_checkbox

ColorCheckBox – Red checkbox that displays red ROI data when checked

brown_checkbox

ColorCheckBox – Brown checkbox that displays brown ROI data when checked

lightblue_checkbox

ColorCheckBox – Lightblue checkbox that displays lightblue ROI data when checked

lightcyan_checkbox

ColorCheckBox – Lightcyan checkbox that displays lightcyan ROI data when checked

darkgreen_checkbox

ColorCheckBox – Darkgreen checkbox that displays darkgreen ROI data when checked

yellow_checkbox

ColorCheckBox – Yellow checkbox that displays yellow ROI data when checked

pink_checkbox

ColorCheckBox – Pink checkbox that displays pink ROI data when checked

teal_checkbox

ColorCheckBox – Teal checkbox that displays teal ROI data when checked

goldenrod_checkbox

ColorCheckBox – Goldenrod checkbox that displays goldenrod ROI data when checked

sienna_checkbox

ColorCheckBox – Sienna checkbox that displays sienna ROI data when checked

darkblue_checkbox

ColorCheckBox – Darkblue checkbox that displays darkblue ROI data when checked

crimson_checkbox

ColorCheckBox – Crimson checkbox that displays crimson ROI data when checked

maroon_checkbox

ColorCheckBox – Maroon checkbox that displays maroon ROI data when checked

purple_checkbox

ColorCheckBox – Purple checkbox that displays purple ROI data when checked

add_view(index=None)[source]

Add a view box to the widget

Parameters:index (int [Default None]) – The index to add the view to
check_color(checkbox_color)[source]

Called when the state a checkbox is changed

Parameters:checkbox_color (str) – The color label of the check box
check_view_checkbox(view_checkbox)[source]

Check the view box at the given index

Parameters:view_checkbox (ViewCheckBox) – The view check box whose state changed
create_color_checkbox(color)[source]

Create a checkbox with the given color

Parameters:color (str) – The color to name the checkbox
save_plot()[source]

Save the plot as an image

class pdsspect.roi_plot.ROIPlot(model)[source]

Bases: matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg, pdsspect.pdsspect_image_set.PDSSpectImageSetViewBase

Plot of the data in each ROI color

Parameters:
model

ROIPlotModel – The model

image_set

PDSSpectImageSet – pdsspect model

set_roi_data()[source]

Set data when ROI is created/destroyed or checkbox is toggled

class pdsspect.roi_plot.ColorCheckBox(color)[source]

Bases: PyQt5.QtWidgets.QCheckBox

Custom checkbox that emits its color (str) when toggled

Parameters:color (str) – The color to name the checkbox
color

str – The color to name the checkbox

stateChanged

QtCore.Signal – Signal that emits a string when check box changes its state

Read more about Signals here

nextCheckState()[source]

Adjust checkbox’s toggle & emit color when checkbox is clicked

class pdsspect.roi_plot.ViewCheckBox(index)[source]

Bases: PyQt5.QtWidgets.QCheckBox

Custom checkbox that emits its index (int) when toggled

Parameters:index (int) – The index of the view
index

int – The index of the view

stateChanged

QtCore.Signal – Signal that emits the box itself when check box changes its state

Read more about Signals here

nextCheckState()[source]

Adjust checkbox’s toggle & emit checkbox when checkbox is clicked