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

complete scipy.signal._savitzky_golay #124

Merged
merged 4 commits into from
Oct 21, 2024

Conversation

pavyamsiri
Copy link
Contributor

Before this PR, the stub file _savitzky_golay.pyi had untyped annotations. This PR adds in the missing type annotations and improves previous ones.

The improvements are:

  1. Use op.CanIndex instead of int for the axis parameter.
  2. Use Literals to type hint certain strings for use and mode parameters

This file tends to use int and float a lot which could perhaps be replaced by AnyInt and AnyReal however, some parameters like window_length are used as shapes in calls to functions like np.zeros which don't accept np.bool_.

For simplicity I left the type annotations as the builtin python types but I am open to using more general type annotations to allow numpy dtypes as well. It just might take a bit more testing to check the allowed types.

In the file `_savitzky_golay.pyi`.

Additionally add `Literal` type annotation for the `use` parameter which
can only be "conv" or "dot".
For the file `_savitzy_golay.pyi`.

Additionally write a mode type alias for mode to specify the actually
allowed strings.
Copy link
Owner

@jorenham jorenham left a comment

Choose a reason for hiding this comment

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

Unless you want to change something, I think this we can go ahead and merge this :)

@pavyamsiri
Copy link
Contributor Author

Unless you want to change something, I think this we can go ahead and merge this :)

Yes should be all done now.

@jorenham jorenham merged commit d62c4e6 into jorenham:master Oct 21, 2024
2 checks passed
@jorenham
Copy link
Owner

Thanks again @pavyamsiri !

@pavyamsiri pavyamsiri deleted the improve/savitzky-golay branch October 21, 2024 11:03
@jorenham jorenham mentioned this pull request Nov 25, 2024
21 tasks
@jorenham jorenham added the stubs: improvement Improve or refactor existing annotations label Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scipy.signal stubs: improvement Improve or refactor existing annotations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants