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

Make tracer spline errors more verbose #926

Merged
merged 3 commits into from
Apr 14, 2022
Merged

Conversation

tilmantroester
Copy link
Contributor

This catches the case where the tracer redshift support is wider than the interal background spline. This is mostly useful to prevent opaque error in calculator mode. A similar check should probably be made for the power spectrum as well.

@coveralls
Copy link

coveralls commented Apr 13, 2022

Pull Request Test Coverage Report for Build 2167561237

  • 37 of 39 (94.87%) changed or added relevant lines in 12 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.005%) to 97.052%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pyccl/halos/halo_model.py 5 6 83.33%
pyccl/halos/hbias.py 1 2 50.0%
Totals Coverage Status
Change from base Build 1922185518: 0.005%
Covered Lines: 4411
Relevant Lines: 4545

💛 - Coveralls

Copy link
Collaborator

@damonge damonge left a comment

Choose a reason for hiding this comment

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

This looks good to me. Have you checked if this adds a lot of time to the usual life cycle of a tracer? I assume not, but I forget if _get_spline1d_array was a costly function.

pyccl/tracers.py Outdated Show resolved Hide resolved
pyccl/tracers.py Outdated Show resolved Hide resolved
@damonge
Copy link
Collaborator

damonge commented Apr 13, 2022

Also, could we add a unit test that makes this fail?

@tilmantroester
Copy link
Contributor Author

Added a unit test. _get_spline1d_array just copies the memory of the C-level spline data, so should be negligible in terms of computational effort. On the other hand it shouldn't be necessary. Maybe I'll add a a_min and a_max to the cosmo.data C-struct for bookkeeping.

@damonge
Copy link
Collaborator

damonge commented Apr 14, 2022

Thanks a lot!
I'm happy to approve this without the C-level logging of amin/max as soon as the final tests pass.

Copy link
Collaborator

@damonge damonge left a comment

Choose a reason for hiding this comment

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

LGTM

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.

None yet

3 participants