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
@@ -124,16 +134,13 @@ def bins_num(self, num: int) -> None:
124134
125135 def autoset_widget_bins (self , data : npt .ArrayLike ) -> None :
126136 """Update widgets with bins determined from the image data"""
127-
128137 bins = np .linspace (np .min (data ), np .max (data ), 100 , dtype = data .dtype )
129138 self .bins_start = bins [0 ]
130139 self .bins_stop = bins [- 1 ]
131140 self .bins_num = bins .size
132141
133-
134142 def _get_layer_data (self , layer ) -> np .ndarray :
135143 """Get the data associated with a given layer"""
136-
137144 if layer .data .ndim - layer .rgb == 3 :
138145 # 3D data, can be single channel or RGB
139146 data = layer .data [self .current_z ]
@@ -150,7 +157,6 @@ def on_update_layers(self) -> None:
150157 """
151158 Called when the layer selection changes by ``self._update_layers()``.
152159 """
153-
154160 if not self .layers :
155161 return
156162
@@ -160,8 +166,12 @@ def on_update_layers(self) -> None:
160166
161167 # Only allow integer bins for integer data
162168 n_decimals = 0 if np .issubdtype (layer_data .dtype , np .integer ) else 2
163- self .findChild (QDoubleSpinBox , name = "bins start" ).setDecimals (n_decimals )
164- self .findChild (QDoubleSpinBox , name = "bins stop" ).setDecimals (n_decimals )
169+ self .findChild (QDoubleSpinBox , name = "bins start" ).setDecimals (
170+ n_decimals
171+ )
172+ self .findChild (QDoubleSpinBox , name = "bins stop" ).setDecimals (
173+ n_decimals
174+ )
165175
166176 def draw (self ) -> None :
167177 """
0 commit comments