Skip to content

Commit

Permalink
Merge pull request #492 from RocketPy-Team/bug/fix-N-dimensional-get-…
Browse files Browse the repository at this point in the history
…value-opt

FIX: Broken Function.get_value_opt for N-Dimensional Functions
  • Loading branch information
MateusStano authored Nov 29, 2023
2 parents 0ef9849 + 8d6f244 commit 22bb07b
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 5 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ straightforward as possible.

-

## [v1.1.3] - 2023-11-29

Here we write upgrading notes for brands. It's a team effort to make them as
straightforward as possible.

### Fixed

- FIX: Broken Function.get_value_opt for N-Dimensional Functions [#492](https://github.com/RocketPy-Team/RocketPy/pull/492/files)

## [v1.1.2] - 2023-11-25

You can install this version by running `pip install rocketpy==1.1.2`
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
author = "RocketPy Team"

# The full version, including alpha/beta/rc tags
release = "1.1.2"
release = "1.1.3"


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/user/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ If you want to choose a specific version to guarantee compatibility, you may ins

.. code-block:: shell
pip install rocketpy==1.1.2
pip install rocketpy==1.1.3
Optional Installation Method: ``conda``
Expand Down
1 change: 1 addition & 0 deletions rocketpy/mathutils/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ def get_value_opt(x):

elif self.__interpolation__ == "shepard":
x_data = self.source[:, 0:-1] # Support for N-Dimensions
y_data = self.source[:, -1]
len_y_data = len(y_data) # A little speed up

# change the function's name to avoid mypy's error
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

setuptools.setup(
name="rocketpy",
version="1.1.2",
version="1.1.3",
install_requires=necessary_require,
extras_require={
"env_analysis": env_analysis_require,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ def test_getters(func_from_csv, func_2d_from_csv):
assert func_2d_from_csv.get_outputs() == ["Scalar"]
assert func_2d_from_csv.get_interpolation_method() == "shepard"
assert func_2d_from_csv.get_extrapolation_method() == "natural"
assert np.isclose(func_2d_from_csv.get_value(0, 0), 0.0, atol=1e-6)
assert np.isclose(func_2d_from_csv.get_value_opt(0, 0), 0.0, atol=1e-6)
assert np.isclose(func_2d_from_csv.get_value(0.1, 0.8), 0.058, atol=1e-6)
assert np.isclose(func_2d_from_csv.get_value_opt(0.1, 0.8), 0.058, atol=1e-6)


def test_setters(func_from_csv, func_2d_from_csv):
Expand Down

0 comments on commit 22bb07b

Please sign in to comment.