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

CoaddBoundedField persistence not exact

    XMLWordPrintable

    Details

      Description

      Even after fixing DM-12270 the persistence of CoaddBoundedField is apparently not exact. If atol is set to 0 in testPersistence method of test_coaddBoundedField the test fails.

        Attachments

          Issue Links

            Activity

            Hide
            rowen Russell Owen added a comment -

            The basic problem appears to be that SkyWcs persistence is not exact. Note that assertWcsAlmostEqualOverBBox does not allow 0 as the max error, so it cannot test equality. Fix that and fix the persistence test in afw test_skyWcs.py to use it.

            Show
            rowen Russell Owen added a comment - The basic problem appears to be that SkyWcs persistence is not exact. Note that assertWcsAlmostEqualOverBBox does not allow 0 as the max error, so it cannot test equality. Fix that and fix the persistence test in afw test_skyWcs.py to use it.
            Hide
            rowen Russell Owen added a comment -

            I have attached a script that uses astshim and shows small differences between a celestial WCS FrameSet and its un-persisted copy. I also tried editing AST to persist floats with 19 digits instead of 17 and it made no difference. I have sent the script to David Berry in hopes that he can fix AST. When I run the script I see the following:

            delta= [[  0.00000000e+00   7.95807864e-13   0.00000000e+00]
             [  0.00000000e+00  -6.82121026e-13   0.00000000e+00]]
            Traceback (most recent call last):
              File "temp.py", line 51, in <module>
                assert np.array_equal(pixRoundTrip, pixRoundTrip2), "inverse transform is different"
            AssertionError: inverse transform is different

            Show
            rowen Russell Owen added a comment - I have attached a script that uses astshim and shows small differences between a celestial WCS FrameSet and its un-persisted copy. I also tried editing AST to persist floats with 19 digits instead of 17 and it made no difference. I have sent the script to David Berry in hopes that he can fix AST. When I run the script I see the following: delta= [[  0 .00000000e+ 00   7 .95807864e- 13   0 .00000000e+ 00 ]  [  0 .00000000e+ 00   - 6 .82121026e- 13   0 .00000000e+ 00 ]] Traceback (most recent call last):   File "temp.py" , line 51 , in <module>     assert np.array_equal(pixRoundTrip, pixRoundTrip2), "inverse transform is different" AssertionError: inverse transform is different
            Hide
            rowen Russell Owen added a comment - - edited

            The basic problem was that AST was not saving the inverse coefficients for MatrixMap and there were subtle numerical differences when they were computed when un-persisting. David Berry fixed that in starlink_ast.

            I didn't see this earlier because I had mis-written assertWcsAlmostEqual... to require positive maximum error instead of allowing 0. I fixed that and changed two tests in afw and test_coaddBoundedField in meas_algorithms to use an error of 0.

            In addition I added accessors to CoaddBoundedField in order to make debugging problems such as this simpler. I also modified operator== for CoaddBoundedField and CoaddBoundedFieldElement to test value equality, not pointer equality (provided neither pointer is null) and wrapped CoaddBoundedField::operator== with pybind11.

            Please make sure you are comfortable with my changes to CoaddBoundedField in meas_algorithms. I hope you will find the changes in afw innocuous. There is no need to review the starlink_ast changes, though I made a pull request in case you want to look at them.

            Show
            rowen Russell Owen added a comment - - edited The basic problem was that AST was not saving the inverse coefficients for MatrixMap and there were subtle numerical differences when they were computed when un-persisting. David Berry fixed that in starlink_ast. I didn't see this earlier because I had mis-written assertWcsAlmostEqual... to require positive maximum error instead of allowing 0. I fixed that and changed two tests in afw and test_coaddBoundedField in meas_algorithms to use an error of 0. In addition I added accessors to CoaddBoundedField in order to make debugging problems such as this simpler. I also modified operator== for CoaddBoundedField and CoaddBoundedFieldElement to test value equality, not pointer equality (provided neither pointer is null) and wrapped CoaddBoundedField::operator== with pybind11. Please make sure you are comfortable with my changes to CoaddBoundedField  in meas_algorithms. I hope you will find the changes in afw innocuous. There is no need to review the starlink_ast changes, though I made a pull request in case you want to look at them.
            Hide
            jbosch Jim Bosch added a comment -

            Looks good.  One small comment on the PR.

            Show
            jbosch Jim Bosch added a comment - Looks good.  One small comment on the PR.
            Hide
            rowen Russell Owen added a comment - - edited

            Thank you for the quick and helpful review. I implemented your suggested change to ptrEquals

            Show
            rowen Russell Owen added a comment - - edited Thank you for the quick and helpful review. I implemented your suggested change to ptrEquals

              People

              Assignee:
              rowen Russell Owen
              Reporter:
              rowen Russell Owen
              Reviewers:
              Jim Bosch
              Watchers:
              Jim Bosch, Russell Owen, Tim Jenness
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Jenkins

                  No builds found.