Repository: pyqtgraph/pyqtgraph

Issue:
Errors encountered when running tests on risc-v platform
<!-- In the following, please describe your issue in detail! -->
<!-- If some sections do not apply, just remove them. -->

### Short description
Encountered an AssertionError in `test_makeARGB.py` and `test_ROI.py` while testing on a RISC-V architecture. 

### Code to reproduce
1. `git clone https://github.com/pyqtgraph/pyqtgraph.git` then `cd pyqtgraph`
2. Run python3 test.py
3. Test Failed


### Expected behavior
<!-- What should happen? -->
The tests should pass without any assertion errors.

### Real behavior
The test fails with the following information:

```
<mock-chroot> sh-5.2# python3 test.py
sys.platform: linux
sys.version: 3.12.0 (main, Oct  5 2023, 00:00:00) [GCC 13.2.1 20231110 (Red Hat 13.2.1-5)]
qt bindings: PyQt5 5.15.10 Qt 5.15.11
pyqtgraph: 0.13.5.dev0; None
config:
{'antialias': False,
 'background': 'k',
 'crashWarning': False,
 'editorCommand': None,
 'enableExperimental': False,
 'exitCleanup': True,
 'foreground': 'd',
 'imageAxisOrder': 'col-major',
 'leftButtonPan': True,
 'mouseRateLimit': 100,
 'segmentedLineMode': 'auto',
 'useCupy': False,
 'useNumba': False,
 'useOpenGL': False}
============================================== test session starts ===============================================
platform linux -- Python 3.12.0, pytest-7.4.3, pluggy-1.3.0
rootdir: /builddir/pyqtgraph
configfile: pytest.ini
plugins: xvfb-2.0.0
collected 457 items / 2 skipped

pyqtgraph/examples/test_examples.py ....................................s................................. [ 15%]
.s.s.........................                                                                              [ 21%]
tests/test_Point.py .................                                                                      [ 25%]
tests/test_Vector.py ..                                                                                    [ 25%]
tests/test_canvas_manager_crash.py .                                                                       [ 26%]
tests/test_colormap.py ......                                                                              [ 27%]
tests/test_configparser.py ..                                                                              [ 27%]
tests/test_functions.py .................................................................................. [ 45%]
..........................................                                                                 [ 54%]
tests/test_makeARGB.py Fss.                                                                                [ 55%]
tests/test_pickles.py ..                                                                                   [ 56%]
tests/test_qimage_writethru.py .                                                                           [ 56%]
tests/test_qmenu_leak_workaround.py .                                                                      [ 56%]
tests/test_qpainterpathprivate.py ..                                                                       [ 57%]
tests/test_qt.py ..                                                                                        [ 57%]
tests/test_ref_cycles.py ..                                                                                [ 57%]
tests/test_reload.py .                                                                                     [ 58%]
tests/test_signalproxy.py ....                                                                             [ 59%]
tests/test_srttransform3d.py .                                                                             [ 59%]
tests/test_stability.py .                                                                                  [ 59%]
tests/dockarea/test_dock.py ....                                                                           [ 60%]
tests/dockarea/test_dockarea.py .                                                                          [ 60%]
tests/exporters/test_csv.py ..                                                                             [ 61%]
tests/exporters/test_exporter_dialog.py .                                                                  [ 61%]
tests/exporters/test_hdf5.py ...                                                                           [ 61%]
tests/exporters/test_image.py ..                                                                           [ 62%]
tests/exporters/test_svg.py ..                                                                             [ 62%]
tests/graphicsItems/test_ArrowItem.py .                                                                    [ 63%]
tests/graphicsItems/test_AxisItem.py ..............                                                        [ 66%]
tests/graphicsItems/test_ErrorBarItem.py .                                                                 [ 66%]
tests/graphicsItems/test_GraphicsItem.py ..                                                                [ 66%]
tests/graphicsItems/test_ImageItem.py ss....                                                               [ 68%]
tests/graphicsItems/test_ImageItemFormat.py ...                                                            [ 68%]
tests/graphicsItems/test_InfiniteLine.py ..                                                                [ 69%]
tests/graphicsItems/test_LegendItem.py .                                                                   [ 69%]
tests/graphicsItems/test_LinearRegionItem.py .....                                                         [ 70%]
tests/graphicsItems/test_NonUniformImage.py .....                                                          [ 71%]
tests/graphicsItems/test_PlotCurveItem.py ..                                                               [ 71%]
tests/graphicsItems/test_PlotDataItem.py .........                                                         [ 73%]
tests/graphicsItems/test_ROI.py ....F....                                                                  [ 75%]
tests/graphicsItems/test_ScatterPlotItem.py ..                                                             [ 76%]
tests/graphicsItems/test_TextItem.py .                                                                     [ 76%]
tests/graphicsItems/PlotItem/test_PlotItem.py .......................                                      [ 81%]
tests/graphicsItems/ViewBox/test_ViewBox.py ..s                                                            [ 82%]
tests/graphicsItems/ViewBox/test_ViewBoxZoom.py ........                                                   [ 84%]
tests/imageview/test_imageview.py ...                                                                      [ 84%]
tests/opengl/items/test_GLAxisItem.py .                                                                    [ 84%]
tests/opengl/items/test_GLBarGraphItem.py .                                                                [ 85%]
tests/opengl/items/test_GLBoxItem.py .                                                                     [ 85%]
tests/opengl/items/test_GLGradientLegendItem.py .                                                          [ 85%]
tests/opengl/items/test_GLGraphItem.py .                                                                   [ 85%]
tests/opengl/items/test_GLGridItem.py .                                                                    [ 85%]
tests/opengl/items/test_GLImageItem.py .                                                                   [ 86%]
tests/opengl/items/test_GLLinePlotItem.py .                                                                [ 86%]
tests/opengl/items/test_GLMeshItem.py .                                                                    [ 86%]
tests/opengl/items/test_GLScatterPlotItem.py .                                                             [ 86%]
tests/opengl/items/test_GLSurfacePlotItem.py .                                                             [ 87%]
tests/opengl/items/test_GLTextItem.py .                                                                    [ 87%]
tests/opengl/items/test_GLVolumeItem.py .                                                                  [ 87%]
tests/parametertree/test_Parameter.py ......................                                               [ 92%]
tests/parametertree/test_parametertypes.py ........                                                        [ 94%]
tests/widgets/test_busycursor.py .                                                                         [ 94%]
tests/widgets/test_combobox.py .                                                                           [ 94%]
tests/widgets/test_graphics_view.py .                                                                      [ 94%]
tests/widgets/test_histogramlutwidget.py .                                                                 [ 94%]
tests/widgets/test_progressdialog.py .                                                                     [ 95%]
tests/widgets/test_spinbox.py .....................                                                        [ 99%]
tests/widgets/test_tablewidget.py .                                                                        [100%]

==================================================== FAILURES ====================================================
___________________________________ test_makeARGB_against_generated_references ___________________________________

    def test_makeARGB_against_generated_references():
        def assert_correct(data, key, levels, lut, scale, use_rgba):
            expectation = EXPECTED_OUTPUTS[key]
            if isinstance(expectation, type) and issubclass(expectation, Exception):
                try:
                    _makeARGB(data, lut=lut, levels=levels, scale=scale, useRGBA=use_rgba)
                except Exception as e:
                    assert expectation == type(e)
                else:
                    assert False, f"makeARGB({key!r}) was supposed to raise {expectation} but didn't raise anything."
            else:
                output, alpha = _makeARGB(data, lut=lut, levels=levels, scale=scale, useRGBA=use_rgba)
                assert (
                    output == expectation
                ).all(), f"Incorrect _makeARGB({key!r}) output! Expected:\n{expectation!r}\n  Got:\n{output!r}"

>       _do_something_for_every_combo(assert_correct)

tests/test_makeARGB.py:4295:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_makeARGB.py:4246: in _do_something_for_every_combo
    func(data, key, levels, lut, scale, use_rgba)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

data = array([[       inf, 0.53662884,        nan, 0.8853132 ],
       [0.8496698 , 0.88006145, 1.        , 0.06621328],
    ...99158293, 0.8476984 , 0.16672458, 0.9887786 ],
       [0.07076367, 0.66354364, 0.8781082 , 0.988832  ]], dtype=float32)
key = (<class 'numpy.float32'>, '2D', 'SIMPLE', None, None, True), levels = (0, 1), lut = None, scale = None
use_rgba = True

    def assert_correct(data, key, levels, lut, scale, use_rgba):
        expectation = EXPECTED_OUTPUTS[key]
        if isinstance(expectation, type) and issubclass(expectation, Exception):
            try:
                _makeARGB(data, lut=lut, levels=levels, scale=scale, useRGBA=use_rgba)
            except Exception as e:
                assert expectation == type(e)
            else:
                assert False, f"makeARGB({key!r}) was supposed to raise {expectation} but didn't raise anything."
        else:
            output, alpha = _makeARGB(data, lut=lut, levels=levels, scale=scale, useRGBA=use_rgba)
>           assert (
                output == expectation
            ).all(), f"Incorrect _makeARGB({key!r}) output! Expected:\n{expectation!r}\n  Got:\n{output!r}"
E           AssertionError: Incorrect _makeARGB((<class 'numpy.float32'>, '2D', 'SIMPLE', None, None, True)) output! Expected:

E                     [223, 223, 223, 255],
E                     [252, 252, 252, 255]]], dtype=uint8)
E               Got:
E             array([[[255, 255, 255, 255],
E                     [136, 136, 136, 255],
E                     [255, 255, 255,   0],
E                     [225, 225, 225, 255]],
E
E                    [[216, 216, 216, 255],
E                     [224, 224, 224, 255],
E                     [255, 255, 255, 255],
E                     [ 16,  16,  16, 255]],
E
E                    [[252, 252, 252, 255],
E                     [216, 216, 216, 255],
E                     [ 42,  42,  42, 255],
E                     [252, 252, 252, 255]],
E
E                    [[ 18,  18,  18, 255],
E                     [169, 169, 169, 255],
E                     [223, 223, 223, 255],
E                     [252, 252, 252, 255]]], dtype=uint8)
E           assert False
E            +  where False = <built-in method all of numpy.ndarray object at 0x3ef7d09dd0>()
E            +    where <built-in method all of numpy.ndarray object at 0x3ef7d09dd0> = array([[[255,..., dtype=uint8) == array([[[255,..., dtype=uint8)
E                 Use -v to get more diff.all

tests/test_makeARGB.py:4291: AssertionError
________________________________________________ test_PolyLineROI ________________________________________________

    def test_PolyLineROI():
        rois = [
            (pg.PolyLineROI([[0, 0], [10, 0], [0, 15]], closed=True, pen=0.3),
             'closed'),
            (pg.PolyLineROI([[0, 0], [10, 0], [0, 15]], closed=False, pen=0.3),
             'open')
        ]

        plt = pg.GraphicsView()
        plt.show()
        resizeWindow(plt, 200, 200)
        vb = pg.ViewBox()
        plt.scene().addItem(vb)
        vb.resize(200, 200)
        # plt.plotItem = pg.PlotItem()
        # plt.scene().addItem(plt.plotItem)
        # plt.plotItem.resize(200, 200)

        plt.scene().minDragTime = 0  # let us simulate mouse drags very quickly.

        # seemingly arbitrary requirements; might need longer wait time for some
        # platforms..

            # hover over center
            center = r.mapToScene(pg.Point(3, 3))
            mouseMove(plt, center)
            assertImageApproved(plt, 'roi/polylineroi/' + name + '_hover_roi',
                                'Hover mouse over center of ROI.')

            # drag ROI
            mouseDrag(plt, center, center + pg.Point(10, -10),
                      QtCore.Qt.MouseButton.LeftButton)
            assertImageApproved(plt, 'roi/polylineroi/' + name + '_drag_roi',
                                'Drag mouse over center of ROI.')

            # hover over handle
            pt = r.mapToScene(pg.Point(r.getState()['points'][2]))
            mouseMove(plt, pt)
            assertImageApproved(plt, 'roi/polylineroi/' + name + '_hover_handle',
                                'Hover mouse over handle.')

            # drag handle
            mouseDrag(plt, pt, pt + pg.Point(5, 20),
                      QtCore.Qt.MouseButton.LeftButton)
            assertImageApproved(plt, 'roi/polylineroi/' + name + '_drag_handle',
                                'Drag mouse over handle.')

            # hover over segment
            pt = r.mapToScene((pg.Point(r.getState()['points'][2]) + pg.Point(
                r.getState()['points'][1])) * 0.5)
            mouseMove(plt, pt + pg.Point(0, 2))
            assertImageApproved(plt, 'roi/polylineroi/' + name + '_hover_segment',
                                'Hover mouse over diagonal segment.
>           assertImageApproved(plt, 'roi/polylineroi/' + name + '_click_segment',
                                'Click mouse over segment.')

tests/graphicsItems/test_ROI.py:309:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/image_testing.py:150: in assertImageApproved
    assertImageMatch(image, stdImage, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

im1 = array([[[  0,   0,   0, 255],
        [  0,   0,   0, 255],
        [  0,   0,   0, 255],
        ...,
        [  0,  ...,
        ...,
        [  0,   0,   0, 255],
        [  0,   0,   0, 255],
        [  0,   0,   0, 255]]], dtype=uint8)
im2 = array([[[  0,   0,   0, 255],
        [  0,   0,   0, 255],
        [  0,   0,   0, 255],
        ...,
        [  0,  ...,
        ...,
        [  0,   0,   0, 255],
        [  0,   0,   0, 255],
        [  0,   0,   0, 255]]], dtype=uint8)
minCorr = None, pxThreshold = 50.0, pxCount = 0, maxPxDiff = None, avgPxDiff = None, imgDiff = None

    def assertImageMatch(im1, im2, minCorr=None, pxThreshold=50.,
                           pxCount=-1, maxPxDiff=None, avgPxDiff=None,
                           imgDiff=None):
        """Check that two images match.

        Images that differ in shape or dtype will fail unconditionally.
        Further tests for similarity depend on the arguments supplied.

        By default, images may have no pixels that gave a value difference greater
        than 50.

        Parameters
        ----------
        im1 : (h, w, 4) ndarray
            Test output image
        im2 : (h, w, 4) ndarray
            Test standard image
        minCorr : float or None
            Minimum allowed correlation coefficient between corresponding image
            values (see numpy.corrcoef)
        pxThreshold : float
            Minimum value difference at which two pixels are considered different
        pxCount : int or None
            Maximum number of pixels that may differ. Default is 0, on Windows some
            tests have a value of 2.
        maxPxDiff : float or None
            Maximum allowed difference between pixels
        avgPxDiff : float or None
            Average allowed difference between pixels
        imgDiff : float or None
            Maximum allowed summed difference between images

        """
        assert im1.ndim == 3

            <pyqtgraph.graphicsItems.ROI._PolyLineSegment object at 0x3ef4b59490>
            bounding rect: PyQt5.QtCore.QRectF(-0.9126637026167694, -0.04409851807728548, 2.110682744292866, 13.376065001798606)
            transform:
              [1.00 0.00 0.00]
              [0.00 1.00 0.00]
              [0.00 0.00 1.00]
            <pyqtgraph.graphicsItems.ROI._PolyLineSegment object at 0x3ef4b59b50>
            bounding rect: PyQt5.QtCore.QRectF(0.0, -1.3697056274847716, 10.0, 2.7394112549695433)
            transform:
              [1.00 0.00 0.00]
              [0.00 1.00 0.00]
              [0.00 0.00 1.00]
            <pyqtgraph.graphicsItems.ROI._PolyLineSegment object at 0x3ef4b58a70>
            bounding rect: PyQt5.QtCore.QRectF(4.553964306528743, -1.0093820160448754, 6.063284590378109, 8.662698014911768)
            transform:
              [1.00 0.00 0.00]
              [0.00 1.00 0.00]
              [0.00 0.00 1.00]
            <pyqtgraph.graphicsItems.ROI._PolyLineSegment object at 0x3ef4b6a570>
            bounding rect: PyQt5.QtCore.QRectF(-0.327946508818989, 5.629153019466479, 6.1124615601329015, 8.673495909533095)
            transform:
              [1.00 0.00 0.00]
              [0.00 1.00 0.00]
              [0.00 0.00 1.00]
            <pyqtgraph.graphicsItems.ROI.Handle object at 0x3ef4b58b00>
            bounding rect: PyQt5.QtCore.QRectF(-0.20177669529663686, -0.30266504294495655, 0.40355339059327383, 0.605
tests/parametertree/test_parametertypes.py: 2 warnings
  /builddir/pyqtgraph/pyqtgraph/parametertree/parameterTypes/list.py:97: DeprecationWarning: Parameter has no default value. Pass a default, or use setDefault(). This will no longer set an implicit default after January 2025.
    Parameter.__init__(self, **opts)

tests/exporters/test_csv.py: 3 warnings
tests/exporters/test_exporter_dialog.py: 1 warning
tests/exporters/test_hdf5.py: 3 warnings
tests/exporters/test_image.py: 2 warnings
tests/exporters/test_svg.py: 2 warnings
tests/parametertree/test_Parameter.py: 15 warnings
tests/parametertree/test_parametertypes.py: 4 warnings
  /builddir/pyqtgraph/pyqtgraph/parametertree/Parameter.py:140: DeprecationWarning: Parameter has no default value. Pass a default, or use setDefault(). This will no longer set an implicit default after January 2025.
    return cls(**opts)

tests/parametertree/test_parametertypes.py::test_checklist_show_hide
tests/parametertree/test_parametertypes.py::test_recreate_from_savestate
  /builddir/pyqtgraph/pyqtgraph/parametertree/parameterTypes/checklist.py:169: DeprecationWarning: Parameter has no default value. Pass a default, or use setDefault(). This will no longer set an implicit default after January 2025.
    super().__init__(**opts)

tests/parametertree/test_parametertypes.py::test_recreate_from_savestate
  /builddir/pyqtgraph/pyqtgraph/parametertree/parameterTypes/file.py:202: DeprecationWarning: Parameter has no default value. Pass a default, or use setDefault(). This will no longer set an implicit default after January 2025.
    super().__init__(**opts)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================================ short test summary info =============================================
FAILED tests/test_makeARGB.py::test_makeARGB_against_generated_references - AssertionError: Incorrect _makeARGB((<class 'numpy.float32'>, '2D', 'SIMPLE', None, None, True)) output! Expe...
FAILED tests/graphicsItems/test_ROI.py::test_PolyLineROI - AssertionError
======================= 2 failed, 447 passed, 10 skipped, 43 warnings in 670.58s (0:11:10) =======================
```


### Tested environment(s)

 * PyQtGraph version: 0.13.5.dev0
 * Qt Python binding: PyQt5 5.15.10 Qt 5.15.11
 * Python version: Python 3.12.0
 * Operating system: linux
 * Installation method: git clone




Discussion:
`test_PolyLineROI` failure also reported in #2110 for aarch64, ppc64le.
```
>           assertImageApproved(plt, 'roi/polylineroi/' + name + '_click_segment',
                                'Click mouse over segment.')
```
This is the current failure point as documented in #2949.

From what I understand from the error logs and https://github.com/pyqtgraph/pyqtgraph/blob/4544539370e5f80e9c79f5a99a127e728f42650f/tests/test_makeARGB.py#L3198
the test input of
`array([[       inf, 0.53662884,        nan, 0.8853132 ]`
got mapped on your machine to
`array([[[255, 255, 255, 255], [136, 136, 136, 255], [255, 255, 255,   0], [225, 225, 225, 255]]`
i.e. `nan` got mapped to a transparent 255 whereas the reference expected a transparent 0.

Would you mind giving the output of the following code on your machine?
(The output I gave is for an amd64 system)
```python
>>> np.clip(np.array([np.inf, -np.inf, np.nan, -np.nan]), 0, 255).astype(np.ubyte)
array([255,   0,   0,   0], dtype=uint8)
```
> From what I understand from the error logs and
> 
> https://github.com/pyqtgraph/pyqtgraph/blob/4544539370e5f80e9c79f5a99a127e728f42650f/tests/test_makeARGB.py#L3198
> 
> 
> the test input of
> `array([[ inf, 0.53662884, nan, 0.8853132 ]`
> got mapped on your machine to
> `array([[[255, 255, 255, 255], [136, 136, 136, 255], [255, 255, 255, 0], [225, 225, 225, 255]]`
> i.e. `nan` got mapped to a transparent 255 whereas the reference expected a transparent 0.
> Would you mind giving the output of the following code on your machine? (The output I gave is for an amd64 system)
> 
> ```python
> >>> np.clip(np.array([np.inf, -np.inf, np.nan, -np.nan]), 0, 255).astype(np.ubyte)
> array([255,   0,   0,   0], dtype=uint8)
> ```

Thanks for your reply, here's the result on riscv64 system

```
>>> np.clip(np.array([np.inf, -np.inf, np.nan, -np.nan]), 0, 255).astype(np.ubyte)
<stdin>:1: RuntimeWarning: invalid value encountered in cast
array([255,   0, 255, 255], dtype=uint8)
```
Apparently, conversion of `nan`s to `int` is an undefined operation in the C standard.
https://stackoverflow.com/questions/10366485/problems-casting-nan-floats-to-int
I don't think it should be `pyqtgraph`'s job to make that undefined behavior defined.

If `maskNans=True` (default), then the pixel will have 0 alpha, in which case it doesn't matter whether the `nan` became a 0 or 255, as the image will look the same.

If `maskNans=False`, then the image will look different depending on the platform. Black on most platforms and white on RISC-V. (`maskNans=False` doesn't seem to be used anywhere within the library)

If someone wants to, they could perhaps modify `test_makeARGB` to not assume that `nan`s get converted to 0.

Resolving patch:
diff --git a/pyqtgraph/functions.py b/pyqtgraph/functions.py
--- a/pyqtgraph/functions.py
+++ b/pyqtgraph/functions.py
@@ -1345,7 +1345,9 @@ def makeARGB(data, lut=None, levels=None, scale=None, useRGBA=False, maskNans=Tr
                    The default is False, which returns in ARGB order for use with QImage 
                    (Note that 'ARGB' is a term used by the Qt documentation; the *actual* order 
                    is BGRA).
-    maskNans       Enable or disable masking NaNs as transparent.
+    maskNans       Enable or disable masking NaNs as transparent. Converting NaN values to ints is
+                   undefined behavior per the C-standard, results may vary across platforms. Highly
+                   recommend leaving this option to the default value of True.
     ============== ==================================================================================
     """
     cp = getCupy()


Test patch:
diff --git a/tests/test_makeARGB.py b/tests/test_makeARGB.py
--- a/tests/test_makeARGB.py
+++ b/tests/test_makeARGB.py
@@ -154,36 +154,36 @@ def test_makeARGB_exceptions(makeARGB_args, makeARGB_kwargs):
 
 
 def test_makeARGB_with_nans():
+    # NaNs conversion to 0 is undefined in the C-standard
+    # see: https://github.com/pyqtgraph/pyqtgraph/issues/2969#issuecomment-2014924400
+    # see: https://stackoverflow.com/questions/10366485/problems-casting-nan-floats-to-int
+
     # nans in image
     # 2d input image, one pixel is nan
     im1 = np.ones((10, 12))
     im1[3, 5] = np.nan
-    # seems to address segfault in CI on macos (ARM) + conda + pyqt5 + py312
-    im1.setflags(write=False)
     im2, alpha = _makeARGB(im1, levels=(0, 1))
     assert alpha
     assert im2[3, 5, 3] == 0  # nan pixel is transparent
-    assert im2[0, 0, 3] == 255  # doesn't affect other pixels
+    
+    # assert im2[0, 0, 3] == 255  # doesn't affect other pixels
 
     # With masking nans disabled, the nan pixel shouldn't be transparent
-    im2, alpha = _makeARGB(im1, levels=(0, 1), maskNans=False)
-    assert im2[3, 5, 3] == 255
+    # im2, alpha = _makeARGB(im1, levels=(0, 1), maskNans=False)
+    # assert im2[3, 5, 3] == 0  # nan pixel is transparent
+
 
     # 3d RGB input image, any color channel of a pixel is nan
     im1 = np.ones((10, 12, 3))
     im1[3, 5, 1] = np.nan
-    # seems to address segfault in CI on macos (ARM) + conda + pyqt5 + py312
-    im1.setflags(write=False)
     im2, alpha = _makeARGB(im1, levels=(0, 1))
     assert alpha
     assert im2[3, 5, 3] == 0  # nan pixel is transparent
-    assert im2[0, 0, 3] == 255  # doesn't affect other pixels
+    # assert im2[0, 0, 3] == 255  # doesn't affect other pixels
 
     # 3d RGBA input image, any color channel of a pixel is nan
     im1 = np.ones((10, 12, 4))
     im1[3, 5, 1] = np.nan
-    # seems to address segfault in CI on macos (ARM) + conda + pyqt5 + py312
-    im1.setflags(write=False)
     im2, alpha = _makeARGB(im1, levels=(0, 1), useRGBA=True)
     assert alpha
     assert im2[3, 5, 3] == 0  # nan pixel is transparent
@@ -238,7 +238,6 @@ def test_makeARGB_with_human_readable_code():
     # uint8 data tests
 
     im1 = np.arange(256).astype('ubyte').reshape(256, 1)
-    im1.setflags(write=False)
     im2, alpha = _makeARGB(im1, levels=(0, 255))
     checkImage(im2, im1, alpha, False)
 
@@ -302,7 +301,6 @@ def test_makeARGB_with_human_readable_code():
 
     # uint16 data tests
     im1 = np.arange(0, 2 ** 16, 256).astype('uint16')[:, None]
-    im1.setflags(write=False)
     im2, alpha = _makeARGB(im1, levels=(512, 2 ** 16))
     checkImage(im2, np.clip(np.linspace(-2, 253, 256), 0, 255).astype('ubyte'), alpha, False)
 
@@ -314,13 +312,11 @@ def test_makeARGB_with_human_readable_code():
     lut[1000:1256] = np.arange(256)
     lut[1256:] = 255
     im1 = np.arange(1000, 1256).astype('uint16')[:, None]
-    im1.setflags(write=False)
     im2, alpha = _makeARGB(im1, lut=lut)
     checkImage(im2, np.arange(256).astype('ubyte'), alpha, False)
 
     # float data tests
     im1 = np.linspace(1.0, 17.0, 256)[:, None]
-    im1.setflags(write=False)
     im2, alpha = _makeARGB(im1, levels=(5.0, 13.0))
     checkImage(im2, np.clip(np.linspace(-128, 383, 256), 0, 255).astype('ubyte'), alpha, False)