diff --git a/.github/actions/install-julia/action.yaml b/.github/actions/install-julia/action.yaml new file mode 100644 index 000000000..b28c75f78 --- /dev/null +++ b/.github/actions/install-julia/action.yaml @@ -0,0 +1,35 @@ +name: Install Julia +description: Installs a user-specified version of Julia +inputs: + version: + description: 'The version of Julia to install (e.g., 1.10.0)' + required: true + default: '1.10.0' +runs: + using: composite + steps: + - name: Cache Julia binary + id: cache-julia + uses: actions/cache@v3 + with: + path: ~/julia + key: julia-binary-${{ inputs.version }} + restore-keys: | + julia-binary-${{ inputs.version }} + - name: Install Julia + if: steps.cache-julia.outputs.cache-hit != 'true' + run: | + mkdir -p ~/julia + version=$(echo ${{ inputs.version }} | cut -d. -f1,2) + wget https://julialang-s3.julialang.org/bin/linux/x64/$version/julia-${{ inputs.version }}-linux-x86_64.tar.gz -O ~/julia/julia.tar.gz + shell: bash + - run: tar -xzf ~/julia/julia.tar.gz -C ~/julia --strip-components=1 + shell: bash + - run: echo "$HOME/julia/bin" >> $GITHUB_PATH + shell: bash + - uses: actions/cache@v3 + with: + path: | + ~/.julia + ~/.cache/julia + key: julia-${{ inputs.version }}-${{ hashFiles('**/*.toml') }} diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml index fc0c5c019..7aa43557e 100644 --- a/.github/workflows/pre-commit.yaml +++ b/.github/workflows/pre-commit.yaml @@ -11,4 +11,8 @@ jobs: steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v3 + - uses: ./.github/actions/install-julia + with: + version: '1.10.0' + - run: julia -e 'using Pkg; Pkg.add("JuliaFormatter")' - uses: ./.github/actions/pre-commit diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 58e59e9bb..9a211540b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,37 +11,6 @@ repos: - id: mixed-line-ending - id: trailing-whitespace ##### -# Python -- repo: https://github.com/psf/black - rev: 23.10.0 - hooks: - - id: black - args: ['--line-length', '79'] -- repo: https://github.com/PyCQA/isort - rev: 5.12.0 - hooks: - - id: isort - args: ['--profile', 'black', - '--line-length', '79'] -- repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.0 - hooks: - - id: ruff -##### -# R -- repo: https://github.com/lorenzwalthert/precommit - rev: v0.3.2.9023 - hooks: - - id: style-files - - id: lintr -##### -# Java -- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks - rev: v2.11.0 - hooks: - - id: pretty-format-java - args: [--aosp,--autofix] -##### # Julia # Due to lack of first-class Julia support, this needs Julia local install # and JuliaFormatter.jl installed in the library @@ -56,4 +25,4 @@ repos: hooks: - id: detect-secrets args: ['--baseline', '.secrets.baseline'] - exclude: package.lock.json + exclude: EpiAware/Manifest.toml diff --git a/EpiAware/README.md b/EpiAware/README.md index fb7561359..df1fc5002 100644 --- a/EpiAware/README.md +++ b/EpiAware/README.md @@ -1 +1 @@ -# Readme for EpiAware \ No newline at end of file +# Readme for EpiAware diff --git a/EpiAware/src/epimodel.jl b/EpiAware/src/epimodel.jl index 894c1a062..08621c903 100644 --- a/EpiAware/src/epimodel.jl +++ b/EpiAware/src/epimodel.jl @@ -9,7 +9,7 @@ The `EpiModel` struct represents a basic renewal model. # Fields - `gen_int::Vector{T}`: Discrete generation distribution. - `delay_int::Vector{T}`: Discrete delay distribution. -- `delay_kernel::SparseMatrixCSC{T,Integer}`: Sparse matrix representing the action of convoluting +- `delay_kernel::SparseMatrixCSC{T,Integer}`: Sparse matrix representing the action of convoluting a series of infections with observation delay. - `cluster_coeff::T`: Cluster coefficient for negative binomial distribution of observations. - `len_gen_int::Integer`: Length of `gen_int` vector. diff --git a/EpiAware/src/utilities.jl b/EpiAware/src/utilities.jl index 3768f0464..756ee5dc8 100644 --- a/EpiAware/src/utilities.jl +++ b/EpiAware/src/utilities.jl @@ -2,9 +2,9 @@ scan(f, init, xs) Apply a function `f` to each element of `xs` along with an accumulator hidden state with intial -value `init`. The function `f` takes the current accumulator value and the current element of `xs` as -arguments, and returns a new accumulator value and a result value. The function `scan` returns a tuple -`(ys, carry)`, where `ys` is an array containing the result values and `carry` is the final accumulator +value `init`. The function `f` takes the current accumulator value and the current element of `xs` as +arguments, and returns a new accumulator value and a result value. The function `scan` returns a tuple +`(ys, carry)`, where `ys` is an array containing the result values and `carry` is the final accumulator value. This is similar to the JAX function `jax.lax.scan`. # Arguments @@ -58,7 +58,7 @@ end """ growth_rate_to_reproductive_ratio(r, w) -Compute the reproductive ratio given exponential growth rate `r` +Compute the reproductive ratio given exponential growth rate `r` and discretized generation interval `w`. # Arguments diff --git a/EpiAware/test/prior_predictive_checking/README.md b/EpiAware/test/prior_predictive_checking/README.md index 13eac8056..134b57ad7 100644 --- a/EpiAware/test/prior_predictive_checking/README.md +++ b/EpiAware/test/prior_predictive_checking/README.md @@ -1 +1 @@ -# Folder for prior predictive checking \ No newline at end of file +# Folder for prior predictive checking diff --git a/EpiAware/test/prior_predictive_checking/ppc-latent-processes.jl b/EpiAware/test/prior_predictive_checking/ppc-latent-processes.jl index 116df07da..7f212d3ac 100644 --- a/EpiAware/test/prior_predictive_checking/ppc-latent-processes.jl +++ b/EpiAware/test/prior_predictive_checking/ppc-latent-processes.jl @@ -19,7 +19,7 @@ prior_chn = sample(model, Prior(), n_samples) sampled_walks = prior_chn |> chn -> mapreduce(hcat, generated_quantities(model, chn)) do gen gen[1] end -## From law of total variance and known mean of HalfNormal distribution +## From law of total variance and known mean of HalfNormal distribution theoretical_std = [ t * latent_process_priors.var_RW_dist.untruncated.σ * sqrt(2) / sqrt(π) for t = 1:n diff --git a/analysis/README.md b/analysis/README.md index 0df522cf6..6b2f9bd3d 100644 --- a/analysis/README.md +++ b/analysis/README.md @@ -1 +1 @@ -# Analysis description here \ No newline at end of file +# Analysis description here diff --git a/pipeline/README.md b/pipeline/README.md index ed7f3c535..cc5042d37 100644 --- a/pipeline/README.md +++ b/pipeline/README.md @@ -1 +1 @@ -# Readme for the pipeline \ No newline at end of file +# Readme for the pipeline