44import numpy as np
55import numpy .typing as npt
66from matplotlib .container import BarContainer
7- from qtpy .QtWidgets import QComboBox , QLabel , QVBoxLayout , QWidget , QGroupBox , QFormLayout , QDoubleSpinBox , QSpinBox , QAbstractSpinBox
7+ from qtpy .QtWidgets import (
8+ QAbstractSpinBox ,
9+ QComboBox ,
10+ QDoubleSpinBox ,
11+ QFormLayout ,
12+ QGroupBox ,
13+ QLabel ,
14+ QSpinBox ,
15+ QVBoxLayout ,
16+ QWidget ,
17+ )
818
919from .base import SingleAxesWidget
1020from .features import FEATURES_LAYER_TYPES
@@ -107,16 +117,13 @@ def bins_num(self, num: int) -> None:
107117
108118 def autoset_widget_bins (self , data : npt .ArrayLike ) -> None :
109119 """Update widgets with bins determined from the image data"""
110-
111120 bins = np .linspace (np .min (data ), np .max (data ), 100 , dtype = data .dtype )
112121 self .bins_start = bins [0 ]
113122 self .bins_stop = bins [- 1 ]
114123 self .bins_num = bins .size
115124
116-
117125 def _get_layer_data (self , layer ) -> np .ndarray :
118126 """Get the data associated with a given layer"""
119-
120127 if layer .data .ndim - layer .rgb == 3 :
121128 # 3D data, can be single channel or RGB
122129 data = layer .data [self .current_z ]
@@ -133,7 +140,6 @@ def on_update_layers(self) -> None:
133140 """
134141 Called when the layer selection changes by ``self._update_layers()``.
135142 """
136-
137143 if not self .layers :
138144 return
139145
@@ -143,8 +149,12 @@ def on_update_layers(self) -> None:
143149
144150 # Only allow integer bins for integer data
145151 n_decimals = 0 if np .issubdtype (layer_data .dtype , np .integer ) else 2
146- self .findChild (QDoubleSpinBox , name = "bins start" ).setDecimals (n_decimals )
147- self .findChild (QDoubleSpinBox , name = "bins stop" ).setDecimals (n_decimals )
152+ self .findChild (QDoubleSpinBox , name = "bins start" ).setDecimals (
153+ n_decimals
154+ )
155+ self .findChild (QDoubleSpinBox , name = "bins stop" ).setDecimals (
156+ n_decimals
157+ )
148158
149159 def draw (self ) -> None :
150160 """
0 commit comments