Skip to content

Conversation

@auggiemarignier
Copy link
Contributor

A suggested refactoring of the code.

  • Creates a generic OneDModel class that can take any combination of rho, vp, vs, qkappa, qmu polynomial coefficients and breakpoints.
    • If a set of coefficients is not provided then if the user tries to access the related polynomial an error will be thrown. Previously, since default PREM values are given, a user could give a non-prem vp and the resulting object would still have a prem rho, which could be a problem.
    • a PREM instance of OneDModel is made available to import
  • Vectorises the evaluation of piecewise polynomials at point x
  • Pulls out all the calculations of physical quantities into their own physics module. These are now only functions of the five basic polynomials - no more precompute of derived polynomials so this may be an inefficiency for some applications. OneDModel contains thin wrappers around these functions so the API doesn't change from a user's perspective.
  • Setup managed with uv, files rearranged into src and notebooks folders

@andreww
Copy link
Owner

andreww commented Dec 1, 2025

These look really useful. Thanks. I'll grab and merge a bunch of these but skip the vectorisation of PP and deduplication of tabulation. My feeling is both need more test cases (or at least, for me to think about what isn't currently tested).

@andreww
Copy link
Owner

andreww commented Dec 1, 2025

Thanks @auggiemarignier! I've merged almost all of this on main now. The missing bits are on #23 (vectorise PP) and #24 (sort out the tabulation). Both look good but would benefit from a test or two and I would really like to get my head around the vectorisation. I'll close this PR.

@andreww andreww closed this Dec 1, 2025
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.

2 participants