bezierv 1.0.0__py3-none-any.whl → 1.1.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,42 +0,0 @@
1
- import pytest
2
- import numpy as np
3
- from bezierv.classes.bezierv import Bezierv
4
-
5
- @pytest.fixture
6
- def normal_data(scope='package') -> np.array:
7
- """
8
- Fixture to create a sample data instance for testing.
9
-
10
- Returns
11
- -------
12
- np.array
13
- A numpy array of sample data points.
14
- """
15
- np.random.seed(111)
16
- return np.random.normal(loc=0, scale=1, size=100)
17
-
18
- @pytest.fixture
19
- def linear_bezierv() -> Bezierv:
20
- """
21
- Fixture to create a linear Bezier instance for testing.
22
-
23
- Returns
24
- -------
25
- Bezierv
26
- An instance of the Bezierv class with linear controls.
27
- """
28
- return Bezierv(n=1, controls_x=np.array([0.0, 1.0]), controls_z=np.array([0.0, 1.0]))
29
-
30
- @pytest.fixture
31
- def two_uniform_bezierv() -> tuple:
32
- """
33
- Fixture to create two uniform Bezier random variables for testing convolution.
34
-
35
- Returns
36
- -------
37
- tuple
38
- """
39
- return (
40
- Bezierv(n=1, controls_x=np.array([0.0, 1.0]), controls_z=np.array([0.0, 1.0])),
41
- Bezierv(n=1, controls_x=np.array([0.0, 1.0]), controls_z=np.array([0.0, 1.0]))
42
- )
File without changes
@@ -1,36 +0,0 @@
1
- import numpy as np
2
- import pytest
3
- from bezierv.classes.convolver import Convolver
4
- from bezierv.classes.bezierv import Bezierv
5
-
6
- def triangular_cdf(z):
7
- """
8
- CDF of Z = X+Y with X,Y ~ U(0,1):
9
- F_Z(z) = 0 (z ≤ 0)
10
- z² / 2 (0 < z < 1)
11
- 1 - (2 - z)² / 2 (1 ≤ z < 2)
12
- 1 (z ≥ 2)
13
- """
14
- if z <= 0:
15
- return 0.0
16
- if z < 1:
17
- return 0.5 * z * z
18
- if z < 2:
19
- return 1 - 0.5 * (2 - z) ** 2
20
- return 1.0
21
-
22
- def test_cdf_z_matches_triangle(two_uniform_bezierv):
23
- bx, by = two_uniform_bezierv
24
- conv = Convolver(bx, by, grid=50)
25
-
26
- for z in [0.0, 0.2, 0.8, 1.0, 1.4, 2.0]:
27
- val = conv.cdf_z(z)
28
- expected = triangular_cdf(z)
29
- assert val == pytest.approx(expected, abs=5e-3)
30
-
31
- def test_conv_calls_distfit_and_returns(two_uniform_bezierv):
32
- bx, by = two_uniform_bezierv
33
- conv = Convolver(bx, by, grid=20)
34
- bez_out, mse = conv.conv(method="projgrad")
35
- assert isinstance(bez_out, Bezierv)
36
- assert bez_out.check_ordering() is True
@@ -1,34 +0,0 @@
1
- import numpy as np
2
- import pytest
3
- from bezierv.classes.distfit import DistFit
4
-
5
- def test_quantile_initial_x(normal_data):
6
- d = DistFit(normal_data, n=4)
7
- expected = np.quantile(normal_data, np.linspace(0, 1, 5))
8
- np.testing.assert_allclose(d.init_x, expected)
9
-
10
- def test_uniform_initial_x(normal_data):
11
- d = DistFit(normal_data, n=3, method_init_x="uniform")
12
- expected = np.linspace(np.min(normal_data), np.max(normal_data), 4)
13
- np.testing.assert_allclose(d.init_x, expected)
14
-
15
- @pytest.mark.parametrize(
16
- "method, target_mse",
17
- [
18
- ("projgrad", 1e-2),
19
- ("nonlinear", 1e-2),
20
- ("neldermead", 1e-2),
21
- ("projsubgrad", 1e-2),
22
- ],
23
- )
24
-
25
- def test_fit_dispatch_and_mse(normal_data, method, target_mse):
26
- df = DistFit(normal_data, n=3)
27
- bez, mse = df.fit(method=method, max_iter_PS = 100, max_iter_PG=100)
28
- assert mse <= target_mse
29
- assert bez.check_ordering() is True
30
-
31
- def test_bad_method_raises(normal_data):
32
- df = DistFit(normal_data)
33
- with pytest.raises(ValueError):
34
- df.fit(method="does-not-exist")
@@ -1,29 +0,0 @@
1
- bezierv/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- bezierv/algorithms/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- bezierv/algorithms/conv_bezierv.py,sha256=t74CKomBli98WpVyFWp3oueu7mBuJ4jVYXNj55jmg_Q,4795
4
- bezierv/algorithms/nelder_mead.py,sha256=uqH3jJS-CG6wblOKP83Rt8-XFJrXZSVJLHaixRKCflw,5478
5
- bezierv/algorithms/non_linear.py,sha256=dgwGGe__JJGXQXidmAYjSkDBqSjdr-1HilnUUuPEs8c,7523
6
- bezierv/algorithms/non_linear_solver.py,sha256=03QaD0XJLfRdnhYay_WaspxbRZtDcURjqcl2p-DnOVI,8480
7
- bezierv/algorithms/proj_grad.py,sha256=BhBAKtvW0_FZrNwinN9VCq27taYshM8zZymu5zX46w0,4622
8
- bezierv/algorithms/proj_subgrad.py,sha256=gtk4FXpKziykHHfyfhaRhBhRbdDQErpTDPYqrjo15e0,6962
9
- bezierv/algorithms/utils.py,sha256=QQecNlGdxMWhDcHPfGEJ_V1nuOIdJdR-2UziKh6N6tw,2396
10
- bezierv/classes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- bezierv/classes/bezierv.py,sha256=UT-iPn-gKfKi9qMG8lrPi3VRmnV2sjSKQCGazoaUSAc,19696
12
- bezierv/classes/convolver.py,sha256=h-NewJ__VlL881UQSAUFSamscMEgPBwUxvpb6bHpFD0,2850
13
- bezierv/classes/distfit.py,sha256=EBN_knZ7vinkNjZQf6KSyGfMl0nx0rVqTJR7xUumIDY,8863
14
- bezierv/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
- bezierv/tests/conf_test.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- bezierv/tests/test_algorithms/test_conv_bezierv.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
- bezierv/tests/test_algorithms/test_nelder_mead.py,sha256=METAE2eWnfm4bBdGMKtrFEoP_8FpFU4O3uFuiqEsBG0,1788
18
- bezierv/tests/test_algorithms/test_proj_grad.py,sha256=eRdwQFn5rfGH1Tu5812hW_7BrPWGO88L6HipexGPW9s,2109
19
- bezierv/tests/test_algorithms/test_proj_subgrad.py,sha256=On4-E1A4fS7szXxfokv4BZKY5GIVgbl2YVAtVztwS1A,2077
20
- bezierv/tests/test_algorithms/test_utils.py,sha256=JBb9uukGfBsrFOgSngX6FUkPdW2KrY7hJ3DkY_TQz7I,1236
21
- bezierv/tests/test_classes/conftest.py,sha256=X94OWG8puTTjueuxjBBQR-fU4f8nN-4QT5NlDFZgTgs,1124
22
- bezierv/tests/test_classes/test_bezierv.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
- bezierv/tests/test_classes/test_convolver.py,sha256=3Z6G0em_owso1gNcGWadHkiHxx65ktFJV_u9Gvop_W8,1118
24
- bezierv/tests/test_classes/test_distfit.py,sha256=B-xgIocMzWAfuTxhMTvD2S1QvE-MHXSw8JkoVcziQHA,1103
25
- bezierv-1.0.0.dist-info/licenses/LICENSE,sha256=VfWiefIi6eo_kZleNp0Plg8A2eUX4D8fDbKtfj4VCp4,1115
26
- bezierv-1.0.0.dist-info/METADATA,sha256=hzqB1McgWf-yUlKqHtBTsY3gpUjv6PN-JQ7_KNQCQG0,4679
27
- bezierv-1.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
28
- bezierv-1.0.0.dist-info/top_level.txt,sha256=AC8zK0YmUeXyPIHtt0EKuHkLrvFBFeHwzp6bjzYnqJI,8
29
- bezierv-1.0.0.dist-info/RECORD,,