Skip to content

Commit

Permalink
Example with double rotation working with non-updated Lux
Browse files Browse the repository at this point in the history
  • Loading branch information
facusapienza21 committed Sep 26, 2024
1 parent 9fa3354 commit f4eee7a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ BenchmarkTools = "1"
ComponentArrays = "0.15"
Distributions = "0.25"
Infiltrator = "1.2"
Lux = "<0.5.49"
Optimization = "3.12"
OptimizationOptimJL = "0.1.5"
OptimizationOptimisers = "0.1.2"
Expand All @@ -50,4 +51,4 @@ julia = "1.7"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
test = ["Test"]
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ To make plots using Matplotlib, Cartopy, and PMagPy, we install both [PyCall.jl]

- Create a Python conda environment, based on [this conda environment file](https://raw.githubusercontent.com/facusapienza21/SphereUDE.jl/main/environment.yml), with all the required packages using `conda env create -f environment.yml`.
- Inside the Julia REPL, install both `PyCall.jl` and `PyPlot.jl` with `] add PyCall, Pyplot`.
- Specify the Python path of the new environment with `ENV["PYTHON"] = ...`, where you should complete the path of the Python installation that shows when you do `conda activate SphereUDE`, `which python`.
- Inside the Julia REPL, execute `Pkg.build("PyCall")` to re-build PyCall with the new Python path.
- Specify the Python path of the new environment with `ENV["PYTHON"] = ...`, where you should complete the path of the Python installation that shows when you do `conda activate SphereUDE`, `which python`. Inside the Julia REPL, execute `Pkg.build("PyCall")` to re-build PyCall with the new Python path:
```
julia> ENV["PYTHON"] = read(`which python`, String)[1:end-1] # trim backspace
julia> import Pkg; Pkg.build("PyCall")
julia> exit()
```

You are ready to use Python from your Julia session!
19 changes: 8 additions & 11 deletions examples/double_rotation/double_rotation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,28 +88,25 @@ end # run
# Run different experiments

λ₀ = 0.1
λ₁ = 0.1
# λ₀ = 0.1
# λ₁ = 0.01
λ₁ = 0.001

run(; kappa = 50.,
regs = [Regularization(order=1, power=1.0, λ=λ₁, diff_mode="CS"),
regs = [Regularization(order=1, power=1.0, λ=λ₁, diff_mode="FD"),
Regularization(order=0, power=2.0, λ=λ₀, diff_mode=nothing)],
title = "plot_50_lambda$(λ₁)")
title = "plots/plot_50_lambda$(λ₁)")

λ₀ = 0.1
λ₁ = 0.1
# λ₀ = 0.1
# λ₁ = 0.01

run(; kappa = 200.,
regs = [Regularization(order=1, power=1.0, λ=λ₁, diff_mode="CS"),
Regularization(order=0, power=2.0, λ=λ₀)],
title = "plot_200_lambda$(λ₁)")
title = "plots/plot_200_lambda$(λ₁)")

λ₀ = 0.1
λ₁ = 0.1
# λ₀ = 0.1
# λ₁ = 0.01

run(; kappa = 1000.,
regs = [Regularization(order=1, power=1.0, λ=λ₁, diff_mode="CS"),
Regularization(order=0, power=2.0, λ=λ₀)],
title = "plot_1000_lambda$(λ₁)")
title = "plots/plot_1000_lambda$(λ₁)")

0 comments on commit f4eee7a

Please sign in to comment.