Skip to content

Auto downsampling: start at the configured maximum number of points - #31

Merged
PierreRaybaut merged 2 commits into
developfrom
fix/455-signal-auto-downsampling
Oct 29, 2026
Merged

PierreRaybaut merged 2 commits into
developfrom
fix/455-signal-auto-downsampling

Conversation

@PierreRaybaut

Copy link
Copy Markdown
Contributor

Closes #30. Part of DataLab-Platform/DataLab#455.

Problem

apply_downsampling only downsampled a curve above 5 times sig_autodownsampling_maxpoints. With the default value (100,000), signals of up to 500,000 points were drawn in full. Its factor, nbpoints // maxpoints, could also draw up to 20 % more points than the maximum (a 599,999-point signal was drawn with 120,000 points).

Changes

  • Curves are downsampled as soon as they have more points than sig_autodownsampling_maxpoints.
  • The factor is ceil(nbpoints / maxpoints), so that at most maxpoints points are drawn (at most maxpoints + 2 with the min/max downsampling of Min/max curve downsampling preserving peaks PlotPyStack/PlotPy#85).
  • The drawn data are updated when the downsampling factor alone changes (before, only a change of use_dsamp updated them).
  • Clearer description of sig_autodownsampling_maxpoints: maximum number of points displayed; the data are not modified.
  • Release notes (SigimaX 1.1.0) and their French translation. Only the new entry of the doc catalog is added: the other untranslated entries of earlier changes are left out of this PR.

Tests

  • New sigimax/tests/adapters_plotpy/test_curve_downsampling.py, covering:
    • the threshold and the factor around maxpoints, 5 × maxpoints and 6 × maxpoints;
    • the option disabled;
    • a change of the factor alone (apply_downsampling);
    • update_item after option changes.
  • 6 of these tests fail without the fix.
  • Full SigimaX suite: 354 passed locally, with PlotPy develop. The new tests also pass with Min/max curve downsampling preserving peaks PlotPyStack/PlotPy#85 (min/max downsampling).

…um number of points

Curves were only downsampled above 5 times `sig_autodownsampling_maxpoints`
(500,000 points by default), and the factor `nbpoints // maxpoints` could
draw up to 20 % more points than the maximum.

- Downsample as soon as a curve has more points than the maximum, with
  the factor `ceil(nbpoints / maxpoints)`, so that at most this number of
  points is drawn
- Update the drawn data when the downsampling factor alone changes
- Clarify the description of `sig_autodownsampling_maxpoints`
- New tests of the threshold, the factor and option changes

Closes #30

Assisted-by: Claude Opus 5.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant