Skip to content

Adding Absolute Tolerance Functionality#234

Closed
marty-larocque wants to merge 4 commits intoearthlab:masterfrom
marty-larocque:absolute_tolerance
Closed

Adding Absolute Tolerance Functionality#234
marty-larocque wants to merge 4 commits intoearthlab:masterfrom
marty-larocque:absolute_tolerance

Conversation

@marty-larocque
Copy link
Contributor

This PR adds functionality for absolute tolerance in base.assert_xydata() and base.assert_bin_values(), addressing issue #157.

@marty-larocque marty-larocque changed the title Absolute tolerance Adding Absolute Tolerance Functionality Mar 27, 2020
``e``, and an actual value ``a``, this asserts
``abs(a - e) < (e * 0.1)``. (This uses `np.testing.assert_allclose`
with ``rtol=tolerence`` and ``atol=inf``.)
tol_rel : float
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you think we need both absolute and relative? it seems like just picking one would keep things simpler. @nkorinek what do you think about this? we are addressing issues for when the data values are decimal places off but pretty much correct. a tolerance would account for that. i just am not sure we need two parameters for it. 1 seems like enough.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's remove relative tolerance and KEEP absolute tolerance which will work with values close to or at 0

xy_data["x"],
xy_expected[xcol],
rtol=tolerence,
rtol=tol_rel,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryla5068 is the deal that the numpy allclose function has both parameters so you are exposing them in our method?

)

if tolerence > 0:
if tol_rel > 0 or tol_abs > 0:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

once we figure this out it does seem like we should do a quick check to ensure the user provides a reasonable tolerance value. does assert_allclose check that the tolerance value is a number?

Copy link

@lwasser lwasser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few changes here marty. Can you also please add a changelog update ? and then i just want to talk through relative vs absolute tolerance. i'm not sure we need both. Also what happens if the user provides both by mistake? it seems like picking one might be simplest but perhaps you had a reason for allowing for both?

@lwasser
Copy link

lwasser commented Apr 21, 2020

oh also please update from master. this PR should then pass CI

@lwasser lwasser added the enhancement New feature or request label Apr 21, 2020
@lwasser
Copy link

lwasser commented Apr 23, 2020

@nkorinek i pinged you on this pr as well. lets plan to focus on this package for the next week to get some of these issues and pr's resolved and merged and such!

@lwasser
Copy link

lwasser commented Apr 27, 2020

  1. please add a change log entry
  2. please remove relative tolerance from the method.
  3. fix ci ---

@lwasser
Copy link

lwasser commented Apr 27, 2020

/rebase

@lwasser lwasser assigned marty-larocque and lwasser and unassigned nkorinek Apr 27, 2020
@marty-larocque
Copy link
Contributor Author

@lwasser This PR is failing when building docs. I'm not sure why, and it is not failing for me locally. Other than this, this PR should be ready to merge.

@nkorinek
Copy link
Contributor

nkorinek commented May 7, 2020

@lwasser this pr has been moved to #272

@lwasser
Copy link

lwasser commented May 7, 2020

thank you @nkorinek i will close this pr given it's opened and fixed in a new pr!

@lwasser lwasser closed this May 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request high priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants