quatrope / astroalign

A tool to align astronomical images based on asterism matching
MIT License
140 stars 44 forks source link

[2.4.1] TestFewSources.test_register_threesources fails now (passed before) #81

Closed olebole closed 11 months ago

olebole commented 2 years ago

After uploading a version with #80 applied, TestFewSources.test_register_threesources fails during build:


self = <tests.test_align.TestFewSources testMethod=test_register_threesources>

    def test_register_threesources(self):
>       self.check_if_register_ok(3)

tests/test_align.py:622: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_align.py:603: in check_if_register_ok
    aligned, footprint = aa.register(self.image_ref, self.image)
astroalign.py:488: in register
    t, __ = find_transform(
astroalign.py:361: in find_transform
    best_t, inlier_ind = _ransac(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
data = array([], dtype=float64)
model = <astroalign._MatchTransform object at 0x7f49278a6500>, thresh = 2
min_matches = 1

    def _ransac(data, model, thresh, min_matches):
        """…"""
        good_fit = None
        n_data = data.shape[0]
        all_idxs = _np.arange(n_data)
        _np.random.shuffle(all_idxs)

        for iter_i in range(n_data):
            # Partition indices into two random subsets
            maybe_idxs = all_idxs[iter_i : iter_i + 1]
            test_idxs = list(all_idxs[:iter_i])
            test_idxs.extend(list(all_idxs[iter_i + 1 :]))
            test_idxs = _np.array(test_idxs)
            maybeinliers = data[maybe_idxs, :]
            test_points = data[test_idxs, :]
            maybemodel = model.fit(maybeinliers)
            test_err = model.get_error(test_points, maybemodel)
            # select indices of rows with accepted points
            also_idxs = test_idxs[test_err < thresh]
            alsoinliers = data[also_idxs, :]
            if len(alsoinliers) >= min_matches:
                good_data = _np.concatenate((maybeinliers, alsoinliers))
                good_fit = model.fit(good_data)
                break

        if good_fit is None:
>           raise MaxIterError(
                "List of matching triangles exhausted before an acceptable "
                "transformation was found"
            )
E           astroalign.MaxIterError: List of matching triangles exhausted before an acceptable transformation was found

astroalign.py:594: MaxIterError

In the build before, it succeeded.

Versions (unchanged since the last build):

Full build log here. Re-running the build (and the test) made this disappear.

martinberoiz commented 11 months ago

This has been merged already. Closing.