@@ -1055,6 +1055,49 @@ def assign_coordinates(*args, **kwargs):
10551055
10561056
10571057def estimate_matching_threshold (coords_to_assign ):
1058+ """
1059+ Estimate the matching threshold based on coordinate resolution.
1060+
1061+ This function estimates a suitable threshold for matching coordinates by taking
1062+ twice the maximum resolution of the input coordinates (assuming a regular grid)
1063+
1064+ Parameters
1065+ ----------
1066+ coords_to_assign : array_like
1067+ An array of coordinates for which to estimate the threshold. The array
1068+ is expected to have a shape suitable for `get_resolution`, typically
1069+ (N, D) where N is the number of points and D is the dimensionality.
1070+
1071+ Returns
1072+ -------
1073+ float
1074+ The estimated matching threshold, calculated as 2 * max resolution.
1075+
1076+ Raises
1077+ ------
1078+ ValueError
1079+ If the input `coords_to_assign` contains fewer than two coordinates,
1080+ as resolution cannot be determined from a single point.
1081+
1082+ See Also
1083+ --------
1084+ get_resolution : Helper function to calculate the resolution of coordinates.
1085+
1086+ Notes
1087+ -----
1088+ The resolution is defined as the smallest non-zero difference between adjacent
1089+ sorted coordinate values.
1090+
1091+ Examples
1092+ --------
1093+ >>> coords = np.array([[10, 20], [10, 20.001], [10, 20.002]])
1094+ >>> estimate_matching_threshold(coords)
1095+ 0.002
1096+
1097+ >>> coords_1d = np.array([1.0, 1.1, 1.2])
1098+ >>> estimate_matching_threshold(coords_1d)
1099+ 0.2
1100+ """
10581101 if len (coords_to_assign ) < 2 :
10591102 raise ValueError (
10601103 "The coordinate assignement threshold cannot be"
0 commit comments