Skip to content

Conversation

@pllim
Copy link
Member

@pllim pllim commented Feb 12, 2013

Attempt to fix utils.timer test having "random failures on MacOS X because the results are in some cases close to but not quite accurate to 3 decimal places". See also: #743

@astrofrog
Copy link
Member

Thanks! I just pushed this to my staging branch to see if the tests pass on the Mac Jenkins instance now.

@eteq
Copy link
Member

eteq commented Feb 12, 2013

Out of curiosity, isn't this equivalent to just setting ACCURACY_DECIMAL to 0? (Either way is of course fine.)

@pllim
Copy link
Member Author

pllim commented Feb 12, 2013

Basically, the same kind of idea but not exactly (or at least I don't think so by looking at Numpy docs; feel free to correct me).

The math for numpy.testing.assert_almost_equal is like this:

abs(desired - actual) < 0.5 * 10**(-decimal)

I am doing something like this:

round(desired) - round(actual) == 0

@eteq
Copy link
Member

eteq commented Feb 12, 2013

Ah, you're right, not the same then. Thanks for the clarification!

And this looks fine to me.

@pllim
Copy link
Member Author

pllim commented Feb 13, 2013

@astrofrog, if things look good on Mac Jenkins, feel free to merge when you are ready.

@astrofrog
Copy link
Member

There was a delay in running the staging branch. I'm busy all day tomorrow, but will check on Friday.

@pllim
Copy link
Member Author

pllim commented Feb 26, 2013

@astrofrog , I don't think I am making anymore changes unless something else pops up. Rules are pretty relaxed now. Feel free to merge as you see fit. Thanks!

@eteq
Copy link
Member

eteq commented Feb 26, 2013

This looks ready to merge to me, but I'll leave it to @astrofrog, as I'm not sure if it's been tested on the Jenkins Mac setup yet (I don't see it on shiningpanda, anyway).

@astrofrog
Copy link
Member

Sorry for the delay - I'll push this to my staging branch to see if there are any issues.

@taldcroft
Copy link
Member

I'm still seeing problems related to timer testing showing up in the Travis tests, e.g. https://travis-ci.org/astropy/astropy/builds/5259347.

@pllim
Copy link
Member Author

pllim commented Mar 5, 2013

This looks like an older version of the code. ACCURACY_DECIMAL not longer exists. Are you sure you grabbed the latest version of this pull request?

=================================== FAILURES ===================================
1056______________________ TestRunTimePredictor.test_fitting _______________________
1057
1058self = <astropy.utils.tests.test_timer.TestRunTimePredictor object at 0x7f887403d250>
1059
1060 def test_fitting(self):
1061 a = self.p.do_fit()
1062 assert self.p._power == 1
1063> np.testing.assert_almost_equal(a, (1, 0), ACCURACY_DECIMAL)

@taldcroft
Copy link
Member

Sorry, I wasn't totally clear: this is coming from astropy master, not this PR. It showed up after merging PR #829. So if this PR will fix the issue then all is OK.

@pllim
Copy link
Member Author

pllim commented Mar 5, 2013

@taldcroft , this PR will change the assertion tests (which currently failed in master) to the following, which will most certainly pass unless timer is behaving very badly:

assert 0.9 <= 1.00415088 <= 1.1
assert -1 <= -0.00102126 <= 1

@astrofrog
Copy link
Member

The tests are passing on Jenkins OS X - merging!

astrofrog added a commit that referenced this pull request Mar 5, 2013
Relaxed utils.timer test assertions
@astrofrog astrofrog merged commit ac47b31 into astropy:master Mar 5, 2013
@pllim pllim deleted the timer-tests-fix branch March 6, 2013 05:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants