These won't always be exactly equal
See original GitHub issuesrp
comes from the PVP parameters which are double precision floating point.
iarp
comes from the XML string representation which has limited significant digits.
There are a few solutions:
np.around(srp, digits=9)
- print more significant digits in the XML
I lean towards the first one. If someone doesn’t use sarpy to create the CPHD (as I did) this could still fail.
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (5 by maintainers)
Top Results From Across the Web
Two Plus Two Does Not Always Equal Four - The Nickel Report
But two plus two may not equal four due to two concepts: significant figures and rounding.
Read more >Here's How Your Watch Can Prove That 2 + 2 Doesn't Equal 4
It does not have to be limited to Modulo 12 like with the clock with the ... This is just like with the...
Read more >Correlation does not imply causation - Wikipedia
This fallacy is also known by the Latin phrase cum hoc ergo propter hoc ('with this, therefore because of this'). This differs from...
Read more >Inaugural Address by President Barack Obama | whitehouse.gov
We recall that what binds this nation together is not the colors of ... It does not mean we all define liberty in...
Read more >Equity vs. Equality: What's the Difference?
allocates the exact resources and opportunities needed to reach an equal ... “The route to achieving equity will not be accomplished through treating...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think the most elegant solution is to change https://github.com/ngageoint/sarpy/blob/ec54673e089f972c2b740b00cb45b0651940a735/sarpy/consistency/cphd_consistency.py#L1121 to
that way any number or array of numbers is being compared using a
con.Approx
which usesnp.isclose
under the hood.Then the changes to this file from an earlier commit: https://github.com/ngageoint/sarpy/commit/41d2260dc876e682dea77a49ce555ea0ddb48670#diff-40594572e8169b144e447ae57d6c93a6aaf047a43dd46de34a46f592874e9c67
could be rolled back. The change to let
atol = 1e-6
should probably be kept.It’s not clear which line is causing the failure, but it’s possible that it is this assert here:
https://github.com/ngageoint/sarpy/blob/ec54673e089f972c2b740b00cb45b0651940a735/sarpy/consistency/cphd_consistency.py#L1126
I believe changing the assert to the following is more appropriate and might fix the problem @klucar is encountering, but I can’t be sure without the problematic test data.