-
-
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
DOC: Adding testing guidelines for RocketPy #626
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.
Amazing initiative! Thanks for writing this out, it will definitely reduce friction for people willing to contribute to the project.
I just added some comments and minor observations, but apart from the discussion on the integration session everything else is quite optional, feel free to accept what you also agree with.
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.
Nice one! Just fixz what Gabriel mentioned and you are good to go!
Take in mind that in this repo we also define some "tests" in the docstring of some methods.
This is something done more for example purposes, but it is also executed in the CI.
For example:
def to_frequency_domain(self, lower, upper, sampling_frequency, remove_dc=True):
"""Performs the conversion of the Function to the Frequency Domain and
returns the result. This is done by taking the Fourier transform of the
Function. The resulting frequency domain is symmetric, i.e., the
negative frequencies are included as well.
Parameters
----------
lower : float
Lower bound of the time range.
upper : float
Upper bound of the time range.
sampling_frequency : float
Sampling frequency at which to perform the Fourier transform.
remove_dc : bool, optional
If True, the DC component is removed from the Fourier transform.
Returns
-------
Function
The Function in the frequency domain.
Examples
--------
>>> from rocketpy import Function
>>> import numpy as np
>>> main_frequency = 10 # Hz
>>> time = np.linspace(0, 10, 1000)
>>> signal = np.sin(2 * np.pi * main_frequency * time)
>>> time_domain = Function(np.array([time, signal]).T)
>>> frequency_domain = time_domain.to_frequency_domain(
... lower=0, upper=10, sampling_frequency=100
... )
>>> peak_frequencies_index = np.where(frequency_domain[:, 1] > 0.001)
>>> peak_frequencies = frequency_domain[peak_frequencies_index, 0]
>>> print(peak_frequencies)
[[-10. 10.]]
"""
Pull request type
Checklist
black rocketpy/ tests/
) has passed locallypytest tests -m slow --runslow
) have passed locallyCHANGELOG.md
has been updated (if relevant)Current behavior
Currently, RocketPy docs does not formally define guidelines for contributions regarding tests.
New behavior
From now on, RocketPy will have formal guidelines for developers seeking to contribute for the test suite.
Breaking change
Additional information
New part of the docs:
![image](https://private-user-images.githubusercontent.com/69172945/343364688-f9bb2287-138b-49fe-bc75-05b18b80bb9a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MTk1NzQsIm5iZiI6MTczOTYxOTI3NCwicGF0aCI6Ii82OTE3Mjk0NS8zNDMzNjQ2ODgtZjliYjIyODctMTM4Yi00OWZlLWJjNzUtMDViMThiODBiYjlhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE1VDExMzQzNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTJjNGVmNTA4YzgzNWUyMDRhZDM1M2E2MjhkNTVlMGY4ODYyYjY1MDQ3ODJkNmU2OTQwMzliM2ZiYWMxMDcyMzEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.yhuEJTSWv1OhLgrPoP8CGZFjKJFia138WlKXw__f5YA)