Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-7276

Use numpy allclose in utils.tests and afw.image.tests and support NaNs

    XMLWordPrintable

    Details

      Description

      lsst.utils.tests.TestCase.assertFloatsAlmostEqual and the various afw.images.utilsTests should probably use either numpy.testing or numpy.allclose under the hood. The latter also has an equal_nan=False option that lets them work safely on non-finite values, which our TestCase explicitly doesn't work on.

      It looks like afw.images.utilsTests uses numpy.allclose at the end, but there's a lot of precursor stuff that can probably be removed with the latest numpy.allclose.

        Attachments

          Issue Links

            Activity

            Hide
            jbosch Jim Bosch added a comment -

            I would like to preserve somehow (maybe not in the same test method) the ability to plot differences between 2-d arrays. If we can do that (again, I don't much care how), I have no problem with the rest of this proposal.

            Show
            jbosch Jim Bosch added a comment - I would like to preserve somehow (maybe not in the same test method) the ability to plot differences between 2-d arrays. If we can do that (again, I don't much care how), I have no problem with the rest of this proposal.
            Hide
            Parejkoj John Parejko added a comment -

            The goal here was to preserve all the behavior in our current TestCase methods (hence why I bothered with DM-7267, instead of just recommending people use the numpy.testing), but standardize on the internals using the numpy functions to make the assert methods less complicated.

            That said, the numpy tests are less stringent (and have a slightly different algorithm) by default than ours, so we will have to be careful when we do it and test across all packages before we can consider it done.

            Show
            Parejkoj John Parejko added a comment - The goal here was to preserve all the behavior in our current TestCase methods (hence why I bothered with DM-7267 , instead of just recommending people use the numpy.testing), but standardize on the internals using the numpy functions to make the assert methods less complicated. That said, the numpy tests are less stringent (and have a slightly different algorithm) by default than ours, so we will have to be careful when we do it and test across all packages before we can consider it done.
            Hide
            swinbank John Swinbank added a comment -

            I don't think we'll schedule time to work on this issue unless it is identified as a blocker for some key functionality.

            Show
            swinbank John Swinbank added a comment - I don't think we'll schedule time to work on this issue unless it is identified as a blocker for some key functionality.

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              Parejkoj John Parejko
              Watchers:
              Jim Bosch, John Parejko, John Swinbank, Pim Schellart [X] (Inactive), Russell Owen, Simon Krughoff
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Jenkins

                  No builds found.