spacetelescope / spherical_geometry

A Python package for handling spherical polygons that represent arbitrary regions of the sky
http://spherical-geometry.readthedocs.io/
61 stars 31 forks source link

manylinux_x86_64: test_almost_identical_polygons_multi_union fails #245

Open pllim opened 11 months ago

pllim commented 11 months ago

As seen in https://github.com/spacetelescope/spherical_geometry/pull/243

__________________ test_almost_identical_polygons_multi_union __________________

      def test_almost_identical_polygons_multi_union():
          filename = resolve_imagename(ROOT_DIR,'almost_same_polygons.npz')
          polygon_data = np.load(filename)

          polygons = []
          for k in range(len(polygon_data.files) // 2):
              polygons.append(
                  polygon.SphericalPolygon(
                      polygon_data[f'p{k:02d}_points'],
                      inside=polygon_data[f'p{k:02d}_inside']
                  )
              )

          p = polygon.SphericalPolygon.multi_union(polygons)
          assert np.shape(list(p.points)[0]) == (66, 3)
  >       assert abs(p.area() - 2.6672666e-8) < 5.0e-14
  E       assert 5.698965248501529e-14 < 5e-14
  E        +  where 5.698965248501529e-14 = abs((2.6672609010347514e-08 - 2.6672666e-08))
  E        +    where 2.6672609010347514e-08 = <bound method SphericalPolygon.area of [[SingleSphericalPolygon(array([[-0.05465866, -0.87288723, -0.48485082],\n       [-0.05465473, -0.87288982, -0.4848466 ],\n       [-0.05464734, -0.8728947 , -0.48483865],\n       [-0.0546232 , -0.87291063, -0.48481268],\n       [-0.0546232 , -0.87291064, -0.48481267],\n       [-0.05462318, -0.87291065, -0.48481265],\n       [-0.05462318, -0.87291065, -0.48481265],\n       [-0.05462318, -0.87291065, -0.48481265],\n       [-0.05462317, -0.87291065, -0.48481265],\n       [-0.05462317, -0.87291065, -0.48481265],\n       [-0.05461225, -0.87291096, -0.48481332],\n       [-0.05461061, -0.87291101, -0.48481342],\n       [-0.054[602](https://github.com/spacetelescope/spherical_geometry/actions/runs/6491617529/job/17629196505?pr=243#step:7:615)35, -0.87291124, -0.48481393],\n       [-0.05460081, -0.87291129, -0.48481402],\n       [-0.05458605, -0.8729117 , -0.48481493],\n       [-0.05458491, -0.87291174, -0.484815  ],\n       [-0.05456053, -0.87291243, -0.48481651],\n       [-0.05455946, -0.87291246, -0.48481656],\n       [-0.05455799, -0.87291251, -0.48481665],\n       [-0.05455799, -0.87291251, -0.48481665],\n       [-0.05455799, -0.87291251, -0.48481665],\n       [-0.05455798, -0.87291251, -0.48481665],\n       [-0.05455798, -0.8729125 , -0.48481665],\n       [-0.05455798, -0.872912...  [-0.05466119, -0.87281977, -0.48497195],\n       [-0.0546624 , -0.87281977, -0.48497182],\n       [-0.05468149, -0.87281975, -0.48496972],\n       [-0.05468149, -0.87281975, -0.48496972],\n       [-0.05468149, -0.87281975, -0.48496972],\n       [-0.05468841, -0.87282346, -0.48496225],\n       [-0.05468841, -0.87282346, -0.48496225],\n       [-0.05468844, -0.87282346, -0.48496224],\n       [-0.05468982, -0.87282557, -0.48495829],\n       [-0.05468983, -0.87282559, -0.48495826],\n       [-0.05468983, -0.87282559, -0.48495826],\n       [-0.05468983, -0.87282559, -0.48495826],\n       [-0.05468983, -0.87282559, -0.48495826],\n       [-0.05468983, -0.87282559, -0.48495825],\n       [-0.05468983, -0.8728256 , -0.48495824],\n       [-0.05468983, -0.87282561, -0.48495823],\n       [-0.05469014, -0.87283431, -0.48494253],\n       [-0.05469014, -0.87283431, -0.48494253],\n       [-0.05468857, -0.87283875, -0.48493472],\n       [-0.05468857, -0.87283875, -0.48493471],\n       [-0.05468648, -0.87286071, -0.48489542],\n       [-0.05467726, -0.87287073, -0.48487843],\n       [-0.0546[603](https://github.com/spacetelescope/spherical_geometry/actions/runs/6491617529/job/17629196505?pr=243#step:7:616)4, -0.87288613, -0.48485262],\n       [-0.05465866, -0.87288723, -0.48485082]]), array([-0.05451683, -0.87289831, -0.48484683]))]]>()
  E        +      where <bound method SphericalPolygon.area of [[SingleSphericalPolygon(array([[-0.05465866, -0.87288723, -0.48485082],\n       [-0.05465473, -0.87288982, -0.4848466 ],\n       [-0.05464734, -0.8728947 , -0.48483865],\n       [-0.0546232 , -0.87291063, -0.48481268],\n       [-0.0546232 , -0.87291064, -0.48481267],\n       [-0.05462318, -0.87291065, -0.48481265],\n       [-0.05462318, -0.87291065, -0.48481265],\n       [-0.05462318, -0.87291065, -0.48481265],\n       [-0.05462317, -0.87291065, -0.48481265],\n       [-0.05462317, -0.87291065, -0.48481265],\n       [-0.05461225, -0.87291096, -0.48481332],\n       [-0.05461061, -0.87291101, -0.48481342],\n       [-0.05460235, -0.87291124, -0.48481393],\n       [-0.05460081, -0.87291129, -0.48481402],\n       [-0.05458[605](https://github.com/spacetelescope/spherical_geometry/actions/runs/6491617529/job/17629196505?pr=243#step:7:618), -0.8729117 , -0.48481493],\n       [-0.05458491, -0.87291174, -0.484815  ],\n       [-0.05456053, -0.87291243, -0.48481651],\n       [-0.05455946, -0.87291246, -0.48481656],\n       [-0.05455799, -0.87291251, -0.48481665],\n       [-0.05455799, -0.87291251, -0.48481665],\n       [-0.05455799, -0.87291251, -0.48481665],\n       [-0.05455798, -0.87291251, -0.48481665],\n       [-0.05455798, -0.8729125 , -0.48481665],\n       [-0.05455798, -0.872912...  [-0.05466119, -0.87281977, -0.48497195],\n       [-0.0546624 , -0.87281977, -0.48497182],\n       [-0.05468149, -0.87281975, -0.48496972],\n       [-0.05468149, -0.87281975, -0.48496972],\n       [-0.05468149, -0.87281975, -0.48496972],\n       [-0.05468841, -0.87282346, -0.48496225],\n       [-0.05468841, -0.87282346, -0.48496225],\n       [-0.05468844, -0.87282346, -0.48496224],\n       [-0.05468982, -0.87282557, -0.48495829],\n       [-0.05468983, -0.87282559, -0.48495826],\n       [-0.05468983, -0.87282559, -0.48495826],\n       [-0.05468983, -0.87282559, -0.48495826],\n       [-0.05468983, -0.87282559, -0.48495826],\n       [-0.05468983, -0.87282559, -0.48495825],\n       [-0.05468983, -0.8728256 , -0.48495824],\n       [-0.05468983, -0.87282561, -0.48495823],\n       [-0.05469014, -0.87283431, -0.48494253],\n       [-0.05469014, -0.87283431, -0.48494253],\n       [-0.05468857, -0.87283875, -0.48493472],\n       [-0.05468857, -0.87283875, -0.48493471],\n       [-0.05468648, -0.8728[607](https://github.com/spacetelescope/spherical_geometry/actions/runs/6491617529/job/17629196505?pr=243#step:7:620)1, -0.48489542],\n       [-0.05467726, -0.87287073, -0.48487843],\n       [-0.05466034, -0.87288613, -0.48485262],\n       [-0.05465866, -0.87288723, -0.48485082]]), array([-0.05451683, -0.87289831, -0.48484683]))]]> = [[SingleSphericalPolygon(array([[-0.05465866, -0.87288723, -0.48485082],\n       [-0.05465473, -0.87288982, -0.4848466 ],\n       [-0.05464734, -0.8728947 , -0.48483865],\n       [-0.0546232 , -0.87291063, -0.48481268],\n       [-0.0546232 , -0.87291064, -0.48481267],\n       [-0.05462318, -0.87291065, -0.48481265],\n       [-0.05462318, -0.87291065, -0.48481265],\n       [-0.05462318, -0.87291065, -0.48481265],\n       [-0.05462317, -0.87291065, -0.48481265],\n       [-0.05462317, -0.87291065, -0.48481265],\n       [-0.05461225, -0.87291096, -0.48481332],\n       [-0.054[610](https://github.com/spacetelescope/spherical_geometry/actions/runs/6491617529/job/17629196505?pr=243#step:7:623)61, -0.87291101, -0.48481342],\n       [-0.05460235, -0.87291124, -0.48481393],\n       [-0.05460081, -0.87291129, -0.48481402],\n       [-0.05458605, -0.8729117 , -0.48481493],\n       [-0.05458491, -0.87291174, -0.484815  ],\n       [-0.05456053, -0.87291243, -0.48481651],\n       [-0.05455946, -0.87291246, -0.48481656],\n       [-0.05455799, -0.87291251, -0.48481665],\n       [-0.05455799, -0.87291251, -0.48481665],\n       [-0.05455799, -0.87291251, -0.48481665],\n       [-0.05455798, -0.87291251, -0.48481665],\n       [-0.05455798, -0.8729125 , -0.48481665],\n       [-0.05455798, -0.8729125 , -0.48481665],\n       [-0.0545174 , ...   [-0.0546[611](https://github.com/spacetelescope/spherical_geometry/actions/runs/6491617529/job/17629196505?pr=243#step:7:624)9, -0.87281977, -0.48497195],\n       [-0.0546624 , -0.87281977, -0.48497182],\n       [-0.05468149, -0.87281975, -0.48496972],\n       [-0.05468149, -0.87281975, -0.48496972],\n       [-0.05468149, -0.87281975, -0.48496972],\n       [-0.05468841, -0.87282346, -0.48496225],\n       [-0.05468841, -0.87282346, -0.48496225],\n       [-0.05468844, -0.87282346, -0.48496224],\n       [-0.05468982, -0.87282557, -0.48495829],\n       [-0.05468983, -0.87282559, -0.48495826],\n       [-0.05468983, -0.87282559, -0.48495826],\n       [-0.05468983, -0.87282559, -0.48495826],\n       [-0.05468983, -0.87282559, -0.48495826],\n       [-0.05468983, -0.87282559, -0.48495825],\n       [-0.05468983, -0.8728256 , -0.48495824],\n       [-0.05468983, -0.87282561, -0.48495823],\n       [-0.05469014, -0.87283431, -0.48494253],\n       [-0.05469014, -0.87283431, -0.48494253],\n       [-0.05468857, -0.87283875, -0.48493472],\n       [-0.05468857, -0.87283875, -0.48493471],\n       [-0.05468648, -0.87286071, -0.48489542],\n       [-0.05467726, -0.87287073, -0.48487843],\n       [-0.05466034, -0.87288[613](https://github.com/spacetelescope/spherical_geometry/actions/runs/6491617529/job/17629196505?pr=243#step:7:626), -0.48485262],\n       [-0.05465866, -0.87288723, -0.48485082]]), array([-0.05451683, -0.87289831, -0.48484683]))]].area

spherical_geometry/tests/test_union.py:343: AssertionError
pllim commented 11 months ago

Might be transient, not sure. I don't see it all the time.

pllim commented 11 months ago

Now I also see it on OSX over at https://github.com/spacetelescope/spherical_geometry/pull/246 🤯

Maybe a race condition somewhere?