diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a7a7c85..796ac48 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -15,6 +15,10 @@ Release Notes using input catalogs that failed to align in the expanded reference catalog. [#195] +- Reduce memory & compute needed by _xy_2dhist by pruning distant + pairs with a kdtree. This is a purely internal change that does not + affect the results of the algorithm. [#196] + 0.8.5 (30-November-2023) ======================== diff --git a/tweakwcs/matchutils.py b/tweakwcs/matchutils.py index ad4aa04..d846494 100644 --- a/tweakwcs/matchutils.py +++ b/tweakwcs/matchutils.py @@ -278,9 +278,6 @@ def __call__(self, refcat, imcat, tp_pscale=1.0, tp_units=None, **kwargs): def _xy_2dhist(imgxy, refxy, r): - # This code replaces the C version (arrxyzero) from carrutils.c - # It is about 5-8 times slower than the C version. - # trim to only pairs within (r+0.5) * np.sqrt(2) using a kdtree # to avoid computing differences for many widely separated pairs. kdtree = spatial.KDTree(refxy) @@ -290,7 +287,7 @@ def _xy_2dhist(imgxy, refxy, r): if len(mi) > 0: mr = np.concatenate([n for n in neighbors if len(n) > 0]) else: - mr = mi.copy() + mr = mi dx = imgxy[mi, 0] - refxy[mr, 0] dy = imgxy[mi, 1] - refxy[mr, 1]