Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Absolute Tolerance Functionality #234

Closed

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

if xtime:
raise ValueError("tolerance must be 0 with datetime on x-axis")
np.testing.assert_allclose(
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?

@@ -909,19 +915,21 @@ def assert_xydata(
xy_expected.sort_values(by=xcol),
)

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
Member

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