Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that the downsample algorithm m4 n_out is always a multiple of 4 #6195

Merged
merged 1 commit into from
Apr 16, 2024

Conversation

hoxbro
Copy link
Member

@hoxbro hoxbro commented Apr 16, 2024

Fixes #6192

@hoxbro hoxbro added the type: bug Something isn't correct or isn't working label Apr 16, 2024
@hoxbro hoxbro enabled auto-merge (squash) April 16, 2024 06:19
@hoxbro hoxbro merged commit 372eb6c into main Apr 16, 2024
11 of 12 checks passed
@hoxbro hoxbro deleted the fix_m4_size branch April 16, 2024 07:11
@@ -188,6 +188,7 @@ def _m4(x, y, n_out, **kwargs):
'The m4 downsampling algorithm requires the tsdownsampler '
'library to be installed.'
) from None
n_out = n_out - (n_out % 4) # n_out must be a multiple of 4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be safer to increase the number of samples, to handle degenerate cases where otherwise there might be only a tiny number of samples? Please ignore if I'm misunderstanding this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We never downsample something where the number of points is smaller than the width of the plot, so there will never be a tiny number of samples.

The case reported in the issue n_out is around 210 to 217 samples, so adding or subtracting 3 at most for it seemed negligible.

Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't correct or isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Intermittent issue with downsample1d 'm4' algorithm, depending on number of data points
2 participants