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

added units to test_simulation.py #479

Merged
merged 2 commits into from
Feb 9, 2016

Conversation

mishinma
Copy link
Contributor

@mishinma mishinma commented Feb 7, 2016

I just added some units to tests in test_simulation.py. This seems to resolve the issue #478

@yeganer
Copy link
Contributor

yeganer commented Feb 8, 2016

I'm fine with that change and i think we should use assert_quantity_allclose whenever possible.

@wkerzendorf @unoebauer Any comments? If you are fine i think we should merge.

@mishinma
Copy link
Contributor Author

mishinma commented Feb 8, 2016

Do we need to pass atol=0.0 in every assert statement? Its default value is 0 already.
And when providing atol value to assert_quantity_allclose one must specify units because of the implementation in Astropy:

if atol is None:
        # by default, we assume an absolute tolerance of 0
        atol = u.Quantity(0)
    else:
        atol = u.Quantity(atol, subok=True, copy=False)
        try:
            atol = atol.to(actual.unit)
        except u.UnitsError:
            raise u.UnitsError("Units for 'atol' ({0}) and 'actual' ({1}) "
                               "are not convertible"
                               .format(atol.unit, actual.unit))

@unoebauer
Copy link
Contributor

Looks very good - thanks for the effort @mishinma.

I am wondering, though, if (maybe for future reference) it would make more sense to generate a proper reference data set, containing quantities instead of bare numpy arrays. Thoughts on this, @wkerzendorf, @yeganer?

@wkerzendorf
Copy link
Member

@unoebauer - yes it would make sense to do this, however it's not clear how to store those. But for now we are merging this.

wkerzendorf added a commit that referenced this pull request Feb 9, 2016
@wkerzendorf wkerzendorf merged commit d02a03b into tardis-sn:master Feb 9, 2016
@mishinma mishinma deleted the simulation_test_fix_478 branch February 9, 2016 10:34
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