scikit-spatial 9.0.1__tar.gz → 10.0.0__tar.gz
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.
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/CONTRIBUTING.rst +0 -22
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/HISTORY.rst +21 -9
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/PKG-INFO +2 -2
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/pyproject.toml +9 -9
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/src/skspatial/objects/_base_array.py +3 -3
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/src/skspatial/objects/cylinder.py +3 -3
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/src/skspatial/objects/points.py +1 -1
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/tests/unit/objects/test_base_array.py +22 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/tests/unit/objects/test_points.py +4 -4
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/tests/unit/objects/test_triangle.py +1 -1
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/tox.ini +1 -1
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/uv.lock +611 -609
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/.coveragerc +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/.dockerignore +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/.github/workflows/main.yml +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/.gitignore +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/.pre-commit-config.yaml +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/.readthedocs.yml +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/AUTHORS.rst +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/CITATION.cff +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/LICENSE +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/README.md +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/api_reference/skspatial.measurement.rst +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/api_reference/skspatial.objects.Circle.rst +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/api_reference/skspatial.objects.Cylinder.rst +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/api_reference/skspatial.objects.Line.rst +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/api_reference/skspatial.objects.LineSegment.rst +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/api_reference/skspatial.objects.Plane.rst +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/api_reference/skspatial.objects.Point.rst +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/api_reference/skspatial.objects.Points.rst +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/api_reference/skspatial.objects.Sphere.rst +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/api_reference/skspatial.objects.Triangle.rst +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/api_reference/skspatial.objects.Vector.rst +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/api_reference/skspatial.objects.rst +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/api_reference/skspatial.transformation.rst +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/api_reference/toc.rst +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/conf.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/images/logo.svg +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/index.rst +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/objects/circle.rst +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/objects/cylinder.rst +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/objects/line.rst +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/objects/line_segment.rst +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/objects/plane.rst +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/objects/point_vector.rst +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/objects/points.rst +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/objects/sphere.rst +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/objects/toc.rst +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/objects/triangle.rst +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/plotting.rst +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/docs/source/requirements.txt +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/examples/README.txt +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/examples/fitting/README.txt +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/examples/fitting/plot_line_2d.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/examples/fitting/plot_line_3d.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/examples/fitting/plot_plane.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/examples/intersection/README.txt +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/examples/intersection/plot_circle_circle.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/examples/intersection/plot_cylinder_line.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/examples/intersection/plot_line_circle.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/examples/intersection/plot_line_line_2d.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/examples/intersection/plot_line_line_3d.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/examples/intersection/plot_line_plane.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/examples/intersection/plot_plane_plane.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/examples/intersection/plot_sphere_line.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/examples/projection/README.txt +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/examples/projection/plot_line_plane.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/examples/projection/plot_point_line.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/examples/projection/plot_point_plane.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/examples/projection/plot_vector_line.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/examples/projection/plot_vector_plane.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/examples/projection/plot_vector_vector.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/examples/triangle/README.txt +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/examples/triangle/plot_normal.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/examples/triangle/plot_orthocenter.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/images/logo.svg +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/mypy.ini +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/src/skspatial/__init__.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/src/skspatial/_functions.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/src/skspatial/measurement.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/src/skspatial/objects/__init__.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/src/skspatial/objects/_base_line_plane.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/src/skspatial/objects/_base_spatial.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/src/skspatial/objects/_base_sphere.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/src/skspatial/objects/_mixins.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/src/skspatial/objects/circle.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/src/skspatial/objects/line.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/src/skspatial/objects/line_segment.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/src/skspatial/objects/plane.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/src/skspatial/objects/point.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/src/skspatial/objects/sphere.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/src/skspatial/objects/triangle.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/src/skspatial/objects/vector.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/src/skspatial/plotting.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/src/skspatial/py.typed +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/src/skspatial/transformation.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/src/skspatial/typing.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/tests/__init__.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/tests/unit/__init__.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/tests/unit/objects/__init__.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/tests/unit/objects/test_all_objects.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/tests/unit/objects/test_base_array_1d.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/tests/unit/objects/test_base_array_2d.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/tests/unit/objects/test_base_line_plane.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/tests/unit/objects/test_circle.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/tests/unit/objects/test_cylinder.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/tests/unit/objects/test_line.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/tests/unit/objects/test_line_plane.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/tests/unit/objects/test_line_segment.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/tests/unit/objects/test_plane.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/tests/unit/objects/test_point.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/tests/unit/objects/test_sphere.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/tests/unit/objects/test_vector.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/tests/unit/test_functions.py +0 -0
- {scikit_spatial-9.0.1 → scikit_spatial-10.0.0}/tests/unit/test_measurement.py +0 -0
|
@@ -30,11 +30,6 @@ Implement Features
|
|
|
30
30
|
Look through the GitHub issues for features. Anything tagged with "enhancement"
|
|
31
31
|
and "help wanted" is open to whoever wants to implement it.
|
|
32
32
|
|
|
33
|
-
Submit Feedback
|
|
34
|
-
~~~~~~~~~~~~~~~
|
|
35
|
-
|
|
36
|
-
The best way to send feedback is to file an issue at https://github.com/ajhynes7/scikit-spatial/issues.
|
|
37
|
-
|
|
38
33
|
|
|
39
34
|
Get Started!
|
|
40
35
|
------------
|
|
@@ -50,7 +45,6 @@ Ready to contribute? Here's how to set up `scikit-spatial` for local development
|
|
|
50
45
|
Now you can make your changes locally.
|
|
51
46
|
|
|
52
47
|
3. When you're done making changes, check that your changes pass linting and tests.
|
|
53
|
-
See ``.travis.yml`` for test commands.
|
|
54
48
|
|
|
55
49
|
4. Commit your changes and push your branch to GitHub::
|
|
56
50
|
|
|
@@ -69,19 +63,3 @@ Before you submit a pull request, check that it meets these guidelines:
|
|
|
69
63
|
1. The pull request should include tests.
|
|
70
64
|
2. If the pull request adds functionality, the docs should be updated. Put
|
|
71
65
|
your new functionality into a function with a docstring.
|
|
72
|
-
3. Check https://travis-ci.org/ajhynes7/scikit-spatial/pull_requests
|
|
73
|
-
and make sure that the tests pass for all supported Python versions.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
Deploying
|
|
77
|
-
---------
|
|
78
|
-
|
|
79
|
-
A reminder for the maintainers on how to deploy.
|
|
80
|
-
Make sure all your changes are committed (including an entry in HISTORY.rst).
|
|
81
|
-
Then run::
|
|
82
|
-
|
|
83
|
-
$ bumpversion patch # possible: major / minor / patch
|
|
84
|
-
$ git push
|
|
85
|
-
$ git push --tags
|
|
86
|
-
|
|
87
|
-
Travis will then deploy to PyPI if tests pass.
|
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
History
|
|
3
3
|
=======
|
|
4
4
|
|
|
5
|
+
10.0.0 (2026-10-24)
|
|
6
|
+
------------------
|
|
7
|
+
|
|
8
|
+
Breaking Changes
|
|
9
|
+
~~~~~~~~~~~~~~~~
|
|
10
|
+
- Change the `round` method to not modify the array in-place.
|
|
11
|
+
- Change `dimension` attribute to revert to object length if not 2D array.
|
|
12
|
+
- Set the centroid of the points from `Plane.to_points` to always be the original plane point.
|
|
13
|
+
|
|
14
|
+
|
|
5
15
|
9.0.1 (2025-04-16)
|
|
6
16
|
------------------
|
|
7
17
|
|
|
@@ -48,11 +58,12 @@ Fixes
|
|
|
48
58
|
|
|
49
59
|
Docs
|
|
50
60
|
~~~~
|
|
61
|
+
|
|
51
62
|
Include new methods in the documentation:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
63
|
+
- `Line.project_points`
|
|
64
|
+
- `Line.distance_points`
|
|
65
|
+
- `Plane.project_points`
|
|
66
|
+
- `Plane.distance_points`
|
|
56
67
|
|
|
57
68
|
|
|
58
69
|
7.2.0 (2024-02-12)
|
|
@@ -60,11 +71,12 @@ Include new methods in the documentation:
|
|
|
60
71
|
|
|
61
72
|
Features
|
|
62
73
|
~~~~~~~~
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
74
|
+
|
|
75
|
+
Add new methods:
|
|
76
|
+
- `Line.project_points`
|
|
77
|
+
- `Line.distance_points`
|
|
78
|
+
- `Plane.project_points`
|
|
79
|
+
- `Plane.distance_points`
|
|
68
80
|
|
|
69
81
|
|
|
70
82
|
7.1.1 (2024-01-29)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: scikit-spatial
|
|
3
|
-
Version:
|
|
3
|
+
Version: 10.0.0
|
|
4
4
|
Summary: Spatial objects and computations based on NumPy arrays.
|
|
5
5
|
Project-URL: repository, https://github.com/ajhynes7/scikit-spatial
|
|
6
6
|
Project-URL: documentation, https://scikit-spatial.readthedocs.io
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "scikit-spatial"
|
|
7
|
-
version = "
|
|
7
|
+
version = "10.0.0"
|
|
8
8
|
description = "Spatial objects and computations based on NumPy arrays."
|
|
9
9
|
|
|
10
10
|
license = { text = "BSD-3-Clause" }
|
|
@@ -40,6 +40,14 @@ dependencies = [
|
|
|
40
40
|
[project.optional-dependencies]
|
|
41
41
|
plotting = ["matplotlib>=3"]
|
|
42
42
|
|
|
43
|
+
[dependency-groups]
|
|
44
|
+
dev = [
|
|
45
|
+
"mypy>=1.14.0",
|
|
46
|
+
"pytest-cov>=5.0.0",
|
|
47
|
+
"pytest>=8.3.3",
|
|
48
|
+
"ruff>=0.8.4",
|
|
49
|
+
]
|
|
50
|
+
|
|
43
51
|
[project.urls]
|
|
44
52
|
repository = "https://github.com/ajhynes7/scikit-spatial"
|
|
45
53
|
documentation = "https://scikit-spatial.readthedocs.io"
|
|
@@ -47,14 +55,6 @@ documentation = "https://scikit-spatial.readthedocs.io"
|
|
|
47
55
|
[tool.hatch.build.targets.wheel]
|
|
48
56
|
packages = ["src/skspatial"]
|
|
49
57
|
|
|
50
|
-
[tool.uv]
|
|
51
|
-
dev-dependencies = [
|
|
52
|
-
"mypy>=1.14.0",
|
|
53
|
-
"pytest-cov>=5.0.0",
|
|
54
|
-
"pytest>=8.3.3",
|
|
55
|
-
"ruff>=0.8.4",
|
|
56
|
-
]
|
|
57
|
-
|
|
58
58
|
[tool.pytest.ini_options]
|
|
59
59
|
pythonpath = ["src"]
|
|
60
60
|
|
|
@@ -31,7 +31,7 @@ class _BaseArray(np.ndarray, _BaseSpatial):
|
|
|
31
31
|
|
|
32
32
|
return obj
|
|
33
33
|
|
|
34
|
-
def __array_wrap__(self, array, context=None, return_scalar=False)
|
|
34
|
+
def __array_wrap__(self, array, context=None, return_scalar: bool = False):
|
|
35
35
|
"""
|
|
36
36
|
Return regular :class:`numpy.ndarray` when default NumPy method is called.
|
|
37
37
|
|
|
@@ -122,7 +122,7 @@ class _BaseArray(np.ndarray, _BaseSpatial):
|
|
|
122
122
|
Point([1. , 2. , 3.53])
|
|
123
123
|
|
|
124
124
|
"""
|
|
125
|
-
return
|
|
125
|
+
return type(self)(super().round(decimals=decimals).copy())
|
|
126
126
|
|
|
127
127
|
|
|
128
128
|
class _BaseArray1D(_BaseArray):
|
|
@@ -199,7 +199,7 @@ class _BaseArray2D(_BaseArray):
|
|
|
199
199
|
try:
|
|
200
200
|
self.dimension = self.shape[1]
|
|
201
201
|
except IndexError:
|
|
202
|
-
self.dimension =
|
|
202
|
+
self.dimension = self.size
|
|
203
203
|
|
|
204
204
|
def set_dimension(self: Array2D, dim: int) -> Array2D:
|
|
205
205
|
"""
|
|
@@ -464,11 +464,11 @@ class Cylinder(_BaseSpatial, _ToPointsMixin):
|
|
|
464
464
|
|
|
465
465
|
# The cylinder surface ranges over t from 0 to length of axis,
|
|
466
466
|
# and over theta from 0 to 2 * pi.
|
|
467
|
-
|
|
468
|
-
|
|
467
|
+
t_lin = np.linspace(0, self.length(), n_along_axis)
|
|
468
|
+
theta_lin = np.linspace(0, 2 * np.pi, n_angles)
|
|
469
469
|
|
|
470
470
|
# use meshgrid to make 2d arrays
|
|
471
|
-
t, theta = np.meshgrid(
|
|
471
|
+
t, theta = np.meshgrid(t_lin, theta_lin)
|
|
472
472
|
|
|
473
473
|
X, Y, Z = [
|
|
474
474
|
self.point[i] + v_axis[i] * t + self.radius * np.sin(theta) * u_1[i] + self.radius * np.cos(theta) * u_2[i]
|
|
@@ -185,7 +185,7 @@ class Points(_BaseArray2D):
|
|
|
185
185
|
"""
|
|
186
186
|
distances_to_points = np.linalg.norm(self, axis=1)
|
|
187
187
|
|
|
188
|
-
return self / distances_to_points.max()
|
|
188
|
+
return cast(Points, self / distances_to_points.max())
|
|
189
189
|
|
|
190
190
|
def affine_rank(self, **kwargs) -> np.int64:
|
|
191
191
|
"""
|
|
@@ -5,6 +5,28 @@ import pytest
|
|
|
5
5
|
from skspatial.objects import Point, Points, Vector
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
@pytest.mark.parametrize("class_spatial", [Point, Vector, Points])
|
|
9
|
+
@pytest.mark.parametrize("dtype", [np.float32, np.float64, np.int64])
|
|
10
|
+
@pytest.mark.parametrize("decimals", [-1, 0, 1, 3])
|
|
11
|
+
@pytest.mark.parametrize("readonly", [False, True])
|
|
12
|
+
def test_round_preserves_original(class_spatial, dtype, decimals, readonly):
|
|
13
|
+
array = np.array([[1.234, -12.345, 23.456], [34.567, 45.678, -56.789]], dtype=dtype)
|
|
14
|
+
if class_spatial is not Points:
|
|
15
|
+
array = array[0]
|
|
16
|
+
expected_original = array.copy()
|
|
17
|
+
array.flags.writeable = not readonly
|
|
18
|
+
spatial = class_spatial(array)
|
|
19
|
+
|
|
20
|
+
rounded = spatial.round(decimals)
|
|
21
|
+
|
|
22
|
+
assert isinstance(rounded, class_spatial)
|
|
23
|
+
assert rounded.dtype == array.dtype
|
|
24
|
+
np.testing.assert_array_equal(rounded, np.round(expected_original, decimals))
|
|
25
|
+
np.testing.assert_array_equal(spatial, expected_original)
|
|
26
|
+
np.testing.assert_array_equal(array, expected_original)
|
|
27
|
+
assert not np.shares_memory(rounded, spatial)
|
|
28
|
+
|
|
29
|
+
|
|
8
30
|
@pytest.mark.parametrize("class_spatial", [Point, Vector, Points])
|
|
9
31
|
@pytest.mark.parametrize(
|
|
10
32
|
"array",
|
|
@@ -58,10 +58,10 @@ def test_dimension_of_slice():
|
|
|
58
58
|
assert points[:1, :].dimension == 3
|
|
59
59
|
assert points[:2, :].dimension == 3
|
|
60
60
|
|
|
61
|
-
# The
|
|
62
|
-
# so the
|
|
63
|
-
assert points[:, 0].dimension
|
|
64
|
-
assert points[0, :].dimension
|
|
61
|
+
# The points are no longer a 2D array,
|
|
62
|
+
# so the dimension becomes the length of the 1D array.
|
|
63
|
+
assert points[:, 0].dimension == 2
|
|
64
|
+
assert points[0, :].dimension == 3
|
|
65
65
|
|
|
66
66
|
|
|
67
67
|
@pytest.mark.parametrize(
|