Skip to content

detrend patch for compat with scipy welch default #14

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sroycode
Copy link

@sroycode sroycode commented Nov 9, 2024

Most people expect results for welch to match scipy welch default which applies constant detrend. I have patched the same here.

Copy link
Owner

@pwstegman pwstegman left a comment

Choose a reason for hiding this comment

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

Thank you so much for contributing! I appreciate you catching and adding this! I added some comments to the PR, let me know what you think

@@ -2,6 +2,48 @@ import { periodogram } from './periodogram';
import { windowApply } from '../data/windowApply';
import { nextpow2 } from './nextpow2';

const d_mean = (arr) => arr.reduce((a, b) => a + b, 0) / arr.length;
Copy link
Owner

Choose a reason for hiding this comment

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

Nice! Can you add a corresponding unit test to cover this logic in test/tests/shared/math/welch.test.js? Maybe something like a copy of the existing unit test but we add a very obvious upward trend to the input

Copy link
Author

Choose a reason for hiding this comment

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

Sent a fresh pull request with default 'none'

Copy link
Author

Choose a reason for hiding this comment

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

Will work on the test part in Dec once I get some time pl ...

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.

2 participants