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

Fix docs #40

Merged
merged 10 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 50
labels:
- "dependencies"
- "github-actions"
44 changes: 44 additions & 0 deletions .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CompatHelper
on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
CompatHelper:
runs-on: ubuntu-latest
steps:
- name: Check if Julia is already available in the PATH
id: julia_in_path
run: which julia
continue-on-error: true
- name: Install Julia, but only if it is not already available in the PATH
uses: julia-actions/setup-julia@v1
with:
version: '1'
arch: ${{ runner.arch }}
if: steps.julia_in_path.outcome != 'success'
- name: "Add the General registry via Git"
run: |
import Pkg
ENV["JULIA_PKG_SERVER"] = ""
Pkg.Registry.add("General")
shell: julia --color=yes {0}
- name: "Install CompatHelper"
run: |
import Pkg
name = "CompatHelper"
uuid = "aa819f21-2bde-4658-8897-bab36330d9b7"
version = "3"
Pkg.add(; name, uuid, version)
shell: julia --color=yes {0}
- name: "Run CompatHelper"
run: |
import CompatHelper
CompatHelper.main()
shell: julia --color=yes {0}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ on:
tags:
- '*'
branches:
- 'master'
- 'main'
pull_request:
branches:
- 'master'
- 'main'
concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
Expand Down
25 changes: 11 additions & 14 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
name: Documentation
name: Documenter

on:
push:
branches:
- main # update to match your development branch (master, main, dev, trunk, ...)
tags: '*'
branches: main
tags: [v*]
pull_request:

jobs:
build:
Documenter:
permissions:
contents: write
statuses: write
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: '1.8'
- name: Install dependencies
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
- name: Build and deploy
- uses: julia-actions/cache@v1
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-docdeploy@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # If authenticating with GitHub Actions token
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # If authenticating with SSH deploy key
run: julia --project=docs/ docs/make.jl
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ docs/build/
/ryan/
.vscode/
/Manifest.toml
docs/Manifest.toml
dev/levy.jl
.JuliaFormatter.toml
reyk_local/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ Developers: Reyk Börner, Ryan Deeley, Raphael Römer and Orjan Ameye

Thanks to Jeroen Wouters, Calvin Nesbitt, Tobias Grafke, George Datseris and Oliver Mehling

This work is part of the [CriticalEarth](https://criticalearth.eu) project.
This work is part of the [CriticalEarth](https://www.criticalearth.eu) project.
20 changes: 10 additions & 10 deletions dev/RateSys1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ State = Union{Vector, SVector}
# Define RateSystem
"""
RateSystem(f, pf, dim, σ, g, pg, Σ, process)
Defines a stochastic dynamical system with a rate dependent shift in `CriticalTransitions.jl`. See [documentation](https://reykboerner.github.io/CriticalTransitions.jl/dev/man/stochsystem/).
Defines a stochastic dynamical system with a rate dependent shift in `CriticalTransitions.jl`. See [documentation](https://juliadynamics.github.io/CriticalTransitions.jl/dev/man/stochsystem/).
"""
struct RateSystem
# i think it would maybe be helpful to define a few more fields:
# gL::Function, a function describing the noise functions of the time-dependent functions
# dim2::Int64, gives the number of time-dependent functions
# Σ₂::CovMatrix, gives the covariance matrix of the time-dependent parameters
f::Function # vector of functions describing the derivatives of each state variable
pf::Parameters # parameters for the derivatives of the state variables
pf::Parameters # parameters for the derivatives of the state variables
td_inds::Vector{Bool} # a boolean vector indicating which parameters are time-dependent
L::Function # vector of functions describing the derivatives of each time-dependent parameter
pL::Parameters # parameters for the derivatives of the parameter variables
T_trans::Float64 # the length of time before ramping begins
T_shift::Float64 # the length of time where the specified parameters evolve
dim::Int64
dim::Int64
σ::Float64
g::Function
pg::Parameters
Expand Down Expand Up @@ -59,7 +59,7 @@ function simulate(sys::RateSystem, init::State;
func(u,p,t) = fL(u,p,t,sys)

prob = SDEProblem(func, σg(sys), init, (0, tmax), p(sys), noise=stochprocess(sys))

solve(prob, solver; dt=dt, callback=callback, progress=progress, kwargs...)

end;
Expand All @@ -77,7 +77,7 @@ This function integrates `sys.f` forward in time, using the [`ODEProblem`](https
* `callback=nothing`: callback condition
* `kwargs...`: keyword arguments for `solve(ODEProblem)`

For more info, see [`ODEProblem`](https://diffeq.sciml.ai/stable/types/ode_types/#SciMLBase.ODEProblem).
For more info, see [`ODEProblem`](https://diffeq.sciml.ai/stable/types/ode_types/#SciMLBase.ODEProblem).
For stochastic integration, see [`simulate`](@ref).

> Warning: This function has only been tested for the `Euler()` solver.
Expand All @@ -88,7 +88,7 @@ function relax(sys::RateSystem, init::State;
solver=Euler(),
callback=nothing,
kwargs...)

func(u,p,t) = fL(u,p,t,sys)

prob = ODEProblem(func, init, (0, tmax), p(sys))
Expand Down Expand Up @@ -138,7 +138,7 @@ end
gauss(sys::RateSystem)
Returns a Wiener process with dimension `length(sys.u)` and covariance matrix `sys.Σ`.

This function is based on the [`CorrelatedWienerProcess`](https://noise.sciml.ai/stable/noise_processes/#DiffEqNoiseProcess.CorrelatedWienerProcess) of [`DiffEqNoiseProcess.jl`](https://noise.sciml.ai/stable/), a component of `DifferentialEquations.jl`. The initial condition of the process is set to the zero vector at `t=0`.
This function is based on the [`CorrelatedWienerProcess`](https://docs.sciml.ai/DiffEqNoiseProcess/stable/noise_processes/#DiffEqNoiseProcess.CorrelatedWienerProcess) of [`DiffEqNoiseProcess.jl`](https://docs.sciml.ai/DiffEqNoiseProcess/stable/), a component of `DifferentialEquations.jl`. The initial condition of the process is set to the zero vector at `t=0`.
"""
function gauss(sys::RateSystem)
Σ₂ = zeros(sum(sys.td_inds),sum(sys.td_inds)); # the covariance matrix of the time-dependent parameters, fixed to zero for now
Expand All @@ -154,7 +154,7 @@ end;
function fL(u,p,t,sys::RateSystem)

pf = p[1][1:length(sys.pf)];
pL = p[1][length(sys.pf)+1:end];
pL = p[1][length(sys.pf)+1:end];

#stationary = 0..t_trans ∪ t_trans+t_shift..Inf
#du = t in stationary ? hcat(sys.f(u,p,t),zeros(length(sys.pf)) : hcat(sys.f(u,p,t),sys.L(u,p,t))
Expand All @@ -166,9 +166,9 @@ function fL(u,p,t,sys::RateSystem)
pf[sys.td_inds] = param_vars; # modifying the vector of fixed parameters to account for the current values of the time-dependent parameters

nonstationary = sys.T_trans..sys.T_trans+sys.T_shift; # the time-interval of the ramping period

du = t in nonstationary ? vcat(sys.f(state_vars,[pf],t),sys.L(param_vars,[pL],t)) : vcat(sys.f(state_vars,[pf],t),SVector{sum(sys.td_inds)}(zeros(sum(sys.td_inds))))

end;

stochtorate(sys::StochSystem,td_inds::Vector{Bool},L::Function,pL::Vector,T_trans::Float64,T_shift::Float64)=RateSystem(sys.f,sys.pf,td_inds,L,pL,T_trans,T_shift,length(sys.u),sys.σ,sys.g,sys.pg,sys.Σ,sys.process)
stochtorate(sys::StochSystem,td_inds::Vector{Bool},L::Function,pL::Vector,T_trans::Float64,T_shift::Float64)=RateSystem(sys.f,sys.pf,td_inds,L,pL,T_trans,T_shift,length(sys.u),sys.σ,sys.g,sys.pg,sys.Σ,sys.process)
Loading
Loading