forked from poliastro/poliastro
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove dependency con pycephes, implement function
Alternative until poliastro/pycephes#1 makes progress.
- Loading branch information
1 parent
203cd72
commit 7ab4cca
Showing
8 changed files
with
44 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,6 @@ requirements: | |
- astropy >=1.0 | ||
- jplephem | ||
- matplotlib | ||
- pycephes | ||
|
||
test: | ||
imports: | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,3 @@ dependencies: | |
- numba | ||
- numpy | ||
- scipy | ||
- pycephes |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,6 @@ | |
"matplotlib", | ||
"jplephem", | ||
"scipy", | ||
"pycephes", | ||
], | ||
tests_require=[ | ||
"pytest" | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"""Utility hypergeometric functions. | ||
""" | ||
import numpy as np | ||
|
||
from poliastro.jit import jit | ||
|
||
|
||
@jit('f8(f8)') | ||
def hyp2f1b(x): | ||
"""Hypergeometric function 2F1(3, 1, 5/2, x), see [Battin]. | ||
""" | ||
if x >= 1.0: | ||
return np.inf | ||
else: | ||
res = 1.0 | ||
term = 1.0 | ||
ii = 0 | ||
while True: | ||
term = term * (3 + ii) * (1 + ii) / (5 / 2 + ii) * x / (ii + 1) | ||
res_old = res | ||
res += term | ||
if res_old == res: | ||
return res | ||
ii += 1 |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import pytest | ||
|
||
import numpy as np | ||
from numpy.testing import assert_almost_equal | ||
from scipy import special | ||
|
||
from poliastro.hyper import hyp2f1b as hyp2f1 | ||
|
||
|
||
@pytest.mark.parametrize("x", np.linspace(0, 1, num=10)) | ||
def test_hyp2f1_battin_scalar(x): | ||
expected_res = special.hyp2f1(3, 1, 5/2, x) | ||
|
||
res = hyp2f1(x) | ||
assert_almost_equal(res, expected_res) |