DOC: Adding testing guidelines for RocketPy#626
Merged
lucasfourier merged 4 commits intodevelopfrom Jul 1, 2024
Merged
Conversation
GabrielBarberini
approved these changes
Jun 27, 2024
Collaborator
GabrielBarberini
left a comment
There was a problem hiding this comment.
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.
Gui-FernandesBR
approved these changes
Jun 30, 2024
Member
Gui-FernandesBR
left a comment
There was a problem hiding this comment.
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.]]
"""
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request type
Checklist
black rocketpy/ tests/) has passed locallypytest tests -m slow --runslow) have passed locallyCHANGELOG.mdhas 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:
