Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed test: test_overlap #252

Closed
Hellseher opened this issue Oct 22, 2023 · 10 comments
Closed

Failed test: test_overlap #252

Hellseher opened this issue Oct 22, 2023 · 10 comments
Labels

Comments

@Hellseher
Copy link

Hi!

version: 1.2.22

I tried to enable as much test as possible while preparing update for Guix and
faced only with one failed test:

_________________________________ test_overlap _________________________________

    def test_overlap():
        def build_polygon(offset):
            points = []
            corners = [(0.0, 0.0), (0.0, 10.0), (10.0, 10.0), (10.0, 0.0)]
            for corner in corners:
                point = np.asarray(corner)
                point[0] += offset
                points.append(np.asarray(vector.lonlat_to_vector(point[0],
                                                                 point[1])))
            poly = polygon.SphericalPolygon(points)
            return poly

        first_poly = build_polygon(0.0)
        for i in range(11):
            offset = float(i)
            second_poly = build_polygon(offset)
>           overlap_area = first_poly.overlap(second_poly)

spherical_geometry/tests/test_basic.py:176:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
spherical_geometry/polygon.py:687: in overlap
    intersection = self.intersection(other)
spherical_geometry/polygon.py:1209: in intersection
    subpolygons = polya.intersection(polyb)
spherical_geometry/polygon.py:664: in intersection
    return g.intersection()
spherical_geometry/graph.py:444: in intersection
    self._sanity_check("intersection: remove cut lines")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <spherical_geometry.graph.Graph object at 0x7fff72d3e9b0>
msg = 'intersection: remove cut lines', node_is_2 = False

    def _sanity_check(self, msg, node_is_2=False):
        """
        For debugging purposes: assert that edges and nodes are
        connected to each other correctly and there are no orphaned
        edges or nodes.
        """
        if not DEBUG:
            return

        unique_edges = set()
        for edge in self._edges:
            for node in edge._nodes:
                if edge not in node._edges or node not in self._nodes:
                    raise MalformedPolygonError(msg)
            edge_repr = [tuple(x._point) for x in edge._nodes]
            edge_repr.sort()
            edge_repr = tuple(edge_repr)
            # assert edge_repr not in unique_edges
            unique_edges.add(edge_repr)

        for node in self._nodes:
            if node_is_2:
                if len(node._edges) % 2 != 0:
                    raise MalformedPolygonError(msg)
            else:
                if not len(node._edges) >= 2:
>                   raise MalformedPolygonError(msg)
E                   spherical_geometry.polygon.MalformedPolygonError: intersection: remove cut lines

spherical_geometry/graph.py:392: MalformedPolygonError
=============================== warnings summary ===============================
../../../gnu/store/06cjgrygh79bxbsr0x44ryx1wy1pwvh4-python-setuptools-67.6.1/lib/python3.10/site-packages/pkg_resources/__init__.py:121
  /gnu/store/06cjgrygh79bxbsr0x44ryx1wy1pwvh4-python-setuptools-67.6.1/lib/python3.10/site-packages/pkg_resources/__init__.py:121: DeprecationWarning: pkg_resources is deprecated as an API
    warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)
    spherical_geometry/tests/test_intersection.py::test4
spherical_geometry/tests/test_union.py::test5
spherical_geometry/tests/test_union.py::test7
  /gnu/store/sflwbnc30p1g0fs9wfvbwsrbmlvbngl1-python-astropy-5.3.3/lib/python3.10/site-packages/astropy/wcs/wcs.py:551: FITSFixedWarning: CPERROR1= 0.0 / Maximum error of NPOL correction for axis 1
  keyword looks very much like CPERRja but isn't.
    wcsprm = _wcs.Wcsprm(

spherical_geometry/tests/test_intersection.py::test4
spherical_geometry/tests/test_union.py::test5
spherical_geometry/tests/test_union.py::test7
  /gnu/store/sflwbnc30p1g0fs9wfvbwsrbmlvbngl1-python-astropy-5.3.3/lib/python3.10/site-packages/astropy/wcs/wcs.py:551: FITSFixedWarning: CPERROR2= 0.0 / Maximum error of NPOL correction for axis 2
  keyword looks very much like CPERRja but isn't.
    wcsprm = _wcs.Wcsprm(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED spherical_geometry/tests/test_basic.py::test_overlap - spherical_geome...
======= 1 failed, 47 passed, 1 skipped, 7 warnings in 255.79s (0:04:15) ========

Used inputs:

@pllim pllim added the bug label Oct 25, 2023
@mcara
Copy link
Member

mcara commented Oct 27, 2023

I am not familiar with Guix. I run tests with all these versions (however, using the included version of qd with the spherical_geometry version 1.2.22) and I was unable to reproduce this failure.

@pllim
Copy link
Contributor

pllim commented Oct 31, 2023

@Hellseher , does GUIX provide any image that can be used in GitHub Actions so we can try to reproduce this failure in the CI? Or anything close enough at https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources or https://github.com/uraimo/run-on-arch-action ?

@pllim
Copy link
Contributor

pllim commented Oct 31, 2023

By the way, how did you get qd 2.3.23? I cannot find it on GitHub. The closest I found was https://github.com/scibuilder/QD and that one was from 8 years ago at 2.3.17.

@pllim
Copy link
Contributor

pllim commented Oct 31, 2023

Also maybe relevant: #227 (comment)

@Universebenzene
Copy link

By the way, how did you get qd 2.3.23? I cannot find it on GitHub. The closest I found was https://github.com/scibuilder/QD and that one was from 8 years ago at 2.3.17.

Here on the offical page

@Hellseher
Copy link
Author

Hellseher commented Nov 1, 2023

Hi @pllim,

There is GHA available which provides Guix https://github.com/PromyLOPh/guix-install-action
Example on how it's implemented in CI: https://github.com/artyom-poptsov/guile-ssh/blob/master/.github/workflows/guix.yml

The code was pulled from author's home page:
Used source in Guix: https://crd-legacy.lbl.gov/~dhbailey/mpdist/qd-2.3.23.tar.gz
Link to the package on home page: https://www.davidhbailey.com/dhbsoftware/qd-2.3.23.tar.gz
Author's home page: https://www.davidhbailey.com/dhbsoftware/

Thanks,
Oleg

@pllim
Copy link
Contributor

pllim commented Nov 1, 2023

Thanks, @Hellseher ! There is now a separate but related discussion on whether system qd is even supported, please see #255 .

@pllim
Copy link
Contributor

pllim commented Nov 3, 2023

Re: #252 (comment)

@Hellseher , I am not familiar with GUIX at all so it is unclear to me how this package can model after https://github.com/artyom-poptsov/guile-ssh/blob/master/.github/workflows/guix.yml . We have no plans to ship nor maintain any guix.scm file. Is it not possible to do a normal pip install in GUIX? Is there an image that comes with your system qd already available?

@Hellseher
Copy link
Author

Hi @pllim

I agree that Guix is not in top mainstream of GNU/Linux distributions. You don't
need to provide guix.scm in the project to build with newer version of any
inputs. If it helps it comes as ready to use package in Debian and Ubuntu.

pip is available, but it does not guaranty reproducibility on other machines
with different system wide libraries.

I'm not sure which image you refer to, there are ISO and Qemu images availalbe on homepage https://guix.gnu.org/en/download/

I would expect this issue will be resolved after new release with latest qd version (#227, #255 ).

If it would be actual after all related dependencies are updated I'll prepare
reducible GitHub Actions script.

Thanks,
Oleg

@pllim
Copy link
Contributor

pllim commented Nov 7, 2023

OK looks like it won't be trivial to add GUIX to our CI and I don't think this is an issue anymore now that there is a qd 2.3.24, so closing. Thanks!

@pllim pllim closed this as completed Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants