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

ENH : Add of a line for saving the filtered dataset #518

Merged
merged 5 commits into from
Dec 21, 2023

Conversation

kalounis
Copy link
Contributor

Pull request type

  • Code changes (bugfix, features)

Checklist

  • Tests for the changes have been added (if needed)
  • Docs have been reviewed and added / updated
  • Lint (black rocketpy/ tests/) has passed locally
  • All tests (pytest --runslow) have passed locally
  • CHANGELOG.md has been updated (if relevant)

Current behavior

The code is able to filter data (of a CSV file) but doesn't save the filtered dataset.

New behavior

Once you filter a dataset, this one is saved in a CSV file.

Breaking change

  • No

Additional information

Enter text here...

@kalounis kalounis requested a review from a team as a code owner December 20, 2023 09:53
@kalounis kalounis changed the title Add of a line for saving the filtered dataset ENH : Add of a line for saving the filtered dataset Dec 20, 2023
Copy link

codecov bot commented Dec 20, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (5390478) 72.02% compared to head (ad62bf4) 71.99%.
Report is 9 commits behind head on develop.

❗ Current head ad62bf4 differs from pull request most recent head cd897a9. Consider uploading reports for the commit cd897a9 to get more accurate results

Files Patch % Lines
rocketpy/mathutils/function.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #518      +/-   ##
===========================================
- Coverage    72.02%   71.99%   -0.04%     
===========================================
  Files           56       56              
  Lines         9370     9372       +2     
===========================================
- Hits          6749     6747       -2     
- Misses        2621     2625       +4     
Flag Coverage Δ
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@phmbressan phmbressan left a comment

Choose a reason for hiding this comment

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

Thanks for the contributions! Left I quick comment on this feature regarding making the save behavior more versatile.

@@ -1112,6 +1112,9 @@ def low_pass_filter(self, alpha):
alpha * self.source[i] + (1 - alpha) * filtered_signal[i - 1]
)

# Save the new csv file with filtered data
np.savetxt("filtered_data.csv", filtered_signal, delimiter=",")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good feature. One small note is that it might not be the user's will to always save the file and in this location.

Therefore, what I suggest is to add an optional parameter to the method filepath (or another name you prefer) that defaults to None (in this case nothing will be saved), but may receive the filepath (and filename) string that will go into the np.savetxt.

The final step would be describing this behavior on this parameter docstring.

As always, we are open to any other suggestions you might have.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, thank you! I didn't thought about it, I will try to implement it!

@kalounis kalounis requested a review from phmbressan December 21, 2023 19:19
@kalounis kalounis merged commit 14dd0f6 into develop Dec 21, 2023
@kalounis kalounis deleted the enh/save-filtered-data branch December 21, 2023 20:15
@Gui-FernandesBR Gui-FernandesBR added the Enhancement New feature or request, including adjustments in current codes label Feb 12, 2024
@Gui-FernandesBR Gui-FernandesBR added this to the Release v1.X.0 milestone Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request, including adjustments in current codes
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

4 participants