histogram¶
-
class
pdsspect.histogram.
HistogramModel
(image_view, cut_low=None, cut_high=None, bins=100)[source]¶ Bases:
object
Model for a Histogram which can apply cut levels to an image
Any View that utilizes this model must define the following methods:
set_data
,change_cut_low
,change_cut_high
,change_cuts
,warn
, andchange_bins
. Thewarn
method must return a boolean and if more than one view utilizes this model, you should consider only one actually creating a warning box and returnTrue
while the others just returnFalse
.Parameters: -
bins
¶ int
The number of bins the histogram usesSetting the bins will notify the views that the bins have changed
-
cut_high
¶ float
The higher cut levelSetting the high cut value will adjust the cut values in the image view and notify the views that the high cut value changed.
-
cut_low
¶ float
The lower cut levelSetting the low cut value will adjust the cut values in the image view and notify the views that the low cut value changed
-
cuts
¶ tuple
The lower and higher cut levels. If the lower and higher cut levels are not set, use the image_view cut levelsSetting the cuts will adjust the cut levels in the image viewer and notify the views that the cuts have changed. The low cut must be less than the high cut, otherwise they will be switched to satisfy that condition.
-
data
¶ ndarray
The current image data
-
image_view
¶ ImageViewCanvas
The image view canvasSetting the image view will reset the data
-
register
(view)[source]¶ Register a view with the model
Parameters: view ( QtWidgets.QWidget
) – A view that utilizes this model
-
unregister
(view)[source]¶ Unregister a view with the model
Parameters: view ( QtWidgets.QWidget
) – A view that utilizes this model
-
warn
(title, message)[source]¶ Display a warning box
Each view must define a
warn
method that returns a boolean value: True when a warning box is displayed and False when a warning box not displayed. Only one display box will be displayed. This is because multiple views should not have different handling for the same errors.
-
-
class
pdsspect.histogram.
HistogramController
(model, view)[source]¶ Bases:
object
Controller for histogram views
Parameters: - model (
HistogramModel
) – histogram model - view (
object
) – View withHistogramModel
as its model
-
model
¶ HistogramModel
– histogram model
-
view
¶ object
– View withHistogramModel
as its model
-
set_bins
(bins)[source]¶ Change the number of bins the histogram uses
Parameters: bins ( int
) – The number number of bins for the histogram
-
set_cut_high
(cut_high)[source]¶ Set the high cut level to a new value
Parameters: cut_high ( float
) – New high cut value
- model (
-
class
pdsspect.histogram.
HistogramWidget
(model, parent=None)[source]¶ Bases:
PyQt5.QtWidgets.QWidget
View to display the histogram with text boxes for cuts and bins
Parameters: model ( HistogramModel
) – The view’s model-
model
¶ HistogramModel
– The view’s model
-
controller
¶ HistogramController
– The view’s controller
-
-
class
pdsspect.histogram.
Histogram
(model)[source]¶ Bases:
matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg
The Histogram View
Parameters: model ( HistogramModel
) – The view’s model-
model
¶ HistogramModel
– The view’s model
-
controller
¶ HistogramController
– The view’s controller
-