diff --git a/.github/dependabot/constraints.txt b/.github/dependabot/constraints.txt index 16b28f44..0743cd5e 100644 --- a/.github/dependabot/constraints.txt +++ b/.github/dependabot/constraints.txt @@ -38,6 +38,7 @@ karabo-bridge==0.6.1 kiwisolver==1.4.0 libcst==0.4.1 locket==0.2.1 +lttbc==0.2.1 MarkupSafe==2.1.1 matplotlib==3.5.1 mistune==2.0.2 diff --git a/extra_foam/special_suite/correlator_w.py b/extra_foam/special_suite/correlator_w.py index 8fa29a90..7a266adf 100644 --- a/extra_foam/special_suite/correlator_w.py +++ b/extra_foam/special_suite/correlator_w.py @@ -8,6 +8,7 @@ from enum import Enum from collections import defaultdict +import lttbc import libcst as cst import libcst.matchers as m import libcst.metadata as cstmeta @@ -353,6 +354,9 @@ def _resize_buffers(self): if buf.capacity() != self._max_points: buf.resize(self._max_points) + def downsample(self, x, y): + return lttbc.downsample(x, y, 2000) + def updateF(self, all_data): if self._current_view not in all_data: return @@ -405,7 +409,9 @@ def handle_rich_output(): # it's the Y axis data and generate the X axis. if data.values.shape[0] == 1: y_data = data.values[0] - self._xs.extend(np.arange(len(y_data))) + x_data = np.arange(len(y_data)) + x_data, y_data = self.downsample(x_data, y_data) + self._xs.extend(x_data) self._ys[y_series_labels[0]].extend(y_data) # Otherwise, we treat the first vector slice as the X axis, @@ -448,8 +454,11 @@ def handle_rich_output(): self._clearData() if is_ndarray: - self._xs.extend(range(len(data))) - self._ys["y0"].extend(data) + x_data = np.arange(len(data)) + x_data, y_data = self.downsample(x_data, data) + + self._xs.extend(x_data) + self._ys["y0"].extend(y_data) elif is_xarray: handle_rich_output() else: diff --git a/setup.py b/setup.py index 217eccbe..d31f9d81 100644 --- a/setup.py +++ b/setup.py @@ -316,6 +316,7 @@ def has_ext_modules(self): "metropc @ git+ssh://git@git.xfel.eu:10022/karaboDevices/metropc.git@high_high_water_mark", "qscintilla", "libcst", + "lttbc", # These dependencies are not directly used, but are needed to satisfy # pip's resolver: 'pygments',