SphereUDE
A Julia package for regression in the sphere based on Universal Differential Equations
Science Score: 77.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 2 DOI reference(s) in README -
✓Academic publication links
Links to: zenodo.org -
✓Committers with academic emails
1 of 4 committers (25.0%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (17.2%) to scientific vocabulary
Keywords from Contributors
Repository
A Julia package for regression in the sphere based on Universal Differential Equations
Basic Info
Statistics
- Stars: 4
- Watchers: 3
- Forks: 3
- Open Issues: 18
- Releases: 0
Metadata Files
README.md

⚠️ New preprint available! 📖 ⚠️
The paper is now available as a preprint: https://www.authorea.com/users/589727/articles/1265456-spherical-path-regression-through-universal-differential-equations-with-applications-to-paleomagnetism
SphereUDE.jl is a Julia package for non-parametric regression of data supported in three-dimensional spheres. It implements a simple universal differential equation (UDE) that naturally constrains trajectories to lie on the surface of a sphere. This has an important application in Paleomagnetism, where the objective is to fit Apparent Polar Wander Paths (APWPs) to reconstruct continents' past motion. In addition to sphere regression, SphereUDE.jl implements a series of improvements over previous modeling methods, such as - Explicit sphere constraint that allows for universality of regression - Regularization on the path to incorporate physical priors
We are further working in new features such as - Incorporation of temporal and spatial uncertainties - Uncertainty quantification capabilities
Installing SphereUDE
SphereUDE.jl is available through the Julia package manager.
To install SphereUDE in a given environment, just do in the REPL:
julia
julia> ] # enter Pkg mode
(@v1.10) pkg> activate MyEnvironment # or activate whatever path for the Julia environment
(MyEnvironment) pkg> add SphereUDE
Usage
If you are interested in using SphereUDE.jl, we encourage you to take a look at our gallery of examples.
Examples are included in the repository ODINN-SciML/SphereUDE-examples.
To train a model with new unobserved data, we need to define the data, parameters, and regularization we want to use.
Data objecs are defined with the SphereData construct, which takes
julia
data = SphereData(times=times, directions=X, kappas=kappas, L=nothing)
where times correspond to an array of the sampled times where we observed the three-dimensional vectors in directions.
We can further add an array kappa to specify uncertainty in the directions according to the Fisher distribution in the sphere.
It is possible to add different types of regularizations at the same time by specifying an array of the type Regularization, which specifies the type of regularization being used and the diff_mode that specifies the underlying automatic differentiation machinery being used to compute the gradients.
For example, we can add regularization using finite differences as
julia
reg = [Regularization(order=1, power=2.0, λ=1e5, diff_mode=LuxNestedAD())]
Finally, the parameters include the regularization together with other customizable training parameters:
julia
params = SphereParameters(tmin = 0, tmax = 100,
reg = reg,
pretrain = false,
u0 = [0.0, 0.0, -1.0], ωmax = 2.0,
reltol = 1e-6, abstol = 1e-6,
niter_ADAM = 5000, niter_LBFGS = 5000,
sensealg = InterpolatingAdjoint(autojacvec = ReverseDiffVJP(true)))
Training is finally done with
```julia
using Random
rng = Random.default_rng()
Random.seed!(rng, 613)
results = train(data, params, rng, nothing)
``
withrng` a random seed used for the initial setup of the neural network.
The architecture of the neural network can be customized and passed directy before training as follows: ```julia initbias(rng, indims) = LinRange(tspan[1], tspan[2], indims) initweight(rng, outdims, indims) = 0.1 * ones(outdims, indims)
Customized neural network to similate weighted moving window in L
U = Lux.Chain( Lux.Dense(1, 200, rbf, initbias=initbias, initweight=initweight, usebias=true), Lux.Dense(200,10, gelu), Lux.Dense(10, 3, Base.Fix2(sigmoidcap, params.ωmax), use_bias=false) )
results = train(data, params, rng, nothing, U)
We can finally save and plot the data:
julia
results_dict = convert2dict(data, results)
JLD2.@save "./resultsdict.jld2" resultsdict
plot_sphere(data, results, -30., 0., saveas="plot.png", title="Results") ```
:books: We are working in a more complete documentation. Feel free to reach out in the meantime if you have any questions!
SphereUDE integration with Python
To make plots using Matplotlib, Cartopy, and PMagPy, SphereUDE.jl uses CondaPkg.jl and PythonCall.jl to execute Python code directly from Julia.
This is done automatically once you install SphereUDE.jl, meaning that the first time you install SphereUDE.jl a conda environment linked to your Julia environmnet will be created and
linked to your Julia session.
From there, SphereUDE.jl will internally call the Python libraries without any further action from the user's side.
Contribute to the project! :wave:
We encourage you to contribute to this package. If you are interested in contributing, there are many ways in which you can help build this package:
- :collision: Report bugs in the code. You can report problems with the code by oppening issues under the Issues tab in this repository. Please explain the problem you encounter and try to give a complete description of it so we can follow up on that.
- :bulb: Request new features and explanations. If there is an important topic or example that you feel falls under the scope of this package and you would like us to include it, please request it! We are looking for new insights into what the community wants to learn.
Contact
If you have any questions or want to reach out, feel free to send us an email to sapienza@stanford.edu.
Owner
- Name: ODINN
- Login: ODINN-SciML
- Kind: organization
- Location: Earth
- Twitter: ODINN_org
- Repositories: 3
- Profile: https://github.com/ODINN-SciML
Global climate-glacier interactions modelling with Universal Differential Equations
Citation (CITATION.cff)
cff-version: 1.2.0 message: "If you use this software, please cite it as below." authors: - family-names: "Sapienza" given-names: "Facundo" orcid: "https://orcid.org/0000-0003-4252-7161" - family-names: "Bolibar" given-names: "Jordi" orcid: "https://orcid.org/0000-0002-0791-0731" title: "SphereUDE.jl" version: v0.2.1 date-released: 2025-07-25 url: "https://github.com/ODINN-SciML/SphereUDE.jl"
GitHub Events
Total
- Create event: 38
- Commit comment event: 23
- Issues event: 9
- Release event: 5
- Watch event: 1
- Delete event: 95
- Issue comment event: 21
- Push event: 117
- Pull request review event: 90
- Pull request review comment event: 745
- Pull request event: 91
Last Year
- Create event: 38
- Commit comment event: 23
- Issues event: 9
- Release event: 5
- Watch event: 1
- Delete event: 95
- Issue comment event: 21
- Push event: 117
- Pull request review event: 90
- Pull request review comment event: 745
- Pull request event: 91
Committers
Last synced: 8 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Facundo Sapienza | f****a@b****u | 63 |
| github-actions[bot] | 4****] | 9 |
| CompatHelper Julia | c****y@j****g | 5 |
| Jordi Bolibar | j****r@g****m | 4 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 7 months ago
All Time
- Total issues: 25
- Total pull requests: 198
- Average time to close issues: 3 months
- Average time to close pull requests: 27 days
- Total issue authors: 3
- Total pull request authors: 4
- Average comments per issue: 0.64
- Average comments per pull request: 0.27
- Merged pull requests: 46
- Bot issues: 0
- Bot pull requests: 177
Past Year
- Issues: 8
- Pull requests: 63
- Average time to close issues: N/A
- Average time to close pull requests: 20 days
- Issue authors: 1
- Pull request authors: 4
- Average comments per issue: 0.25
- Average comments per pull request: 0.7
- Merged pull requests: 6
- Bot issues: 0
- Bot pull requests: 54
Top Authors
Issue Authors
- facusapienza21 (18)
- github-actions[bot] (1)
- JordiBolibar (1)
Pull Request Authors
- github-actions[bot] (159)
- facusapienza21 (30)
- JordiBolibar (4)
- avik-pal (2)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- julia 1 total
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 8
juliahub.com: SphereUDE
A Julia package for regression in the sphere based on Universal Differential Equations
- Documentation: https://docs.juliahub.com/General/SphereUDE/stable/
- License: MIT
-
Latest release: 0.2.1
published 8 months ago
Rankings
Dependencies
- actions/checkout v4 composite
- julia-actions/cache v1 composite
- julia-actions/julia-buildpkg v1 composite
- julia-actions/julia-runtest v1 composite
- julia-actions/setup-julia v1 composite
- JuliaRegistries/TagBot v1 composite
- PyQt5 *
- pmagpy ==4.2.106