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: Barometer, ScalarSensors and InertialSensors #608

Merged
merged 32 commits into from
Jun 13, 2024

Conversation

MateusStano
Copy link
Member

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 tests -m slow --runslow) have passed locally

New

I have added the Barometer class. Since this sensor does not have axes, the class structure of the sensors had to change. The old abstract Sensors class still exists, and it inherits to:

  • InertialSensors: Deals with vector measurements. Is inherited by Accelerometer and Gyroscope
  • ScalarSensors: Deals with scalar measurements. Is inherited only by Barometer for now

The sensor_testing.ipynb notebook has a working barometer

@MateusStano MateusStano requested a review from a team as a code owner May 23, 2024 18:17
Copy link

codecov bot commented May 23, 2024

Codecov Report

Attention: Patch coverage is 92.54386% with 17 lines in your changes missing coverage. Please review.

Project coverage is 73.72%. Comparing base (ce1d179) to head (0b779f2).
Report is 1 commits behind head on enh/sensors-impl.

Files Patch % Lines
rocketpy/sensors/sensor.py 90.44% 15 Missing ⚠️
rocketpy/plots/rocket_plots.py 50.00% 2 Missing ⚠️
Additional details and impacted files
@@                 Coverage Diff                  @@
##           enh/sensors-impl     #608      +/-   ##
====================================================
- Coverage             73.78%   73.72%   -0.07%     
====================================================
  Files                    64       62       -2     
  Lines                 10049    10064      +15     
====================================================
+ Hits                   7415     7420       +5     
- Misses                 2634     2644      +10     

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

Copy link
Member

@Gui-FernandesBR Gui-FernandesBR left a comment

Choose a reason for hiding this comment

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

@MateusStano could you pylint your code and fix some warning messages?

There is the make pylint command.

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.

Good work. I agree with your division of Sensor into Inertial and Scalar since they seem to have different contracts parameter-wise.

Before approving, I believe some of the comments on this PR should be addressed, specially the singular class naming one.

@MateusStano
Copy link
Member Author

@Gui-FernandesBR @phmbressan comments addressed, files renamed and most of pylint complaint fixed.

@MateusStano MateusStano requested a review from phmbressan June 6, 2024 22:06
Copy link
Member

@Gui-FernandesBR Gui-FernandesBR left a comment

Choose a reason for hiding this comment

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

Good progress!

Please make sure to create a task list for us to follow your progress on the sensors implementation. I just don't know how much of work is still needed.

Comment on lines 270 to 275
export_sensors_measured_data(
sensor=self,
filename=filename,
file_format=file_format,
data_labels=("t", "ax", "ay", "az"),
)
Copy link
Member

Choose a reason for hiding this comment

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

Once again.

If filename="this_is_my_file.csv", it is redundant asking what is the file_format. You can (almost) automatically guess it.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know about this. The file_format I guess refers more to the way data is saved in the file. Someone could want a .txt file with the data written in the csv format or in the json format

For me, it seems simpler just to have this choice as an argument, but I understand it can be redundant information in certain cases

Copy link
Member

Choose a reason for hiding this comment

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

Someone could want a .txt file with the data written in the csv format or in the json format

This is not reasonable to me. I don't see why someone would try to do this.

I think it's more annoying having to write "filename.txt, file_format='xt'", I don't see why this is simpler to you.

Copy link
Member

@Gui-FernandesBR Gui-FernandesBR left a comment

Choose a reason for hiding this comment

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

You can merge after solving the tests.
Good work.

Please list the remaining tasks for the future PRs. I don't know how much is still left to be done.

@MateusStano MateusStano merged commit af410b6 into enh/sensors-impl Jun 13, 2024
9 of 10 checks passed
@MateusStano MateusStano deleted the enh/barometer branch June 13, 2024 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

3 participants