gridpoints 1.0.4__tar.gz → 1.0.5__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gridpoints
3
- Version: 1.0.4
3
+ Version: 1.0.5
4
4
  Summary: fast multidimensional sorting tool for point clouds using the monotonic lagrangian grid
5
5
  Author: Armand de Cacqueray
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "gridpoints"
7
- version = "1.0.4"
7
+ version = "1.0.5"
8
8
  description = "fast multidimensional sorting tool for point clouds using the monotonic lagrangian grid "
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -7,4 +7,4 @@ __all__ = (
7
7
  print_zoom,
8
8
  )
9
9
 
10
- __version__ = "1.0.4"
10
+ __version__ = "1.0.5"
@@ -8,4 +8,4 @@ __all__ = (
8
8
  "invert_permutation",
9
9
  )
10
10
 
11
- __version__ = "1.0.4"
11
+ __version__ = "1.0.5"
@@ -18,7 +18,7 @@ from .kdtree import kdtree_order
18
18
  # Sorting API
19
19
  # ============================================
20
20
 
21
- def argsort(X, gridshape, level=2, init="kdtree", n_iter=40, verbose = 2):
21
+ def argsort(X, gridshape, verbose = 2, level=2, init="kdtree", n_iter=40):
22
22
  """Compute a multi-directional monotonic sorted ordering of a point cloud.
23
23
 
24
24
  Parameters
@@ -33,6 +33,8 @@ def argsort(X, gridshape, level=2, init="kdtree", n_iter=40, verbose = 2):
33
33
  Note: Point clouds can be padded with +/- infinity placeholders to reach
34
34
  a valid grid size. NaNs can also be used, but will be placed randomly
35
35
  rather than pushed to grid boundaries.
36
+ verbose : int, default 2
37
+ 0 = silent, 1 = log progress, 2 = 1 + warn if convergence failed
36
38
  level : {1, 2, 3}, default=2
37
39
  Maximum order of lattice directions considered. Higher values improve
38
40
  grid quality at the expense of computational speed. Note that `level=3`
@@ -42,8 +44,6 @@ def argsort(X, gridshape, level=2, init="kdtree", n_iter=40, verbose = 2):
42
44
  if the point cloud is already nearly sorted.
43
45
  n_iter : int, default=40
44
46
  Maximum number of optimization iterations.
45
- verbose : int, default 2
46
- 0 = silent, 1 = log progress, 2 = 1 + warn if convergence failed
47
47
 
48
48
  Returns
49
49
  -------
@@ -79,21 +79,22 @@ def argsort(X, gridshape, level=2, init="kdtree", n_iter=40, verbose = 2):
79
79
  X[order], gridshape, level=level, n_iter=n_iter, verbose = verbose
80
80
  )
81
81
  order = order[ordernew]
82
- if not converged and verbose >=2:
83
- warnings.warn(
84
- f"Algorithm failed to converge after {n_iter} iterations.\n " \
85
- "Consider checking if the grid structure is already suitable \n" \
86
- "for the given task, which is higly probable, or increase the \n" \
87
- "`n_iter` parameter if strict convergence is required.",
88
- category=ConvergenceWarning,
89
- stacklevel=2
90
- )
82
+ if not converged and verbose >=2:
83
+ warnings.warn(
84
+ f"Algorithm failed to converge after {n_iter} iterations.\n " \
85
+ "Consider checking if the grid structure is already suitable \n" \
86
+ "for the given task, which is higly probable, or increase the \n" \
87
+ "`n_iter` parameter if strict convergence is required.\n",
88
+ "(to shutup this warning, run the sort with verbose <= 1)",
89
+ category=ConvergenceWarning,
90
+ stacklevel=2
91
+ )
91
92
  if verbose:
92
93
  print("done")
93
94
  return order
94
95
 
95
96
 
96
- def sort(X, gridshape, level=2, init="kdtree", inplace=False, n_iter=40, verbose = 2):
97
+ def sort(X, gridshape, verbose = 2, level=2, init="kdtree", inplace=False, n_iter=40):
97
98
  """Sort a point cloud `X` using the monotonic Lagrangian algorithm.
98
99
 
99
100
  Parameters
@@ -108,6 +109,8 @@ def sort(X, gridshape, level=2, init="kdtree", inplace=False, n_iter=40, verbose
108
109
  Note: Point clouds can be padded with +/- infinity placeholders to reach
109
110
  a valid grid size. NaNs can also be used, but will be placed randomly
110
111
  rather than pushed to grid boundaries.
112
+ verbose : int, default 2
113
+ 0 = silent, 1 = log progress, 2 = 1 + warn if convergence failed
111
114
  level : {1, 2, 3}, default=1
112
115
  Maximum order of lattice directions considered. Higher values improve
113
116
  grid quality at the expense of computational speed. Note that `level=3`
@@ -119,8 +122,6 @@ def sort(X, gridshape, level=2, init="kdtree", inplace=False, n_iter=40, verbose
119
122
  If True, modify the point cloud `X` in place.
120
123
  n_iter : int, default=40
121
124
  Maximum number of optimization iterations.
122
- verbose : int, default 2
123
- 0 = silent, 1 = log progress, 2 = 1 + warn if convergence failed
124
125
 
125
126
  Returns
126
127
  -------
@@ -128,7 +129,7 @@ def sort(X, gridshape, level=2, init="kdtree", inplace=False, n_iter=40, verbose
128
129
  The sorted point cloud such that `X_sorted.reshape(*shape, D)` forms a
129
130
  monotonically sorted grid. Returns `None` if `inplace=True`.
130
131
  """
131
- order = argsort(X, gridshape, level=level, init = init, n_iter=n_iter,verbose = verbose)
132
+ order = argsort(X, gridshape, verbose = verbose, level=level, init = init, n_iter=n_iter)
132
133
 
133
134
  if inplace:
134
135
  X[:] = X[order]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gridpoints
3
- Version: 1.0.4
3
+ Version: 1.0.5
4
4
  Summary: fast multidimensional sorting tool for point clouds using the monotonic lagrangian grid
5
5
  Author: Armand de Cacqueray
6
6
  License: MIT
File without changes
File without changes
File without changes