Skip to content

Commit 8ab3e75

Browse files
add package: bilby.cython (#341)
Co-authored-by: Agriya Khetarpal <[email protected]>
1 parent 3943db7 commit 8ab3e75

File tree

2 files changed

+100
-0
lines changed

2 files changed

+100
-0
lines changed

packages/bilby.cython/meta.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package:
2+
name: bilby.cython
3+
version: 0.5.3
4+
top-level:
5+
- docs
6+
- bilby_cython
7+
source:
8+
url: https://files.pythonhosted.org/packages/source/b/bilby_cython/bilby_cython-0.5.3.tar.gz
9+
sha256: 44400b2abc6fa592b13d69f33460cb156d6edb48a783f5539ee0a21e1d0a3508
10+
requirements:
11+
host:
12+
- numpy
13+
run:
14+
- numpy
15+
about:
16+
home: https://git.ligo.org/colm.talbot/bilby-cython
17+
PyPI: https://pypi.org/project/bilby.cython
18+
summary: Optimized functionality for Bilby
19+
license: MIT
20+
extra:
21+
recipe-maintainers:
22+
- colmtalbot
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
from pytest_pyodide import run_in_pyodide
2+
3+
4+
@run_in_pyodide(packages=["bilby_cython"])
5+
def test_time_delay_from_geocenter(selenium):
6+
import bilby_cython
7+
import numpy as np
8+
9+
assert (
10+
abs(
11+
bilby_cython.geometry.time_delay_from_geocenter(
12+
np.array([30000.0, 40000.0, 50000.0]), 6.0, 7.0, 8.0
13+
)
14+
- 1.5504686860116492e-05
15+
)
16+
< 1e-10
17+
)
18+
19+
20+
@run_in_pyodide(packages=["bilby_cython"])
21+
def test_frame_conversion(selenium):
22+
import bilby_cython
23+
import numpy as np
24+
25+
theta, phi = bilby_cython.geometry.zenith_azimuth_to_theta_phi(
26+
7.0, 8.0, np.array([30000.0, 40000.0, 50000.0])
27+
)
28+
assert abs(theta - 1.3005416123794573) < 1e-5
29+
assert abs(phi - 1.5202320529440563) < 1e-5
30+
31+
32+
@run_in_pyodide(packages=["bilby_cython"])
33+
def test_polarization_tensor(selenium):
34+
import bilby_cython
35+
import numpy as np
36+
37+
np.testing.assert_array_almost_equal(
38+
bilby_cython.geometry.get_polarization_tensor(3.0, 4.0, 5.0, 6.0, "plus"),
39+
np.array(
40+
[
41+
[0.35242077, -0.75868979, 0.485414],
42+
[-0.75868979, 0.00811582, 0.2482672],
43+
[0.485414, 0.2482672, -0.36053659],
44+
]
45+
),
46+
)
47+
48+
49+
@run_in_pyodide(packages=["bilby_cython"])
50+
def test_detector_tensor(selenium):
51+
import bilby_cython
52+
import numpy as np
53+
54+
np.testing.assert_array_almost_equal(
55+
bilby_cython.geometry.detector_tensor(
56+
np.array([2.0, 3.0, 4.0]), np.array([5.0, 6.0, 7.0])
57+
),
58+
np.array(
59+
[
60+
[-10.5, -12.0, -13.5],
61+
[-12.0, -13.5, -15.0],
62+
[-13.5, -15.0, -16.5],
63+
]
64+
),
65+
)
66+
67+
68+
@run_in_pyodide(packages=["bilby_cython"])
69+
def test_greenwich_sidereal_time(selenium):
70+
import bilby_cython
71+
72+
assert (
73+
abs(
74+
bilby_cython.time.greenwich_sidereal_time(1400000000.0, 3.0)
75+
- 56098.53252485254
76+
)
77+
< 1e-5
78+
)

0 commit comments

Comments
 (0)