Skip to content

Commit

Permalink
Merge pull request #24 from kremeyer/master
Browse files Browse the repository at this point in the history
fixed normalization for datasets with positive delays
  • Loading branch information
LaurentRDC committed Nov 24, 2022
2 parents d46625f + ecaa0ef commit 1b3a0da
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion iris/gui/time_series_widget.py
Expand Up @@ -50,6 +50,7 @@ def __init__(self, *args, **kwargs):
# Internal memory on last time-series info
self._last_times = None
self._last_intensities_abs = None
self._last_norm_mask = None
self._refresh_signal.connect(self.plot)

self.connect_widget = QtWidgets.QCheckBox("Connect time-series", self)
Expand Down Expand Up @@ -121,6 +122,9 @@ def plot(self, time_points, intensity):
"""
self._last_times = np.asarray(time_points)
self._last_intensities_abs = np.asarray(intensity)
self._last_norm_mask = self._last_times < 0
if self._last_norm_mask.sum() == 0:
self._last_norm_mask[0] = True

# Normalize to intensity before time-zero
# Note that the change in units is taken care of in the toggle_absolute_intensity method
Expand All @@ -129,7 +133,7 @@ def plot(self, time_points, intensity):
self._last_intensities_abs
if absolute
else self._last_intensities_abs
/ np.mean(self._last_intensities_abs[self._last_times < 0])
/ np.mean(self._last_intensities_abs[self._last_norm_mask])
)

# Only compute the colors if number of time-points changes or first time
Expand Down

0 comments on commit 1b3a0da

Please sign in to comment.