Skip to content

Commit

Permalink
Wider t0 shift allowed. Robust image autorange and histogram.
Browse files Browse the repository at this point in the history
  • Loading branch information
David-Cai-CJ committed Aug 15, 2024
1 parent fa03459 commit 5ce59d9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion iris/gui/control_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def __init__(self, **kwargs):
# Time-zero shift control
# QDoubleSpinbox does not have a slot that sets the value without notifying everybody
self.time_zero_shift_widget = QtWidgets.QDoubleSpinBox(parent=self)
self.time_zero_shift_widget.setRange(-1000, 1000)
self.time_zero_shift_widget.setRange(-2000, 2000)
self.time_zero_shift_widget.setDecimals(3)
self.time_zero_shift_widget.setSingleStep(0.5)
self.time_zero_shift_widget.setSuffix(" ps")
Expand Down
15 changes: 13 additions & 2 deletions iris/gui/data_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ def __init__(self, *args, **kwargs):
self.layout.addWidget(self.time_series_widget)
self.setLayout(self.layout)

self.histogram = self.image_viewer.getHistogramWidget()


@QtCore.pyqtSlot()
def update_timeseries_rect(self):
rect = self.timeseries_rect_region.parentBounds().toRect()
Expand Down Expand Up @@ -142,10 +145,18 @@ def display(self, image, autocontrast=False):
if image is None:
self.image_viewer.clear()
return

self.image_viewer.setImage(
image, autoLevels=autocontrast, autoRange=autocontrast
image, autoLevels=False, autoRange=False, autoHistogramRange=False
)

if autocontrast:
low = np.quantile(image, 0.01)
high = np.quantile(image, 0.98)

self.image_viewer.setLevels(low, high)
self.histogram.setHistogramRange(low*.8, high*1.2)
self.histogram.setLevels(low, high)

self.update_timeseries_rect()

@QtCore.pyqtSlot(object, object)
Expand Down

0 comments on commit 5ce59d9

Please sign in to comment.