-
-
Notifications
You must be signed in to change notification settings - Fork 170
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
ENH: add Function.low_pass_filter method #508
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall good Work here! I've made a few suggestions in terms of formatting, the idea is to improve the code readability.
Are you familiar with unit tests? I think it would be nice to have a simple test for the new method.
We can help with that if needed.
Thanks for submitting your first PR, I think this will really improve rocketpy!
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #508 +/- ##
===========================================
- Coverage 71.16% 71.16% -0.01%
===========================================
Files 55 55
Lines 9273 9279 +6
===========================================
+ Hits 6599 6603 +4
- Misses 2674 2676 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
We knew we would have to create some tests at some point but are not familiar with this in python and we do not really know how tests work in RocketPy as well, so we decided to wait to do it with you. |
That's fine. What you would need to do is basically:
My recommendations: first test the type of the return of the method, something like: assert isinstance(res, Function). Sencondly, try to test the function with the extreme values of alpha (0 and 1), and later test with arbitrary values of alpha as well. We can give more details if you need. @lucasfourier is also currently studying unit tests creation and he could support you as well. |
…v files without headers
Co-authored-by: Gui-FernandesBR <guilherme_fernandes@usp.br>
Co-authored-by: Gui-FernandesBR <guilherme_fernandes@usp.br>
2085990
to
7eb4a73
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, this method will be very useful when dealing with real world data.
Thank you again for your contributions!
I've made the two latest commits and rebased the branch, please review it and merge it in your earliest convenience.
Pull request type
Checklist
black rocketpy/ tests/
) has passed locallypytest --runslow
) have passed locallyCurrent behavior
There were no functions to smooth a Function object.
New behavior
We added a "low_pass_filter" method applying an exponential smoothing to a Function object. This function takes a parameter "alpha" you have to chose to smooth the function.
Breaking change
Additional information
For a given dataset, the larger alpha is, the more closely the filtered function returned will match the function
the smaller alpha is, the smoother the filtered function returned will be (but with a phase shift)