Repository: spacetelescope/acstools (language: python)

Issue:
TST: 5 test failures in test_wfc_destripe.py in devdeps
Example log: https://github.com/spacetelescope/acstools/actions/runs/6627739837/job/18206557160

```
Package versions: 
Numpy: 2.0.0.dev0+git20231027.cdfbdf4
Scipy: 1.12.0.dev0+1899.e35850d
Matplotlib: 3.9.0.dev355+g21ce59212d
Astropy: 6.1.dev0
beautifulsoup4: not available
requests: 2.31.0
stsci.tools: 4.1.0
...
../../acstools/tests/test_wfc_destripe.py::TestDestripe::test_generic[jb5g05ubq] FAILED [ 50%]
../../acstools/tests/test_wfc_destripe.py::TestDestripe::test_generic[ja0x03ojq] FAILED [ 58%]
../../acstools/tests/test_wfc_destripe.py::TestDestripe::test_generic[jc5001soq] FAILED [ 66%]
../../acstools/tests/test_wfc_destripe.py::TestDestripe::test_fullframe_flashed FAILED [ 75%]
../../acstools/tests/test_wfc_destripe.py::TestDestripe::test_fullframe_masked FAILED [ 83%]
```

These appears to be floating point differences. So someone who is familiar with the destriping algorithm should double check to make sure that these differences are acceptable, and if not, what kind of fixes are needed to make destriping compatible with unreleased versions of numpy/scipy/astropy/etc.

```
E           Extension HDU 1 (SCI, 1):
E           
E              Data contains differences:
E                Data differs at [np.int64(727), np.int64(6)]:
E                   a> np.float32(0.9507208)
E                    ?                   ^^
E                   b> np.float32(0.9507245)
E                    ?    
```


Discussion / hints:
I took a look at the discrepancies and consulted with Norman. Given that the differences are all in the 5th or 6th significant figure and affect <2.5% of pixels in the detector, they are minor enough to ignore. Let me know if there's anything else I can help with.
Thanks! I can look into adjusting the tests when I have time. This is not urgent for now.
I have https://github.com/spacetelescope/acstools/pull/185 that would make the CI green but I did find some difference that require me to set the tolerance very high (`atol=0.1`). Is this something you would accept as a solution? If not, what was the new tolerance you were thinking about (how relaxed are you willing to go)?
I confirmed that the failures are caused by numpy 2.0.dev , not scipy nor astropy dev versions. See https://github.com/spacetelescope/acstools/pull/187#issuecomment-1808525932

Fix patch:
diff --git a/acstools/utils_findsat_mrt.py b/acstools/utils_findsat_mrt.py
index cdaa87a7..51637cd1 100644
--- a/acstools/utils_findsat_mrt.py
+++ b/acstools/utils_findsat_mrt.py
@@ -20,8 +20,8 @@
     from skimage import transform
     from skimage.transform._warps import warp
     from skimage._shared.utils import convert_to_float
-except ImportError:
-    warnings.warn('skimage not installed. MRT calculation will not work.')
+except ImportError as e:
+    warnings.warn(f'skimage not installed. MRT calculation will not work: {repr(e)}')
 
 # check for scipy
 try:
diff --git a/doc/source/index.rst b/doc/source/index.rst
index 49448f25..d6a14d43 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -5,7 +5,7 @@ ACSTOOLS
 ########
 
 Software tools for
-`Advanced Camera for Surveys (ACS) <http://www.stsci.edu/hst/acs/>`_.
+`Advanced Camera for Surveys (ACS) <https://www.stsci.edu/hst/acs/>`_.
 
 Different ways to install the latest release of this package::
 
diff --git a/setup.cfg b/setup.cfg
index 555a3651..5cb16741 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -87,6 +87,8 @@ filterwarnings =
   # Ignore numpy 2.0 warning, see https://github.com/astropy/astropy/pull/15495
   # and https://github.com/scipy/scipy/pull/19275
   ignore:.*numpy\.core.*:DeprecationWarning
+  # Do not let broken scikit-image block the rest of test suite
+  ignore:skimage not installed
 
 [flake8]
 # Ignoring these for now:
diff --git a/tox.ini b/tox.ini
index b859d32f..a3e4ddeb 100644
--- a/tox.ini
+++ b/tox.ini
@@ -11,7 +11,7 @@ envlist =
 passenv = HOME,CI,jref
 
 setenv =
-    devdeps: PIP_EXTRA_INDEX_URL = https://pypi.anaconda.org/astropy/simple https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
+    devdeps: PIP_EXTRA_INDEX_URL = https://pypi.anaconda.org/astropy/simple https://pypi.anaconda.org/liberfa/simple https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
 
 # Run the tests in a temporary directory to make sure that we don't import
 # package from the source tree
@@ -38,6 +38,7 @@ deps =
     devdeps: scipy>=0.0.dev0
     devdeps: matplotlib>=0.0.dev0
     devdeps: scikit-image>=0.0.dev0
+    devdeps: pyerfa>=0.0.dev0
     devdeps: astropy>=0.0.dev0
     devdeps: git+https://github.com/astropy/photutils.git
     devdeps: git+https://github.com/spacetelescope/ci_watson.git


Test patch:
diff --git a/acstools/tests/test_wfc_destripe.py b/acstools/tests/test_wfc_destripe.py
index 67e08e38..533fb73b 100644
--- a/acstools/tests/test_wfc_destripe.py
+++ b/acstools/tests/test_wfc_destripe.py
@@ -26,7 +26,9 @@ def _destripe_one(self, inputfile, outsuffix, outputfile, truthfile,
                                mask1=masks[0], mask2=masks[1])
 
         # Compare results
-        self.compare_outputs([(outputfile, truthfile)], rtol=1e-6)
+        # NOTE: atol instead of rtol was set due to numpy 2.0,
+        # see https://github.com/spacetelescope/acstools/issues/184
+        self.compare_outputs([(outputfile, truthfile)], atol=0.01)
 
     # jb5g05ubq = calibrated post-SM4 WFC full-frame exposures without masks
     # ja0x03ojq = calibrated polarizer WFC subarray exposures
diff --git a/acstools/tests/test_wfc_findsat_mrt.py b/acstools/tests/test_wfc_findsat_mrt.py
index e7045f7e..743908b3 100644
--- a/acstools/tests/test_wfc_findsat_mrt.py
+++ b/acstools/tests/test_wfc_findsat_mrt.py
@@ -1,11 +1,14 @@
 '''Test satellite trail detection and masking using findsat_mrt.'''
 import os
 
+import pytest
 from astropy.io.fits import FITSDiff
 from astropy.utils.data import get_pkg_data_filename
 
 from acstools.findsat_mrt import WfcWrapper
 
+pytest.importorskip("skimage")
+
 
 def test_WfcWrapper(tmp_path):
     """Identify and mask trails in WFC extension 4."""
diff --git a/acstools/tests/test_wfc_satdet.py b/acstools/tests/test_wfc_satdet.py
index 90d72649..1434095f 100644
--- a/acstools/tests/test_wfc_satdet.py
+++ b/acstools/tests/test_wfc_satdet.py
@@ -3,10 +3,14 @@
 .. note:: Cannot test ``detsat()`` because PHT results change from run to run!
 
 """
+import pytest
+
 from acstools import satdet
 from acstools.utils_findsat_mrt import update_dq
 from acstools.tests.helpers import BaseACSTOOLS
 
+pytest.importorskip("skimage")
+
 
 class TestSatDet(BaseACSTOOLS):
     detector = 'wfc'