Skip to content

Commit

Permalink
Merge branch 'main' into add-manuscript
Browse files Browse the repository at this point in the history
  • Loading branch information
seabbs authored Feb 9, 2024
2 parents 9739313 + 8085706 commit 4bf5cd6
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 39 deletions.
35 changes: 35 additions & 0 deletions .github/actions/install-julia/action.yaml
Original file line number Diff line number Diff line change
@@ -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') }}
4 changes: 4 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
33 changes: 1 addition & 32 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -56,4 +25,4 @@ repos:
hooks:
- id: detect-secrets
args: ['--baseline', '.secrets.baseline']
exclude: package.lock.json
exclude: EpiAware/Manifest.toml
2 changes: 1 addition & 1 deletion EpiAware/src/epimodel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions EpiAware/src/utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion EpiAware/test/prior_predictive_checking/README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# Folder for prior predictive checking
# Folder for prior predictive checking
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4bf5cd6

Please sign in to comment.