Skip to content

Commit

Permalink
Remove Julia Nightly from test and update some API
Browse files Browse the repository at this point in the history
  • Loading branch information
facusapienza21 committed Jan 10, 2024
1 parent 232631e commit ec70832
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
matrix:
version:
- '1.9'
- 'nightly'
# - 'nightly'
python:
- 3.9
os:
Expand Down
6 changes: 2 additions & 4 deletions examples/double_rotation/double_rotation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ using SphereFit
using Random
rng = Random.default_rng()
Random.seed!(rng, 666)
# Fisher concentration parameter on observations (small = more dispersion)
κ = 200.

# Total time simulation
tspan = [0, 130.0]
Expand Down Expand Up @@ -58,7 +56,7 @@ true_sol = solve(prob, Tsit5(), reltol=reltol, abstol=abstol, saveat=times_samp

# Add Fisher noise to true solution
X_noiseless = Array(true_sol)
X_true = X_noiseless + FisherNoise(kappa=κ)
X_true = X_noiseless + FisherNoise(kappa=200.)

##############################################################
####################### Training ###########################
Expand All @@ -69,7 +67,7 @@ data = SphereData(times=times_samples, directions=X_true, kappas=nothing, L=L_
regs = [Regularization(order=1, power=1.0, λ=0.1, diff_mode="Finite Differences"),
Regularization(order=0, power=2.0, λ=0.1, diff_mode="Finite Differences")]

params = SphereParameters(tmin=tspan[1], tmax=tspan[2],
params = SphereParameters(tmin=tspan[1], tmax=tspan[2],
reg=regs,
u0=[0.0, 0.0, -1.0], ωmax=2ω₀, reltol=reltol, abstol=abstol,
niter_ADAM=1000, niter_LBFGS=400)
Expand Down
13 changes: 7 additions & 6 deletions examples/multi_rotation/multi_rotation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ using SphereFit
using Random
rng = Random.default_rng()
Random.seed!(rng, 666)
# Fisher concentration parameter on observations (small = more dispersion)
κ = 200

# Total time simulation
tspan = [0, 150.0]
Expand Down Expand Up @@ -62,18 +60,21 @@ true_sol = solve(prob, Tsit5(), reltol=reltol, abstol=abstol, saveat=times_samp

# Add Fisher noise to true solution
X_noiseless = Array(true_sol)
X_true = mapslices(x -> rand(sampler(VonMisesFisher(x/norm(x), κ)), 1), X_noiseless, dims=1)
X_true = X_noiseless + FisherNoise(kappa=200.)

##############################################################
####################### Training ###########################
##############################################################

data = SphereData(times=times_samples, directions=X_true, kappas=nothing, L=L_true)

regs = [Regularization(order=1, power=1.0, λ=0.1, diff_mode="Finite Differences"),
Regularization(order=0, power=2.0, λ=0.1, diff_mode="Finite Differences")]

params = SphereParameters(tmin=tspan[1], tmax=tspan[2],
reg=[(1, 1.0, 0.1)],# (0, 2.0, 0.1)],
reg=regs,
u0=[0.0, 0.0, -1.0], ωmax=2ω₀, reltol=reltol, abstol=abstol,
niter_ADAM=4000, niter_LBFGS=1000,
reg_differentiation="Finite differences")
niter_ADAM=4000, niter_LBFGS=1000)

results = train(data, params, rng, nothing)

Expand Down

0 comments on commit ec70832

Please sign in to comment.